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

subselect_hash_sj_engine::exec(): Assertion `tmp_table->file->stats.records == 1' failed in subselect_hash_sj_engine::exec

Details

    Description

      USE test;
      SET SQL_MODE='';
      SET SESSION max_heap_table_size=1;
      CREATE TABLE t(a INT,b DOUBLE,c INT,KEY i(b,a)) PARTITION BY HASH(c) PARTITIONS 3;
      INSERT INTO t VALUES(0,0,0);
      INSERT INTO t(b)VALUES (REPEAT(0,0)),(REPEAT(0,0)),(REPEAT(0,0));
      SELECT a FROM t WHERE a NOT IN (SELECT a FROM t);
      

      Leads to:

      10.5.5 e1013725ce0f3f947e728491eef75d9985e8db2f

      mysqld: /test/10.5_dbg/sql/item_subselect.cc:5597: virtual int subselect_hash_sj_engine::exec(): Assertion `tmp_table->file->stats.records == 1' failed.
      

      10.5.5 e1013725ce0f3f947e728491eef75d9985e8db2f

      Core was generated by `/test/MD250620-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x149fcb8a5700 (LWP 2556884))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000559c365e27d0 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000559c35d9b47a in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x0000149fc9b3b801 in __GI_abort () at abort.c:79
      #6  0x0000149fc9b2b39a in __assert_fail_base (fmt=0x149fc9cb27d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x559c36912bc0 "tmp_table->file->stats.records == 1", file=file@entry=0x559c36911c10 "/test/10.5_dbg/sql/item_subselect.cc", line=line@entry=5597, function=function@entry=0x559c36913b80 <subselect_hash_sj_engine::exec()::__PRETTY_FUNCTION__> "virtual int subselect_hash_sj_engine::exec()") at assert.c:92
      #7  0x0000149fc9b2b412 in __GI___assert_fail (assertion=assertion@entry=0x559c36912bc0 "tmp_table->file->stats.records == 1", file=file@entry=0x559c36911c10 "/test/10.5_dbg/sql/item_subselect.cc", line=line@entry=5597, function=function@entry=0x559c36913b80 <subselect_hash_sj_engine::exec()::__PRETTY_FUNCTION__> "virtual int subselect_hash_sj_engine::exec()") at assert.c:101
      #8  0x0000559c35e94317 in subselect_hash_sj_engine::exec (this=0x149fa758e890) at /test/10.5_dbg/sql/item_subselect.cc:5597
      #9  0x0000559c35e87307 in Item_subselect::exec (this=this@entry=0x149fa7476490) at /test/10.5_dbg/sql/item_subselect.cc:782
      #10 0x0000559c35e8baca in Item_in_subselect::exec (this=0x149fa7476490) at /test/10.5_dbg/sql/item_subselect.cc:962
      #11 0x0000559c35e8623a in Item_in_subselect::val_bool (this=0x149fa7476490) at /test/10.5_dbg/sql/item_subselect.cc:1840
      #12 0x0000559c35a02b3f in Item::val_bool_result (this=<optimized out>) at /test/10.5_dbg/sql/item.h:1566
      #13 0x0000559c35def6d3 in Item_in_optimizer::val_int (this=0x149fa7477da0) at /test/10.5_dbg/sql/item_cmpfunc.cc:1639
      #14 0x0000559c35a02b0f in Item::val_int_result (this=<optimized out>) at /test/10.5_dbg/sql/item.h:1562
      #15 0x0000559c35dbaeee in Item_cache_int::cache_value (this=0x149fa7590ee8) at /test/10.5_dbg/sql/item.cc:9843
      #16 0x0000559c35dde777 in Item_cache_wrapper::cache (this=this@entry=0x149fa7590e20) at /test/10.5_dbg/sql/item.cc:8681
      #17 0x0000559c35dd19c4 in Item_cache_wrapper::val_bool (this=0x149fa7590e20) at /test/10.5_dbg/sql/item.cc:8867
      #18 0x0000559c35de4534 in Item_func_not::val_int (this=0x149fa7476710) at /test/10.5_dbg/sql/item_cmpfunc.cc:202
      #19 0x0000559c35b2ec5e in evaluate_join_record (join=join@entry=0x149fa7477108, join_tab=join_tab@entry=0x149fa74793a0, error=error@entry=0) at /test/10.5_dbg/sql/sql_select.cc:20698
      #20 0x0000559c35b361cf in sub_select (join=0x149fa7477108, join_tab=0x149fa74793a0, end_of_records=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:20600
      #21 0x0000559c35b6f150 in do_select (procedure=0x0, join=0x149fa7477108) at /test/10.5_dbg/sql/sql_select.cc:20134
      #22 JOIN::exec_inner (this=this@entry=0x149fa7477108) at /test/10.5_dbg/sql/sql_select.cc:4444
      #23 0x0000559c35b6f76b in JOIN::exec (this=this@entry=0x149fa7477108) at /test/10.5_dbg/sql/sql_select.cc:4225
      #24 0x0000559c35b6da80 in mysql_select (thd=thd@entry=0x149fa7415088, tables=<optimized out>, fields=@0x149fa74742b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x149fa7474720, last = 0x149fa7474720, elements = 1}, <No data fields>}, conds=0x149fa7476710, og_num=0, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x149fa74770e0, unit=0x149fa74190a0, select_lex=0x149fa7474168) at /test/10.5_dbg/sql/sql_select.cc:4649
      #25 0x0000559c35b6ddaf in handle_select (thd=thd@entry=0x149fa7415088, lex=lex@entry=0x149fa7418fd8, result=result@entry=0x149fa74770e0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #26 0x0000559c35af76c9 in execute_sqlcom_select (thd=thd@entry=0x149fa7415088, all_tables=0x149fa7474768) at /test/10.5_dbg/sql/sql_parse.cc:6211
      #27 0x0000559c35af07c2 in mysql_execute_command (thd=thd@entry=0x149fa7415088) at /test/10.5_dbg/sql/sql_parse.cc:3939
      #28 0x0000559c35afd638 in mysql_parse (thd=thd@entry=0x149fa7415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x149fcb8a4350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7995
      #29 0x0000559c35aea110 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x149fa7415088, packet=packet@entry=0x149fa7467089 "", packet_length=packet_length@entry=48, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
      #30 0x0000559c35ae88ea in do_command (thd=0x149fa7415088) at /test/10.5_dbg/sql/sql_parse.cc:1355
      #31 0x0000559c35c4415f in do_handle_one_connection (connect=<optimized out>, connect@entry=0x149faa8d2808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #32 0x0000559c35c4487b in handle_one_connection (arg=arg@entry=0x149faa8d2808) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #33 0x0000559c360a711c in pfs_spawn_thread (arg=0x149fc8446508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #34 0x0000149fca81e6db in start_thread (arg=0x149fcb8a5700) at pthread_create.c:463
      #35 0x0000149fc9c1c88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.5 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.5 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      Attachments

        Activity

          alice Alice Sherepa added a comment -

          I'm getting the same bug on 10.10:

          /10.10/sql/item_subselect.cc:5779: virtual int subselect_hash_sj_engine::exec(): Assertion `tmp_table->file->stats.records == 1' failed.
          220714 12:28:47 [ERROR] mysqld got signal 6 ;
           
          Server version: 10.10.0-MariaDB-debug-log
           
          linux/raise.c:51(__GI_raise)[0x7fb33549c7bb]
          stdlib/abort.c:81(__GI_abort)[0x7fb335487535]
          ??:0(__assert_fail)[0x7fb335495102]
          sql/item_subselect.cc:5780(subselect_hash_sj_engine::exec())[0x55a50f845318]
          sql/item_subselect.cc:854(Item_subselect::exec())[0x55a50f816de5]
          sql/item_subselect.cc:1036(Item_in_subselect::exec())[0x55a50f8182fe]
          sql/item_subselect.cc:1989(Item_in_subselect::val_bool())[0x55a50f822cef]
          sql/item.h:1783(Item::val_bool_result())[0x55a50e94f840]
          sql/item_cmpfunc.cc:1623(Item_in_optimizer::val_int())[0x55a50f66ca1c]
          sql/item.h:1779(Item::val_int_result())[0x55a50e94f6f0]
          sql/item.cc:10125(Item_cache_int::cache_value())[0x55a50f63feb0]
          sql/item.cc:8882(Item_cache_wrapper::cache())[0x55a50f65487b]
          sql/item.cc:9068(Item_cache_wrapper::val_bool())[0x55a50f637300]
          sql/item_cmpfunc.cc:202(Item_func_not::val_int())[0x55a50f65c0a9]
          sql/sql_type.cc:5100(Type_handler_int_result::Item_val_bool(Item*) const)[0x55a50f346742]
          sql/item.h:1688(Item::val_bool())[0x55a50e94f386]
          sql/item_cmpfunc.cc:5435(Item_cond_or::val_int())[0x55a50f68f474]
          sql/opt_range.h:1905(SQL_SELECT::skip_record(THD*))[0x55a50ebf9e19]
          sql/sql_join_cache.cc:3469(JOIN_TAB_SCAN::next())[0x55a50f23a10a]
          sql/sql_join_cache.cc:2338(JOIN_CACHE::join_matching_records(bool))[0x55a50f23504a]
          sql/sql_join_cache.cc:2151(JOIN_CACHE::join_records(bool))[0x55a50f233d00]
          sql/sql_select.cc:21450(sub_select_cache(JOIN*, st_join_table*, bool))[0x55a50ee6e4b8]
          sql/sql_select.cc:21621(sub_select(JOIN*, st_join_table*, bool))[0x55a50ee6eac2]
          sql/sql_select.cc:21223(do_select(JOIN*, Procedure*))[0x55a50ee6d486]
          sql/sql_select.cc:4794(JOIN::exec_inner())[0x55a50edf7682]
          sql/sql_select.cc:4573(JOIN::exec())[0x55a50edf4bc4]
          sql/sql_select.cc:5054(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55a50edf8fb9]
          sql/sql_select.cc:583(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55a50edc988f]
          sql/sql_parse.cc:6260(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55a50ecf3d52]
          sql/sql_parse.cc:3944(mysql_execute_command(THD*, bool))[0x55a50ece2703]
          sql/sql_parse.cc:8036(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55a50ecfeb4f]
          sql/sql_parse.cc:1896(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55a50ecd51fb]
          sql/sql_parse.cc:1407(do_command(THD*, bool))[0x55a50ecd1f31]
          sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x55a50f171c8d]
          sql/sql_connect.cc:1314(handle_one_connection)[0x55a50f171512]
          perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55a50fe1041b]
          nptl/pthread_create.c:487(start_thread)[0x7fb335954fa3]
          x86_64/clone.S:97(clone)[0x7fb33555deff]
          

          alice Alice Sherepa added a comment - I'm getting the same bug on 10.10: /10.10/sql/item_subselect.cc:5779: virtual int subselect_hash_sj_engine::exec(): Assertion `tmp_table->file->stats.records == 1' failed. 220714 12:28:47 [ERROR] mysqld got signal 6 ;   Server version: 10.10.0-MariaDB-debug-log   linux/raise.c:51(__GI_raise)[0x7fb33549c7bb] stdlib/abort.c:81(__GI_abort)[0x7fb335487535] ??:0(__assert_fail)[0x7fb335495102] sql/item_subselect.cc:5780(subselect_hash_sj_engine::exec())[0x55a50f845318] sql/item_subselect.cc:854(Item_subselect::exec())[0x55a50f816de5] sql/item_subselect.cc:1036(Item_in_subselect::exec())[0x55a50f8182fe] sql/item_subselect.cc:1989(Item_in_subselect::val_bool())[0x55a50f822cef] sql/item.h:1783(Item::val_bool_result())[0x55a50e94f840] sql/item_cmpfunc.cc:1623(Item_in_optimizer::val_int())[0x55a50f66ca1c] sql/item.h:1779(Item::val_int_result())[0x55a50e94f6f0] sql/item.cc:10125(Item_cache_int::cache_value())[0x55a50f63feb0] sql/item.cc:8882(Item_cache_wrapper::cache())[0x55a50f65487b] sql/item.cc:9068(Item_cache_wrapper::val_bool())[0x55a50f637300] sql/item_cmpfunc.cc:202(Item_func_not::val_int())[0x55a50f65c0a9] sql/sql_type.cc:5100(Type_handler_int_result::Item_val_bool(Item*) const)[0x55a50f346742] sql/item.h:1688(Item::val_bool())[0x55a50e94f386] sql/item_cmpfunc.cc:5435(Item_cond_or::val_int())[0x55a50f68f474] sql/opt_range.h:1905(SQL_SELECT::skip_record(THD*))[0x55a50ebf9e19] sql/sql_join_cache.cc:3469(JOIN_TAB_SCAN::next())[0x55a50f23a10a] sql/sql_join_cache.cc:2338(JOIN_CACHE::join_matching_records(bool))[0x55a50f23504a] sql/sql_join_cache.cc:2151(JOIN_CACHE::join_records(bool))[0x55a50f233d00] sql/sql_select.cc:21450(sub_select_cache(JOIN*, st_join_table*, bool))[0x55a50ee6e4b8] sql/sql_select.cc:21621(sub_select(JOIN*, st_join_table*, bool))[0x55a50ee6eac2] sql/sql_select.cc:21223(do_select(JOIN*, Procedure*))[0x55a50ee6d486] sql/sql_select.cc:4794(JOIN::exec_inner())[0x55a50edf7682] sql/sql_select.cc:4573(JOIN::exec())[0x55a50edf4bc4] sql/sql_select.cc:5054(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55a50edf8fb9] sql/sql_select.cc:583(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55a50edc988f] sql/sql_parse.cc:6260(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55a50ecf3d52] sql/sql_parse.cc:3944(mysql_execute_command(THD*, bool))[0x55a50ece2703] sql/sql_parse.cc:8036(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55a50ecfeb4f] sql/sql_parse.cc:1896(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55a50ecd51fb] sql/sql_parse.cc:1407(do_command(THD*, bool))[0x55a50ecd1f31] sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x55a50f171c8d] sql/sql_connect.cc:1314(handle_one_connection)[0x55a50f171512] perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55a50fe1041b] nptl/pthread_create.c:487(start_thread)[0x7fb335954fa3] x86_64/clone.S:97(clone)[0x7fb33555deff]

          People

            psergei Sergei Petrunia
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.