summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqlcheck.c11
-rw-r--r--mysql-test/r/mysqlcheck.result64
-rw-r--r--mysql-test/t/mysqlcheck.test29
3 files changed, 95 insertions, 9 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index aebe80b9ba6..7b188d7ce18 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -47,7 +47,7 @@ static char *shared_memory_base_name=0;
#endif
static uint opt_protocol=0;
-enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
+enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
static struct my_option my_long_options[] =
{
@@ -241,6 +241,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
+ int orig_what_to_do= what_to_do;
+
switch(optid) {
case 'a':
what_to_do = DO_ANALYZE;
@@ -315,6 +317,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt->name);
break;
}
+
+ if (orig_what_to_do && (what_to_do != orig_what_to_do))
+ {
+ fprintf(stderr, "Error: %s doesn't support multiple contradicting commands.\n",
+ my_progname);
+ return 1;
+ }
return 0;
}
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index c51d71510f4..241c92f0aa6 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -8,7 +8,7 @@ mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log
-note : The storage engine for the table doesn't support optimize
+note : The storage engine for the table doesn't support analyze
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
@@ -21,7 +21,7 @@ mysql.procs_priv OK
mysql.proxy_priv OK
mysql.servers OK
mysql.slow_log
-note : The storage engine for the table doesn't support optimize
+note : The storage engine for the table doesn't support analyze
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
@@ -29,6 +29,8 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+mtr.global_suppressions Table is already up to date
+mtr.test_suppressions Table is already up to date
mysql.columns_priv OK
mysql.db OK
mysql.event OK
@@ -55,10 +57,64 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.general_log
+note : The storage engine for the table doesn't support analyze
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxy_priv OK
+mysql.servers OK
+mysql.slow_log
+note : The storage engine for the table doesn't support analyze
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+mysql.columns_priv Table is already up to date
+mysql.db Table is already up to date
+mysql.event Table is already up to date
+mysql.func Table is already up to date
+mysql.general_log
+note : The storage engine for the table doesn't support optimize
+mysql.help_category Table is already up to date
+mysql.help_keyword Table is already up to date
+mysql.help_relation Table is already up to date
+mysql.help_topic Table is already up to date
+mysql.host Table is already up to date
+mysql.ndb_binlog_index Table is already up to date
+mysql.plugin Table is already up to date
+mysql.proc Table is already up to date
+mysql.procs_priv Table is already up to date
+mysql.proxy_priv Table is already up to date
+mysql.servers Table is already up to date
+mysql.slow_log
+note : The storage engine for the table doesn't support optimize
+mysql.tables_priv Table is already up to date
+mysql.time_zone Table is already up to date
+mysql.time_zone_leap_second Table is already up to date
+mysql.time_zone_name Table is already up to date
+mysql.time_zone_transition Table is already up to date
+mysql.time_zone_transition_type Table is already up to date
+mysql.user Table is already up to date
create table t1 (a int);
create view v1 as select * from t1;
test.t1 OK
+test.t1 Table is already up to date
test.t1 OK
+test.t1 Table is already up to date
drop view v1;
drop table t1;
create table `t``1`(a int);
@@ -127,6 +183,7 @@ Tables_in_test
t1
#mysql50#v-1
v1
+test.t1 OK
show tables;
Tables_in_test
t1
@@ -200,3 +257,6 @@ Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
End of 5.1 tests
+#
+# Bug #35269: mysqlcheck behaves different depending on order of parameters
+#
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index 831aba72fb5..dd113cb4e74 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -23,10 +23,13 @@ drop database if exists client_test_db;
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
#
--replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --all-databases --analyze --optimize
+--exec $MYSQL_CHECK --all-databases --analyze
+--exec $MYSQL_CHECK --all-databases --optimize
--replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql
---exec $MYSQL_CHECK --analyze --optimize information_schema schemata
+--exec $MYSQL_CHECK --analyze --databases test information_schema mysql
+--exec $MYSQL_CHECK --optimize --databases test information_schema mysql
+--exec $MYSQL_CHECK --analyze information_schema schemata
+--exec $MYSQL_CHECK --optimize information_schema schemata
#
# Bug #16502: mysqlcheck tries to check views
@@ -34,9 +37,11 @@ drop database if exists client_test_db;
create table t1 (a int);
create view v1 as select * from t1;
--replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --analyze --optimize --databases test
+--exec $MYSQL_CHECK --analyze --databases test
+--exec $MYSQL_CHECK --optimize --databases test
--replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --all-in-1 --analyze --optimize --databases test
+--exec $MYSQL_CHECK --all-in-1 --analyze --databases test
+--exec $MYSQL_CHECK --all-in-1 --optimize --databases test
drop view v1;
drop table t1;
@@ -113,7 +118,8 @@ show tables;
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm
show tables;
---exec $MYSQL_CHECK --check-upgrade --fix-table-names --databases test
+--exec $MYSQL_CHECK --check-upgrade --databases test
+--exec $MYSQL_CHECK --fix-table-names --databases test
show tables;
drop view v1, `v-1`;
drop table t1;
@@ -212,3 +218,14 @@ show tables like 't1-1';
drop table `t1-1`;
--echo End of 5.1 tests
+
+
+--echo #
+--echo # Bug #35269: mysqlcheck behaves different depending on order of parameters
+--echo #
+
+--error 13
+--exec $MYSQL_CHECK -a --fix-table-names test "#mysql50#t1-1"
+--error 1
+--exec $MYSQL_CHECK -aoc test "#mysql50#t1-1"
+