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

Assertion `nests_entered == cur_sj_inner_tables' failed in JOIN::dbug_verify_sj_inner_tables on SELECT

    XMLWordPrintable

Details

    Description

      SET optimizer_join_limit_pref_ratio=10;
      SET optimizer_search_depth=1;
      SELECT ENGINE,SUPPORT,TRANSACTIONS FROM information_schema.ENGINES WHERE SUPPORT IN (SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE IN (SELECT ENGINE FROM information_schema.ENGINES WHERE ENGINE IN (NULL))) ORDER BY ENGINE LIMIT 1;
      

      Leads to:

      CS 11.7.0 4016c905cbabea7f29ed282dc2125254c7c0d419 (Debug)

      mariadbd: /test/11.7_dbg/sql/opt_subselect.cc:3816: void JOIN::dbug_verify_sj_inner_tables(uint) const: Assertion `nests_entered == cur_sj_inner_tables' failed.
      

      CS 11.7.0 4016c905cbabea7f29ed282dc2125254c7c0d419 (Debug)

      Core was generated by `/test/MD141024-mariadb-11.7.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
       
      [Current thread is 1 (LWP 212272)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000014f343e4526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000014f343e288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000014f343e2881b in __assert_fail_base (fmt=0x14f343fd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x62e30e48f720 "nests_entered == cur_sj_inner_tables", file=file@entry=0x62e30e48ee58 "/test/11.7_dbg/sql/opt_subselect.cc", line=line@entry=3816, function=function@entry=0x62e30e48f6e8 "void JOIN::dbug_verify_sj_inner_tables(uint) const") at ./assert/assert.c:94
      #6  0x000014f343e3b507 in __assert_fail (assertion=0x62e30e48f720 "nests_entered == cur_sj_inner_tables", file=0x62e30e48ee58 "/test/11.7_dbg/sql/opt_subselect.cc", line=3816, function=0x62e30e48f6e8 "void JOIN::dbug_verify_sj_inner_tables(uint) const") at ./assert/assert.c:103
      #7  0x000062e30d8e92b4 in JOIN::dbug_verify_sj_inner_tables (this=this@entry=0x14f2f0022a20, prefix_size=prefix_size@entry=1)at /test/11.7_dbg/sql/opt_subselect.cc:3816
      #8  0x000062e30d8e9330 in update_sj_state (join=join@entry=0x14f2f0022a20, new_tab=new_tab@entry=0x14f2f002fa40, idx=idx@entry=0, remaining_tables=remaining_tables@entry=6)at /test/11.7_dbg/sql/opt_subselect.cc:3173
      #9  0x000062e30d8e97c1 in optimize_semi_joins (join=join@entry=0x14f2f0022a20, remaining_tables=<optimized out>, remaining_tables@entry=7, idx=idx@entry=0, current_record_count=current_record_count@entry=0x14f340d46c90, current_read_time=current_read_time@entry=0x14f340d46c98, loose_scan_pos=loose_scan_pos@entry=0x14f2f0031080)at /test/11.7_dbg/sql/opt_subselect.cc:3144
      #10 0x000062e30d76dde5 in best_extension_by_limited_search (join=join@entry=0x14f2f0022a20, remaining_tables=remaining_tables@entry=7, idx=idx@entry=0, record_count=record_count@entry=1, read_time=read_time@entry=0, search_depth=search_depth@entry=1, use_cond_selectivity=use_cond_selectivity@entry=4, processed_eq_ref_tables=processed_eq_ref_tables@entry=0x14f340d46d68)at /test/11.7_dbg/sql/sql_select.cc:12049
      #11 0x000062e30d76e280 in greedy_search (join=join@entry=0x14f2f0022a20, remaining_tables=remaining_tables@entry=7, search_depth=search_depth@entry=1, use_cond_selectivity=use_cond_selectivity@entry=4)at /test/11.7_dbg/sql/sql_select.cc:10650
      #12 0x000062e30d76fd6d in choose_plan (join=join@entry=0x14f2f0022a20, join_tables=7, emb_sjm_nest=emb_sjm_nest@entry=0x0)at /test/11.7_dbg/sql/sql_select.cc:10159
      #13 0x000062e30d7933f4 in make_join_statistics (join=join@entry=0x14f2f0022a20, tables_list=@0x14f2f001afd0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f2f00231e0, last = 0x14f2f0024290, elements = 3}, <No data fields>}, keyuse_array=keyuse_array@entry=0x14f2f0022d80)at /test/11.7_dbg/sql/sql_select.cc:6327
      #14 0x000062e30d79a705 in JOIN::optimize_inner (this=this@entry=0x14f2f0022a20)at /test/11.7_dbg/sql/sql_select.cc:2705
      #15 0x000062e30d79acba in JOIN::optimize (this=this@entry=0x14f2f0022a20)at /test/11.7_dbg/sql/sql_select.cc:2003
      #16 0x000062e30d79adda in mysql_select (thd=thd@entry=0x14f2f0000d58, tables=0x14f2f001b680, fields=@0x14f2f001b070: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14f2f001b3a8, last = 0x14f2f001b620, elements = 3}, <No data fields>}, conds=0x14f2f00213e8, og_num=1, order=0x14f2f0021e28, group=0x0, having=0x0, proc_param=0x0, select_options=2701396736, result=0x14f2f00229f8, unit=0x14f2f0005258, select_lex=0x14f2f001adb8)at /test/11.7_dbg/sql/sql_select.cc:5345
      #17 0x000062e30d79b664 in handle_select (thd=thd@entry=0x14f2f0000d58, lex=lex@entry=0x14f2f0005178, result=result@entry=0x14f2f00229f8, setup_tables_done_option=setup_tables_done_option@entry=0)at /test/11.7_dbg/sql/sql_select.cc:642
      #18 0x000062e30d6f9b15 in execute_sqlcom_select (thd=thd@entry=0x14f2f0000d58, all_tables=0x14f2f001b680) at /test/11.7_dbg/sql/sql_parse.cc:6163
      #19 0x000062e30d70537e in mysql_execute_command (thd=thd@entry=0x14f2f0000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.7_dbg/sql/sql_parse.cc:3954
      #20 0x000062e30d70bd36 in mysql_parse (thd=thd@entry=0x14f2f0000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14f340d48260)at /test/11.7_dbg/sql/sql_parse.cc:7885
      #21 0x000062e30d70e1ee in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14f2f0000d58, packet=packet@entry=0x14f2f000b339 "SELECT ENGINE,SUPPORT,TRANSACTIONS FROM information_schema.ENGINES WHERE SUPPORT IN (SELECT SUPPORT FROM information_schema.ENGINES WHERE ENGINE IN (SELECT ENGINE FROM information_schema.ENGINES WHERE"..., packet_length=packet_length@entry=243, blocking=blocking@entry=true)at /test/11.7_dbg/sql/sql_class.h:257
      #22 0x000062e30d710552 in do_command (thd=0x14f2f0000d58, blocking=blocking@entry=true) at /test/11.7_dbg/sql/sql_parse.cc:1405
      #23 0x000062e30d889e5f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x62e311360d98, put_in_cache=put_in_cache@entry=true)at /test/11.7_dbg/sql/sql_connect.cc:1448
      #24 0x000062e30d88a173 in handle_one_connection (arg=arg@entry=0x62e311360d98)at /test/11.7_dbg/sql/sql_connect.cc:1350
      #25 0x000062e30dcdfbcf in pfs_spawn_thread (arg=0x62e3112cad28)at /test/11.7_dbg/storage/perfschema/pfs.cc:2198
      #26 0x000014f343e9ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #27 0x000014f343f29c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug confirmed present in:
      MariaDB: 10.6.20 (dbg), 10.11.10 (dbg), 11.2.6 (dbg), 11.4.4 (dbg), 11.6.2 (dbg), 11.7.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.27 (dbg), 10.5.27 (opt), 10.6.20 (opt), 10.11.10 (opt), 11.2.6 (opt), 11.4.4 (opt), 11.6.2 (opt), 11.7.0 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.44 (dbg), 5.7.44 (opt), 8.0.36 (dbg), 8.0.36 (opt)

      10.5 Does not crash and produces and Empty set result. Testcase is CLI and MTR compatible.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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