summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-05-03 16:30:52 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-05-03 17:43:52 +0300
commit562c88257f574d297ca0d9c284ed80390a3c927b (patch)
treee33a8ddf70ed366cb30d9d979d2724297fdabb29
parenta910e1ee9e6185fbc2c29bca58f02616381d8a36 (diff)
downloadmariadb-git-562c88257f574d297ca0d9c284ed80390a3c927b.tar.gz
MDEV-10674: main.show_explain failed in buildbot
Fix a race condition in the testcase. The testcase assumed that State='Sending data' means that the thread is already in an InnoDB lock wait. This is not case, there is a gap between the state changing to Sending data and execution reaching the point where it is waiting for a lock. Use a more precise check instead, through I_S.INNODB_TRX.
-rw-r--r--mysql-test/t/show_explain.opt1
-rw-r--r--mysql-test/t/show_explain.test9
2 files changed, 9 insertions, 1 deletions
diff --git a/mysql-test/t/show_explain.opt b/mysql-test/t/show_explain.opt
new file mode 100644
index 00000000000..3a3bab51225
--- /dev/null
+++ b/mysql-test/t/show_explain.opt
@@ -0,0 +1 @@
+--enable-plugin-innodb-lock-waits --enable-plugin-innodb-trx
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test
index 2a87d24cf6d..542701bc42b 100644
--- a/mysql-test/t/show_explain.test
+++ b/mysql-test/t/show_explain.test
@@ -861,7 +861,14 @@ select * from t1 where pk between 10 and 20 for update;
# run SHOW EXPLAIN on a frozen thread
connection default;
let $save_wait_condition= $wait_condition;
-let $wait_condition= select State='Sending data' from information_schema.processlist where id=$thr2;
+let $wait_condition=
+select 1
+from information_schema.INNODB_LOCK_WAITS
+where
+ requesting_trx_id=(select trx_id
+ from information_schema.INNODB_TRX
+ where trx_mysql_thread_id=$thr2);
+
let $thr_default=`select connection_id()`;
--source include/wait_condition.inc
--echo # do: send_eval show explain for thr2;