diff options
author | Monty <monty@mariadb.org> | 2019-05-02 16:11:32 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2019-05-02 16:11:32 +0300 |
commit | 0cc7c6085e2caa71ad21eca6f19f5cca45457660 (patch) | |
tree | 26eff3f9b131c93afedbca773a60f0f654480592 | |
parent | 2b7e080faece853f463f6f546066d54e1cbc330b (diff) | |
download | mariadb-git-0cc7c6085e2caa71ad21eca6f19f5cca45457660.tar.gz |
Enable mysqlcheck and flush_read_lock tests
- Updated results
- Run mysqlcheck without --user-stat-tables=PREFERABLY to keep results
consistent
- Don't allow one to run analyze table under FTWRL as analyze table
nowadays has to update status tables.
-rw-r--r-- | mysql-test/main/disabled.def | 2 | ||||
-rw-r--r-- | mysql-test/main/flush_read_lock.result | 14 | ||||
-rw-r--r-- | mysql-test/main/flush_read_lock.test | 8 | ||||
-rw-r--r-- | mysql-test/main/mysqlcheck-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/main/mysqlcheck.result | 10 | ||||
-rw-r--r-- | mysql-test/main/mysqlcheck.test | 4 | ||||
-rw-r--r-- | sql/sql_admin.cc | 3 |
7 files changed, 22 insertions, 20 deletions
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def index c1cfd229a9b..43bf4f9ab76 100644 --- a/mysql-test/main/disabled.def +++ b/mysql-test/main/disabled.def @@ -19,6 +19,4 @@ innodb_bug12902967 : broken upstream file_contents : MDEV-6526 these files are not installed anymore max_statement_time : cannot possibly work, depends on timing partition_open_files_limit : open_files_limit check broken by MDEV-18360 -mysqlcheck : special tables like proxy , host specific to a system are shown -flush_read_lock : special tables like proxy , host specific to a system are shown join_cache : enable after MDEV-17752 is fixed diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result index 33dc1092190..5e836dd0544 100644 --- a/mysql-test/main/flush_read_lock.result +++ b/mysql-test/main/flush_read_lock.result @@ -159,11 +159,10 @@ Success: FTWRL is blocked when 'alter event e1 comment 'test'' is active in anot # # 2) ANALYZE TABLE statement is compatible with FTWRL. # See Bug#43336 ANALYZE and OPTIMIZE do not honour -# --read-only for a discussion why. +# --read-only as they update status tables. # -Success: Was able to run 'analyze table t1_base' under FTWRL. -Success: Was able to run 'analyze table t1_base' with FTWRL active in another connection. -Success: Was able to run FTWRL while 'analyze table t1_base' was active in another connection. +Success: Was not able to run 'analyze table t1_base' under FTWRL. +Success: 'analyze table t1_base' is blocked by FTWRL active in another connection. # # 3) BEGIN, ROLLBACK and COMMIT statements. # BEGIN and ROLLBACK are compatible with FTWRL. @@ -1409,10 +1408,8 @@ set autocommit= 1; # 39.1.a) ANALYZE TABLE for transactional table is incompatible with # FTWRL. flush tables with read lock; -# Implicit commits are allowed under FTWRL. analyze table t3_trans; -Table Op Msg_type Msg_text -test.t3_trans analyze status OK +ERROR HY000: Can't execute the query because you have a conflicting read lock unlock tables; # connection con1; @@ -1425,6 +1422,7 @@ unlock tables; connection default; # Reap ANALYZE TABLE Table Op Msg_type Msg_text +test.t3_trans analyze status Engine-independent statistics collected test.t3_trans analyze status OK # # 39.1.b) CHECK TABLE for transactional table is compatible with FTWRL. @@ -1460,7 +1458,7 @@ Success: Was able to run 'repair table t3_temp_trans' with FTWRL active in anoth Success: Was able to run FTWRL while 'repair table t3_temp_trans' was active in another connection. # # And ANALYZE TABLE: -Success: Was able to run 'analyze table t3_temp_trans' under FTWRL. +Error: Wasn't able to run 'analyze table t3_temp_trans' under FTWRL! Success: Was able to run 'analyze table t3_temp_trans' with FTWRL active in another connection. Success: Was able to run FTWRL while 'analyze table t3_temp_trans' was active in another connection. # diff --git a/mysql-test/main/flush_read_lock.test b/mysql-test/main/flush_read_lock.test index f39dbecf4a9..786c1747c20 100644 --- a/mysql-test/main/flush_read_lock.test +++ b/mysql-test/main/flush_read_lock.test @@ -199,11 +199,13 @@ let $cleanup_stmt1= alter event e1 comment ''; --echo # --echo # 2) ANALYZE TABLE statement is compatible with FTWRL. --echo # See Bug#43336 ANALYZE and OPTIMIZE do not honour ---echo # --read-only for a discussion why. +--echo # --read-only as they update status tables. --echo # +let $skip_3rd_check= 1; let $statement= analyze table t1_base; let $cleanup_stmt= ; ---source include/check_ftwrl_compatible.inc +--source include/check_ftwrl_incompatible.inc +let $skip_3rd_check= ; --echo # --echo # 3) BEGIN, ROLLBACK and COMMIT statements. @@ -1712,7 +1714,7 @@ set autocommit= 1; --echo # 39.1.a) ANALYZE TABLE for transactional table is incompatible with --echo # FTWRL. flush tables with read lock; ---echo # Implicit commits are allowed under FTWRL. +--error ER_CANT_UPDATE_WITH_READLOCK analyze table t3_trans; unlock tables; --echo # diff --git a/mysql-test/main/mysqlcheck-master.opt b/mysql-test/main/mysqlcheck-master.opt new file mode 100644 index 00000000000..38190455bbf --- /dev/null +++ b/mysql-test/main/mysqlcheck-master.opt @@ -0,0 +1 @@ +--use-stat-tables=NEVER diff --git a/mysql-test/main/mysqlcheck.result b/mysql-test/main/mysqlcheck.result index 063560e388e..02ab2af9fc1 100644 --- a/mysql-test/main/mysqlcheck.result +++ b/mysql-test/main/mysqlcheck.result @@ -468,11 +468,11 @@ drop database mysqltest1; # 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 +select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type from mysql.column_stats order by db_name,table_name; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type 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 +select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type from mysql.column_stats where db_name = 'test' and table_name = 't1' order by db_name,table_name; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type +test t1 a 1 3 0.0000 4.0000 1.0000 254 DOUBLE_PREC_HB drop table t1; diff --git a/mysql-test/main/mysqlcheck.test b/mysql-test/main/mysqlcheck.test index 779ea8d13d4..d1d57023b5a 100644 --- a/mysql-test/main/mysqlcheck.test +++ b/mysql-test/main/mysqlcheck.test @@ -403,7 +403,7 @@ drop database mysqltest1; --echo # create table t1(a int); insert into t1 (a) values (1), (2), (3); -select * from mysql.column_stats; +select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type from mysql.column_stats order by db_name,table_name; --exec $MYSQL_CHECK --analyze test t1 --persistent -select * from mysql.column_stats where db_name = 'test' and table_name = 't1'; +select db_name,table_name,column_name,min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type from mysql.column_stats where db_name = 'test' and table_name = 't1' order by db_name,table_name; drop table t1; diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index ed48d65fffc..cf45f443a07 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -1305,6 +1305,9 @@ bool Sql_cmd_analyze_table::execute(THD *thd) if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table, FALSE, UINT_MAX, FALSE)) goto error; + if (thd->has_read_only_protection()) + goto error; + WSREP_TO_ISOLATION_BEGIN_WRTCHK(NULL, NULL, first_table); res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "analyze", lock_type, 1, 0, 0, 0, |