summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-03-02 14:13:39 +0200
committerMonty <monty@mariadb.org>2021-03-02 15:18:18 +0200
commit82efe4a15a985c3902e80eb7e1a70841c08d9f2e (patch)
treec43ac8d53000a9f2176972effe2251a9f4f879db
parenta6c6c4f4633e2432a4b75ad0406df439f732cad8 (diff)
downloadmariadb-git-82efe4a15a985c3902e80eb7e1a70841c08d9f2e.tar.gz
MDEV-23843 Assertions in Diagnostics_area upon table operations under FTWRL
Fixed binary logging in ANALYZE TABLE to work as optimize table
-rw-r--r--mysql-test/main/flush_and_binlog.result11
-rw-r--r--mysql-test/main/flush_and_binlog.test14
-rw-r--r--sql/sql_admin.cc2
3 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/main/flush_and_binlog.result b/mysql-test/main/flush_and_binlog.result
index b9560964046..a1d73c6590f 100644
--- a/mysql-test/main/flush_and_binlog.result
+++ b/mysql-test/main/flush_and_binlog.result
@@ -20,3 +20,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection default;
disconnect con1;
unlock tables;
+# Second test from MDEV-23843
+CREATE TABLE t (a INT);
+FLUSH TABLES WITH READ LOCK;
+connect con1,localhost,root,,;
+SET lock_wait_timeout= 1;
+ANALYZE TABLE t;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+disconnect con1;
+connection default;
+UNLOCK TABLES;
+DROP TABLE t;
diff --git a/mysql-test/main/flush_and_binlog.test b/mysql-test/main/flush_and_binlog.test
index 373b900b451..a28d8e365dd 100644
--- a/mysql-test/main/flush_and_binlog.test
+++ b/mysql-test/main/flush_and_binlog.test
@@ -27,3 +27,17 @@ FLUSH TABLES;
--connection default
--disconnect con1
unlock tables;
+
+--echo # Second test from MDEV-23843
+
+CREATE TABLE t (a INT);
+FLUSH TABLES WITH READ LOCK;
+--connect (con1,localhost,root,,)
+SET lock_wait_timeout= 1;
+--error ER_LOCK_WAIT_TIMEOUT
+ANALYZE TABLE t;
+# Cleanup
+--disconnect con1
+--connection default
+UNLOCK TABLES;
+DROP TABLE t;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index c9185045315..e59dffc10aa 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1396,7 +1396,9 @@ bool Sql_cmd_analyze_table::execute(THD *thd)
/*
Presumably, ANALYZE and binlog writing doesn't require synchronization
*/
+ thd->get_stmt_da()->set_overwrite_status(true);
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ thd->get_stmt_da()->set_overwrite_status(false);
}
m_lex->first_select_lex()->table_list.first= first_table;
m_lex->query_tables= first_table;