Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32819

main.show_explain failed in buildbot

Details

    Description

      it fails in line 279 + line 510:
      https://buildbot.mariadb.net/buildbot/builders/kvm-debug-ppc64le/builds/464/steps/mtr_nm/logs/stdio

      main.show_explain 'innodb'               w3 [ fail ]
              Test ended at 2023-11-15 23:10:09
       
      CURRENT_TEST: main.show_explain
      mysqltest: At line 279: query 'reap' succeeded - should have failed with error ER_QUERY_INTERRUPTED (1317)...
       
      The result from queries just before the failure was:
      < snip >
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	PRIMARY	a	ALL	NULL	NULL	NULL	NULL	10	Using where
      2	DEPENDENT SUBQUERY	b	ALL	NULL	NULL	NULL	NULL	10	Using where
      Warnings:
      Note	1003	select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
      connection con1;
      a	(select max(a) from t0 b where b.a+a.a<10)
      0	9
      SET debug_dbug=@old_debug;
      # Try to do SHOW EXPLAIN for a query that runs a  SET command:
      #   I've found experimentally that select_id==2 here...
      # 
      set @show_explain_probe_select_id=2;
      SET debug_dbug='+d,show_explain_probe_join_exec_start';
      set @foo= (select max(a) from t0 where sin(a) >0);
      connection default;
      show explain for $thr2;
      ERROR HY000: Target is not executing an operation with a query plan
      kill query $thr2;
      connection con1;
      
      

      https://buildbot.mariadb.net/buildbot/builders/kvm-debug-asan-ubsan/builds/302/steps/mtr_nm/logs/stdio

      [Revision hash: 855356ca6df6cf3c8c8d2feafb41c10824c33a6d]
       
      main.show_explain 'innodb'               w3 [ fail ]
              Test ended at 2023-11-02 13:16:24
       
      CURRENT_TEST: main.show_explain
      mysqltest: At line 510: query 'reap' succeeded - should have failed with error ER_QUERY_INTERRUPTED (1317)...
       
      The result from queries just before the failure was:
      < snip >
      # JOIN::print_explain on query with a JOIN, TEMPTABLE view,
      #          
      CREATE TABLE t3 (a INT);
      CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t3;
      INSERT INTO t3 VALUES (8);
      CREATE TABLE t2 (b INT);
      INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
      explain SELECT * FROM v1, t2;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
      1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	6	
      2	DERIVED	t3	system	NULL	NULL	NULL	NULL	1	
      set @show_explain_probe_select_id=2;
      SET debug_dbug='+d,show_explain_probe_join_exec_end';
      SELECT * FROM v1, t2;
      connection default;
      show explain for $thr2;
      ERROR HY000: Target is not executing an operation with a query plan
      kill query $thr2;
      connection con1;
      

      Attachments

        Issue Links

          Activity

            The failure can be reliably repeated with the below patch.
            It seems a clear race in the test. If the background query completes before the kill hits, then the kill will be missed.
            psergei, why do you think the test does KILL QUERY in these two cases? It was added in 105e3ae6c93f57498fa6c504dfbb92203b0d1056 in 2013, but there's no comments explaining why the kill would be needed.
            Just removing these two KILL QUERY and the matching --error lines makes the test pass and eliminates the race.

            diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test
            index e6cf3971738..e680c82b154 100644
            --- a/mysql-test/main/show_explain.test
            +++ b/mysql-test/main/show_explain.test
            @@ -273,6 +273,7 @@ connection default;
             --source include/wait_condition.inc
             --error ER_TARGET_NOT_EXPLAINABLE
             evalp show explain for $thr2;
            +--sleep 0.1
             evalp kill query $thr2;
             connection con1;
             --error ER_QUERY_INTERRUPTED
            @@ -504,6 +505,7 @@ connection default;
             --source include/wait_condition.inc
             --error ER_TARGET_NOT_EXPLAINABLE
             evalp show explain for $thr2;
            +--sleep 0.1
             evalp kill query $thr2;
             connection con1;
             --error ER_QUERY_INTERRUPTED
            

            knielsen Kristian Nielsen added a comment - The failure can be reliably repeated with the below patch. It seems a clear race in the test. If the background query completes before the kill hits, then the kill will be missed. psergei , why do you think the test does KILL QUERY in these two cases? It was added in 105e3ae6c93f57498fa6c504dfbb92203b0d1056 in 2013, but there's no comments explaining why the kill would be needed. Just removing these two KILL QUERY and the matching --error lines makes the test pass and eliminates the race. diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test index e6cf3971738..e680c82b154 100644 --- a/mysql-test/main/show_explain.test +++ b/mysql-test/main/show_explain.test @@ -273,6 +273,7 @@ connection default; --source include/wait_condition.inc --error ER_TARGET_NOT_EXPLAINABLE evalp show explain for $thr2; +--sleep 0.1 evalp kill query $thr2; connection con1; --error ER_QUERY_INTERRUPTED @@ -504,6 +505,7 @@ connection default; --source include/wait_condition.inc --error ER_TARGET_NOT_EXPLAINABLE evalp show explain for $thr2; +--sleep 0.1 evalp kill query $thr2; connection con1; --error ER_QUERY_INTERRUPTED
            knielsen Kristian Nielsen added a comment - Suggested patch sent for review: https://lists.mariadb.org/hyperkitty/list/commits@lists.mariadb.org/thread/TVEGAEBJ7RFFGGRHVN23IKLCORCF3LE5/

            Fix pushed to 10.11.

            knielsen Kristian Nielsen added a comment - Fix pushed to 10.11.

            People

              knielsen Kristian Nielsen
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.