diff options
-rw-r--r-- | client/mysqlcheck.c | 7 | ||||
-rw-r--r-- | man/mysqlcheck.1 | 18 | ||||
-rw-r--r-- | mysql-test/r/mysqlcheck.result | 19 | ||||
-rw-r--r-- | mysql-test/t/mysqlcheck.test | 22 |
4 files changed, 58 insertions, 8 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index ead4127dad6..9b6934d204f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -43,7 +43,7 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0, opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0, tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0, opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0, - opt_do_tables= 1; + opt_persistent_all= 0, opt_do_tables= 1; static my_bool opt_write_binlog= 1, opt_flush_tables= 0; static uint verbose = 0, opt_mysql_port=0; static int my_end_arg; @@ -160,6 +160,10 @@ static struct my_option my_long_options[] = {"password", 'p', "Password to use when connecting to server. If password is not given, it's solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"persistent", 'Z', + "When using ANALYZE TABLE use the PERSISTENT FOR ALL option.", + &opt_persistent_all, &opt_persistent_all, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, #ifdef __WIN__ {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -909,6 +913,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) case DO_ANALYZE: DBUG_ASSERT(!view); op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG"; + if (opt_persistent_all) end = strmov(end, " PERSISTENT FOR ALL"); break; case DO_OPTIMIZE: DBUG_ASSERT(!view); diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1 index c175483347c..e05bbf8a519 100644 --- a/man/mysqlcheck.1 +++ b/man/mysqlcheck.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLCHECK\FR" "1" "04/08/2015" "MariaDB 10\&.0" "MariaDB Database System" +.TH "\FBMYSQLCHECK\FR" "1" "27/12/2015" "MariaDB 10\&.0" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -677,6 +677,22 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} +.\" mysqlcheck: persisent option +.\" persistent option: mysql +\fB\-\-persistent\fR, +\fB\-Z\fR +.sp +Used with ANALYZE TABLE to append the option PERSISENT FOR ALL. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqlcheck: pipe option .\" pipe option: mysql \fB\-\-pipe\fR, diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index b4bcdc495ae..66e23c18355 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -347,6 +347,9 @@ CREATE TABLE test.`t.1` (id int); mysqlcheck test t.1 test.t.1 OK drop table test.`t.1`; +# +# MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such +# create view v1 as select 1; mysqlcheck --process-views test test.v1 OK @@ -361,6 +364,9 @@ test.v1 OK mysqlcheck --process-views --check-upgrade test test.v1 OK drop view v1; +# +# MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views +# create table t1(a int); mysqlcheck --process-views --check-upgrade --auto-repair test test.t1 OK @@ -370,3 +376,16 @@ Repairing views test.v1 OK drop view v1; drop table t1; +# +#MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck +# +create table t1(a int); +insert into t1 (a) values (1), (2), (3); +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test.t1 Engine-independent statistics collected +status : OK +select * from mysql.column_stats where db_name = 'test' and table_name = 't1'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 1 3 0.0000 4.0000 1.0000 0 NULL NULL +drop table t1; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index 6cd0265f89a..88f0d034bf0 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -319,9 +319,9 @@ CREATE TABLE test.`t.1` (id int); drop table test.`t.1`; -# -# MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such -# +--echo # +--echo # MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such +--echo # create view v1 as select 1; --echo mysqlcheck --process-views test --exec $MYSQL_CHECK --process-views test @@ -340,12 +340,22 @@ create view v1 as select 1; drop view v1; -# -# MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views -# +--echo # +--echo # MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views +--echo # create table t1(a int); --copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm --echo mysqlcheck --process-views --check-upgrade --auto-repair test --exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test drop view v1; drop table t1; + +--echo # +--echo #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck +--echo # +create table t1(a int); +insert into t1 (a) values (1), (2), (3); +select * from mysql.column_stats; +--exec $MYSQL_CHECK --analyze test t1 --persistent +select * from mysql.column_stats where db_name = 'test' and table_name = 't1'; +drop table t1; |