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

Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed in ha_partition::handle_ordered_index_scan

Details

    Description

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a INT PRIMARY KEY) PARTITION BY LIST(a) (PARTITION p1 VALUES IN (1,2));
      INSERT INTO t1 VALUES (1),(2);
      SELECT MAX(a) FROM t1 WHERE a > 4;
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 fa6d710b

      mysqld: /data/src/10.2/sql/ha_partition.cc:6133: int ha_partition::handle_ordered_index_scan(uchar*, bool): Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed.
      201126  0:15:01 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f8d48ed8f36 in __GI___assert_fail (assertion=0x55d5474ae440 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=0x55d5474ac100 "/data/src/10.2/sql/ha_partition.cc", line=6133, function=0x55d5474ae400 "int ha_partition::handle_ordered_index_scan(uchar*, bool)") at assert.c:101
      #8  0x000055d54713d710 in ha_partition::handle_ordered_index_scan (this=0x7f8d280a1258, buf=0x7f8d280068e0 "\377\004", reverse_order=false) at /data/src/10.2/sql/ha_partition.cc:6133
      #9  0x000055d54713c577 in ha_partition::common_first_last (this=0x7f8d280a1258, buf=0x7f8d280068e0 "\377\004") at /data/src/10.2/sql/ha_partition.cc:5615
      #10 0x000055d54713c4b1 in ha_partition::index_last (this=0x7f8d280a1258, buf=0x7f8d280068e0 "\377\004") at /data/src/10.2/sql/ha_partition.cc:5594
      #11 0x000055d546a27bb5 in handler::ha_index_last (this=0x7f8d280a1258, buf=0x7f8d280068e0 "\377\004") at /data/src/10.2/sql/handler.cc:2828
      #12 0x000055d546b9476b in get_index_max_value (table=0x7f8d280a0650, ref=0x7f8d3f00b570, range_fl=2) at /data/src/10.2/sql/opt_sum.cc:211
      #13 0x000055d546b94f10 in opt_sum_query (thd=0x7f8d28000d90, tables=..., all_fields=..., conds=0x7f8d28013238) at /data/src/10.2/sql/opt_sum.cc:403
      #14 0x000055d5467e0a4a in JOIN::optimize_inner (this=0x7f8d28013480) at /data/src/10.2/sql/sql_select.cc:1500
      #15 0x000055d5467df416 in JOIN::optimize (this=0x7f8d28013480) at /data/src/10.2/sql/sql_select.cc:1117
      #16 0x000055d5467e8954 in mysql_select (thd=0x7f8d28000d90, tables=0x7f8d28012a68, wild_num=0, fields=..., conds=0x7f8d28013238, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f8d28013460, unit=0x7f8d28004988, select_lex=0x7f8d280050c8) at /data/src/10.2/sql/sql_select.cc:3822
      #17 0x000055d5467dcb5e in handle_select (thd=0x7f8d28000d90, lex=0x7f8d280048c8, result=0x7f8d28013460, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #18 0x000055d5467a74c5 in execute_sqlcom_select (thd=0x7f8d28000d90, all_tables=0x7f8d28012a68) at /data/src/10.2/sql/sql_parse.cc:6249
      #19 0x000055d54679de14 in mysql_execute_command (thd=0x7f8d28000d90) at /data/src/10.2/sql/sql_parse.cc:3558
      #20 0x000055d5467ab253 in mysql_parse (thd=0x7f8d28000d90, rawbuf=0x7f8d280126f8 "SELECT MAX(a) FROM t1 WHERE a > 4", length=33, parser_state=0x7f8d3f00d5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7761
      #21 0x000055d5467994e8 in dispatch_command (command=COM_QUERY, thd=0x7f8d28000d90, packet=0x7f8d28008b51 "SELECT MAX(a) FROM t1 WHERE a > 4", packet_length=33, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #22 0x000055d546797fe3 in do_command (thd=0x7f8d28000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #23 0x000055d5468f2309 in do_handle_one_connection (connect=0x55d549ed78e0) at /data/src/10.2/sql/sql_connect.cc:1336
      #24 0x000055d5468f206e in handle_one_connection (arg=0x55d549ed78e0) at /data/src/10.2/sql/sql_connect.cc:1241
      #25 0x000055d547119a76 in pfs_spawn_thread (arg=0x55d549ebac70) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #26 0x00007f8d493e8609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #27 0x00007f8d48fc4293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.1+, including old releases, with at least MyISAM and InnoDB.
      No obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            There is an additional regression in 10.4+. (Ref next comment).
            The following testcase crashes in 10.4+ only:

            CREATE TABLE t (c INT KEY) PARTITION BY LIST (c) (PARTITION p VALUES IN (0));
            SELECT MAX(c) FROM t WHERE c>1;
            

            Leads to:

            10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug)

            mysqld: /test/10.10_dbg/sql/ha_partition.cc:7814: int ha_partition::handle_ordered_index_scan(uchar*, bool): Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed.
            

            10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug)

            Core was generated by `/test/MD310522-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            [Current thread is 1 (Thread 0x14c7eb52e700 (LWP 1184333))]
            (gdb) bt
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #1  0x000014c81cb04859 in __GI_abort () at abort.c:79
            #2  0x000014c81cb04729 in __assert_fail_base (fmt=0x14c81cc9a588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x557d73a17da0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=0x557d73a16418 "/test/10.10_dbg/sql/ha_partition.cc", line=7814, function=<optimized out>) at assert.c:92
            #3  0x000014c81cb15fd6 in __GI___assert_fail (assertion=assertion@entry=0x557d73a17da0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=file@entry=0x557d73a16418 "/test/10.10_dbg/sql/ha_partition.cc", line=line@entry=7814, function=function@entry=0x557d73a17de8 "int ha_partition::handle_ordered_index_scan(uchar*, bool)") at assert.c:101
            #4  0x0000557d731c7c58 in ha_partition::handle_ordered_index_scan (this=this@entry=0x14c7a00281e0, buf=buf@entry=0x14c7a0027d68 "\377\001", reverse_order=reverse_order@entry=false) at /test/10.10_dbg/sql/ha_partition.cc:7814
            #5  0x0000557d731c88b1 in ha_partition::common_first_last (this=0x14c7a00281e0, buf=0x14c7a0027d68 "\377\001") at /test/10.10_dbg/sql/ha_partition.cc:6042
            #6  0x0000557d731c893a in ha_partition::index_last (this=<optimized out>, buf=<optimized out>) at /test/10.10_dbg/sql/ha_partition.cc:6017
            #7  0x0000557d72f12353 in handler::ha_index_last (this=0x14c7a00281e0, buf=0x14c7a0027d68 "\377\001") at /test/10.10_dbg/sql/handler.cc:3586
            #8  0x0000557d72b2aa5d in get_index_max_value (range_fl=<optimized out>, ref=0x14c7eb52bb60, table=0x14c7a001bb18) at /test/10.10_dbg/sql/handler.h:3428
            #9  opt_sum_query (thd=0x14c7a0000db8, tables=@0x14c7a0013ee0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c7a0015de8, last = 0x14c7a0015de8, elements = 1}, <No data fields>}, all_fields=@0x14c7a0015b98: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c7a00143a0, last = 0x14c7a00143a0, elements = 1}, <No data fields>}, conds=0x14c7a0014ca0) at /test/10.10_dbg/sql/opt_sum.cc:410
            #10 0x0000557d72cb0c98 in JOIN::optimize_inner (this=this@entry=0x14c7a0015830) at /test/10.10_dbg/sql/sql_select.cc:2411
            #11 0x0000557d72cb1452 in JOIN::optimize (this=this@entry=0x14c7a0015830) at /test/10.10_dbg/sql/sql_select.cc:1845
            #12 0x0000557d72cb1545 in mysql_select (thd=thd@entry=0x14c7a0000db8, tables=0x14c7a0014400, fields=@0x14c7a0013f68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c7a00143a0, last = 0x14c7a00143a0, elements = 1}, <No data fields>}, conds=0x14c7a0014ca0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14c7a0015808, unit=0x14c7a0004fd8, select_lex=0x14c7a0013cc8) at /test/10.10_dbg/sql/sql_select.cc:5030
            #13 0x0000557d72cb1d8e in handle_select (thd=thd@entry=0x14c7a0000db8, lex=lex@entry=0x14c7a0004f00, result=result@entry=0x14c7a0015808, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:578
            #14 0x0000557d72c1db5e in execute_sqlcom_select (thd=thd@entry=0x14c7a0000db8, all_tables=0x14c7a0014400) at /test/10.10_dbg/sql/sql_parse.cc:6260
            #15 0x0000557d72c29e70 in mysql_execute_command (thd=thd@entry=0x14c7a0000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944
            #16 0x0000557d72c17e3a in mysql_parse (thd=thd@entry=0x14c7a0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c7eb52d470) at /test/10.10_dbg/sql/sql_parse.cc:8036
            #17 0x0000557d72c25422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c7a0000db8, packet=packet@entry=0x14c7a000b6d9 "SELECT MAX(c) FROM t WHERE c>1", packet_length=packet_length@entry=30, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364
            #18 0x0000557d72c27b2c in do_command (thd=0x14c7a0000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407
            #19 0x0000557d72d873c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x557d75f80e58, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418
            #20 0x0000557d72d878c9 in handle_one_connection (arg=0x557d75f80e58) at /test/10.10_dbg/sql/sql_connect.cc:1312
            #21 0x000014c81d015609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #22 0x000014c81cc01133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Bug confirmed present in:
            MariaDB: 10.4.26 (dbg), 10.5.17 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.0 (dbg)

            Bug (or feature/syntax) confirmed not present in:
            MariaDB: 10.3.36 (dbg), 10.3.36 (opt), 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (dbg), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.0 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

            Roel Roel Van de Paar added a comment - - edited There is an additional regression in 10.4+. (Ref next comment). The following testcase crashes in 10.4+ only: CREATE TABLE t (c INT KEY ) PARTITION BY LIST (c) (PARTITION p VALUES IN (0)); SELECT MAX (c) FROM t WHERE c>1; Leads to: 10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug) mysqld: /test/10.10_dbg/sql/ha_partition.cc:7814: int ha_partition::handle_ordered_index_scan(uchar*, bool): Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed. 10.10.0 081a284712bb661349e2e3802077b12211cede3e (Debug) Core was generated by `/test/MD310522-mariadb-10.10.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 [Current thread is 1 (Thread 0x14c7eb52e700 (LWP 1184333))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x000014c81cb04859 in __GI_abort () at abort.c:79 #2 0x000014c81cb04729 in __assert_fail_base (fmt=0x14c81cc9a588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x557d73a17da0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=0x557d73a16418 "/test/10.10_dbg/sql/ha_partition.cc", line=7814, function=<optimized out>) at assert.c:92 #3 0x000014c81cb15fd6 in __GI___assert_fail (assertion=assertion@entry=0x557d73a17da0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=file@entry=0x557d73a16418 "/test/10.10_dbg/sql/ha_partition.cc", line=line@entry=7814, function=function@entry=0x557d73a17de8 "int ha_partition::handle_ordered_index_scan(uchar*, bool)") at assert.c:101 #4 0x0000557d731c7c58 in ha_partition::handle_ordered_index_scan (this=this@entry=0x14c7a00281e0, buf=buf@entry=0x14c7a0027d68 "\377\001", reverse_order=reverse_order@entry=false) at /test/10.10_dbg/sql/ha_partition.cc:7814 #5 0x0000557d731c88b1 in ha_partition::common_first_last (this=0x14c7a00281e0, buf=0x14c7a0027d68 "\377\001") at /test/10.10_dbg/sql/ha_partition.cc:6042 #6 0x0000557d731c893a in ha_partition::index_last (this=<optimized out>, buf=<optimized out>) at /test/10.10_dbg/sql/ha_partition.cc:6017 #7 0x0000557d72f12353 in handler::ha_index_last (this=0x14c7a00281e0, buf=0x14c7a0027d68 "\377\001") at /test/10.10_dbg/sql/handler.cc:3586 #8 0x0000557d72b2aa5d in get_index_max_value (range_fl=<optimized out>, ref=0x14c7eb52bb60, table=0x14c7a001bb18) at /test/10.10_dbg/sql/handler.h:3428 #9 opt_sum_query (thd=0x14c7a0000db8, tables=@0x14c7a0013ee0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c7a0015de8, last = 0x14c7a0015de8, elements = 1}, <No data fields>}, all_fields=@0x14c7a0015b98: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c7a00143a0, last = 0x14c7a00143a0, elements = 1}, <No data fields>}, conds=0x14c7a0014ca0) at /test/10.10_dbg/sql/opt_sum.cc:410 #10 0x0000557d72cb0c98 in JOIN::optimize_inner (this=this@entry=0x14c7a0015830) at /test/10.10_dbg/sql/sql_select.cc:2411 #11 0x0000557d72cb1452 in JOIN::optimize (this=this@entry=0x14c7a0015830) at /test/10.10_dbg/sql/sql_select.cc:1845 #12 0x0000557d72cb1545 in mysql_select (thd=thd@entry=0x14c7a0000db8, tables=0x14c7a0014400, fields=@0x14c7a0013f68: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c7a00143a0, last = 0x14c7a00143a0, elements = 1}, <No data fields>}, conds=0x14c7a0014ca0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14c7a0015808, unit=0x14c7a0004fd8, select_lex=0x14c7a0013cc8) at /test/10.10_dbg/sql/sql_select.cc:5030 #13 0x0000557d72cb1d8e in handle_select (thd=thd@entry=0x14c7a0000db8, lex=lex@entry=0x14c7a0004f00, result=result@entry=0x14c7a0015808, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.10_dbg/sql/sql_select.cc:578 #14 0x0000557d72c1db5e in execute_sqlcom_select (thd=thd@entry=0x14c7a0000db8, all_tables=0x14c7a0014400) at /test/10.10_dbg/sql/sql_parse.cc:6260 #15 0x0000557d72c29e70 in mysql_execute_command (thd=thd@entry=0x14c7a0000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.10_dbg/sql/sql_parse.cc:3944 #16 0x0000557d72c17e3a in mysql_parse (thd=thd@entry=0x14c7a0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c7eb52d470) at /test/10.10_dbg/sql/sql_parse.cc:8036 #17 0x0000557d72c25422 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c7a0000db8, packet=packet@entry=0x14c7a000b6d9 "SELECT MAX(c) FROM t WHERE c>1", packet_length=packet_length@entry=30, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_class.h:1364 #18 0x0000557d72c27b2c in do_command (thd=0x14c7a0000db8, blocking=blocking@entry=true) at /test/10.10_dbg/sql/sql_parse.cc:1407 #19 0x0000557d72d873c0 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x557d75f80e58, put_in_cache=put_in_cache@entry=true) at /test/10.10_dbg/sql/sql_connect.cc:1418 #20 0x0000557d72d878c9 in handle_one_connection (arg=0x557d75f80e58) at /test/10.10_dbg/sql/sql_connect.cc:1312 #21 0x000014c81d015609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #22 0x000014c81cc01133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.4.26 (dbg), 10.5.17 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.0 (dbg) Bug (or feature/syntax) confirmed not present in: MariaDB: 10.3.36 (dbg), 10.3.36 (opt), 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (dbg), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.0 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)
            Roel Roel Van de Paar added a comment - - edited

            The original testcase now no longer crashes anything less than 10.4+, and in 10.4+ it is the same assertion & stack as with the additional testcase above.

            CREATE TABLE t1 (a INT PRIMARY KEY) PARTITION BY LIST(a) (PARTITION p1 VALUES IN (1,2));
            INSERT INTO t1 VALUES (1),(2);
            SELECT MAX(a) FROM t1 WHERE a > 4;
            

            Leads to:

            10.9.2 6ec17142dcfb1e9d9f41211ed1b6d82e062d1541 (Debug)

            mysqld: /test/10.9_dbg/sql/ha_partition.cc:7814: int ha_partition::handle_ordered_index_scan(uchar*, bool): Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed.
            

            10.9.2 6ec17142dcfb1e9d9f41211ed1b6d82e062d1541 (Debug)

            Core was generated by `/test/MD310522-mariadb-10.9.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            [Current thread is 1 (Thread 0x146c31256700 (LWP 1875093))]
            (gdb) bt
            #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
            #1  0x0000146c4a1c1859 in __GI_abort () at abort.c:79
            #2  0x0000146c4a1c1729 in __assert_fail_base (fmt=0x146c4a357588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55970f77dae0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=0x55970f77c158 "/test/10.9_dbg/sql/ha_partition.cc", line=7814, function=<optimized out>) at assert.c:92
            #3  0x0000146c4a1d2fd6 in __GI___assert_fail (assertion=assertion@entry=0x55970f77dae0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=file@entry=0x55970f77c158 "/test/10.9_dbg/sql/ha_partition.cc", line=line@entry=7814, function=function@entry=0x55970f77db28 "int ha_partition::handle_ordered_index_scan(uchar*, bool)") at assert.c:101
            #4  0x000055970ef2ddf4 in ha_partition::handle_ordered_index_scan (this=this@entry=0x146bec028360, buf=buf@entry=0x146bec027ee8 "\377\004", reverse_order=reverse_order@entry=false) at /test/10.9_dbg/sql/ha_partition.cc:7814
            #5  0x000055970ef2ea4d in ha_partition::common_first_last (this=0x146bec028360, buf=0x146bec027ee8 "\377\004") at /test/10.9_dbg/sql/ha_partition.cc:6042
            #6  0x000055970ef2ead6 in ha_partition::index_last (this=<optimized out>, buf=<optimized out>) at /test/10.9_dbg/sql/ha_partition.cc:6017
            #7  0x000055970ec784ef in handler::ha_index_last (this=0x146bec028360, buf=0x146bec027ee8 "\377\004") at /test/10.9_dbg/sql/handler.cc:3586
            #8  0x000055970e890a5d in get_index_max_value (range_fl=<optimized out>, ref=0x146c31253b70, table=0x146bec01e238) at /test/10.9_dbg/sql/handler.h:3428
            #9  opt_sum_query (thd=0x146bec000db8, tables=@0x146bec013ed8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146bec015d60, last = 0x146bec015d60, elements = 1}, <No data fields>}, all_fields=@0x146bec015b10: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146bec014398, last = 0x146bec014398, elements = 1}, <No data fields>}, conds=0x146bec014c98) at /test/10.9_dbg/sql/opt_sum.cc:410
            #10 0x000055970ea16c60 in JOIN::optimize_inner (this=this@entry=0x146bec0157a8) at /test/10.9_dbg/sql/sql_select.cc:2411
            #11 0x000055970ea1741a in JOIN::optimize (this=this@entry=0x146bec0157a8) at /test/10.9_dbg/sql/sql_select.cc:1845
            #12 0x000055970ea1750d in mysql_select (thd=thd@entry=0x146bec000db8, tables=0x146bec0143f8, fields=@0x146bec013f60: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146bec014398, last = 0x146bec014398, elements = 1}, <No data fields>}, conds=0x146bec014c98, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x146bec015780, unit=0x146bec004fd8, select_lex=0x146bec013cc0) at /test/10.9_dbg/sql/sql_select.cc:5030
            #13 0x000055970ea17d56 in handle_select (thd=thd@entry=0x146bec000db8, lex=lex@entry=0x146bec004f00, result=result@entry=0x146bec015780, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.9_dbg/sql/sql_select.cc:578
            #14 0x000055970e983b34 in execute_sqlcom_select (thd=thd@entry=0x146bec000db8, all_tables=0x146bec0143f8) at /test/10.9_dbg/sql/sql_parse.cc:6260
            #15 0x000055970e98fe46 in mysql_execute_command (thd=thd@entry=0x146bec000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:3944
            #16 0x000055970e97de10 in mysql_parse (thd=thd@entry=0x146bec000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146c31255470) at /test/10.9_dbg/sql/sql_parse.cc:8036
            #17 0x000055970e98b3f8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146bec000db8, packet=packet@entry=0x146bec00b6c9 "SELECT MAX(a) FROM t1 WHERE a > 4", packet_length=packet_length@entry=33, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1364
            #18 0x000055970e98db02 in do_command (thd=0x146bec000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1407
            #19 0x000055970eaed360 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x559710f81858, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
            #20 0x000055970eaed869 in handle_one_connection (arg=0x559710f81858) at /test/10.9_dbg/sql/sql_connect.cc:1312
            #21 0x0000146c4a6d2609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #22 0x0000146c4a2be133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Bug confirmed present in:
            MariaDB: 10.4.26 (dbg), 10.5.17 (dbg), 10.6.9 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.0 (dbg)

            Bug (or feature/syntax) confirmed not present in:
            MariaDB: 10.3.36 (dbg), 10.3.36 (opt), 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.0 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

            Roel Roel Van de Paar added a comment - - edited The original testcase now no longer crashes anything less than 10.4+, and in 10.4+ it is the same assertion & stack as with the additional testcase above. CREATE TABLE t1 (a INT PRIMARY KEY ) PARTITION BY LIST(a) (PARTITION p1 VALUES IN (1,2)); INSERT INTO t1 VALUES (1),(2); SELECT MAX (a) FROM t1 WHERE a > 4; Leads to: 10.9.2 6ec17142dcfb1e9d9f41211ed1b6d82e062d1541 (Debug) mysqld: /test/10.9_dbg/sql/ha_partition.cc:7814: int ha_partition::handle_ordered_index_scan(uchar*, bool): Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed. 10.9.2 6ec17142dcfb1e9d9f41211ed1b6d82e062d1541 (Debug) Core was generated by `/test/MD310522-mariadb-10.9.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 [Current thread is 1 (Thread 0x146c31256700 (LWP 1875093))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x0000146c4a1c1859 in __GI_abort () at abort.c:79 #2 0x0000146c4a1c1729 in __assert_fail_base (fmt=0x146c4a357588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55970f77dae0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=0x55970f77c158 "/test/10.9_dbg/sql/ha_partition.cc", line=7814, function=<optimized out>) at assert.c:92 #3 0x0000146c4a1d2fd6 in __GI___assert_fail (assertion=assertion@entry=0x55970f77dae0 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)", file=file@entry=0x55970f77c158 "/test/10.9_dbg/sql/ha_partition.cc", line=line@entry=7814, function=function@entry=0x55970f77db28 "int ha_partition::handle_ordered_index_scan(uchar*, bool)") at assert.c:101 #4 0x000055970ef2ddf4 in ha_partition::handle_ordered_index_scan (this=this@entry=0x146bec028360, buf=buf@entry=0x146bec027ee8 "\377\004", reverse_order=reverse_order@entry=false) at /test/10.9_dbg/sql/ha_partition.cc:7814 #5 0x000055970ef2ea4d in ha_partition::common_first_last (this=0x146bec028360, buf=0x146bec027ee8 "\377\004") at /test/10.9_dbg/sql/ha_partition.cc:6042 #6 0x000055970ef2ead6 in ha_partition::index_last (this=<optimized out>, buf=<optimized out>) at /test/10.9_dbg/sql/ha_partition.cc:6017 #7 0x000055970ec784ef in handler::ha_index_last (this=0x146bec028360, buf=0x146bec027ee8 "\377\004") at /test/10.9_dbg/sql/handler.cc:3586 #8 0x000055970e890a5d in get_index_max_value (range_fl=<optimized out>, ref=0x146c31253b70, table=0x146bec01e238) at /test/10.9_dbg/sql/handler.h:3428 #9 opt_sum_query (thd=0x146bec000db8, tables=@0x146bec013ed8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146bec015d60, last = 0x146bec015d60, elements = 1}, <No data fields>}, all_fields=@0x146bec015b10: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146bec014398, last = 0x146bec014398, elements = 1}, <No data fields>}, conds=0x146bec014c98) at /test/10.9_dbg/sql/opt_sum.cc:410 #10 0x000055970ea16c60 in JOIN::optimize_inner (this=this@entry=0x146bec0157a8) at /test/10.9_dbg/sql/sql_select.cc:2411 #11 0x000055970ea1741a in JOIN::optimize (this=this@entry=0x146bec0157a8) at /test/10.9_dbg/sql/sql_select.cc:1845 #12 0x000055970ea1750d in mysql_select (thd=thd@entry=0x146bec000db8, tables=0x146bec0143f8, fields=@0x146bec013f60: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146bec014398, last = 0x146bec014398, elements = 1}, <No data fields>}, conds=0x146bec014c98, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x146bec015780, unit=0x146bec004fd8, select_lex=0x146bec013cc0) at /test/10.9_dbg/sql/sql_select.cc:5030 #13 0x000055970ea17d56 in handle_select (thd=thd@entry=0x146bec000db8, lex=lex@entry=0x146bec004f00, result=result@entry=0x146bec015780, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.9_dbg/sql/sql_select.cc:578 #14 0x000055970e983b34 in execute_sqlcom_select (thd=thd@entry=0x146bec000db8, all_tables=0x146bec0143f8) at /test/10.9_dbg/sql/sql_parse.cc:6260 #15 0x000055970e98fe46 in mysql_execute_command (thd=thd@entry=0x146bec000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:3944 #16 0x000055970e97de10 in mysql_parse (thd=thd@entry=0x146bec000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146c31255470) at /test/10.9_dbg/sql/sql_parse.cc:8036 #17 0x000055970e98b3f8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146bec000db8, packet=packet@entry=0x146bec00b6c9 "SELECT MAX(a) FROM t1 WHERE a > 4", packet_length=packet_length@entry=33, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1364 #18 0x000055970e98db02 in do_command (thd=0x146bec000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1407 #19 0x000055970eaed360 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x559710f81858, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418 #20 0x000055970eaed869 in handle_one_connection (arg=0x559710f81858) at /test/10.9_dbg/sql/sql_connect.cc:1312 #21 0x0000146c4a6d2609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #22 0x0000146c4a2be133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.4.26 (dbg), 10.5.17 (dbg), 10.6.9 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.0 (dbg) Bug (or feature/syntax) confirmed not present in: MariaDB: 10.3.36 (dbg), 10.3.36 (opt), 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.0 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt), 8.0.29 (dbg), 8.0.29 (opt)

            The following crashes on 10.3 HEAD (f299351e1c2aa00dcce3c6f58c58bb5e28469c61).

            --source include/have_partition.inc
             
            CREATE TABLE t (c INT KEY) PARTITION BY LIST (c) (PARTITION p VALUES IN (0));
            SELECT MAX(c) FROM t WHERE c>1;
             
            # Cleanup
            DROP TABLE t;
            

            0x00007f38e82eba7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
            (rr) bt
            #0  0x00007f38e82eba7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
            #1  0x00007f38e8297476 in raise () from /lib/x86_64-linux-gnu/libc.so.6
            #2  0x00007f38e827d7f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6
            #3  0x00007f38e827d71b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
            #4  0x00007f38e828ee96 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
            #5  0x00005644a5bdee73 in ha_partition::handle_ordered_index_scan (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001", reverse_order=false)
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/ha_partition.cc:7640
            #6  0x00005644a5bcc603 in ha_partition::common_first_last (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001")
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/ha_partition.cc:5855
            #7  0x00005644a5bcc419 in ha_partition::index_last (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001")
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/ha_partition.cc:5830
            #8  0x00005644a48c7543 in handler::ha_index_last (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001")
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/handler.cc:3026
            #9  0x00005644a4cb9bd0 in get_index_max_value (table=0x61f000043688, ref=0x7f38dc881510, range_fl=2) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/opt_sum.cc:211
            #10 0x00005644a4cbafed in opt_sum_query (thd=0x62a000060208, tables=..., all_fields=..., conds=0x62b000000e58)
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/opt_sum.cc:410
            #11 0x00005644a41d6eda in JOIN::optimize_inner (this=0x62b0000010d8) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:1888
            #12 0x00005644a41d2fe7 in JOIN::optimize (this=0x62b0000010d8) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:1519
            #13 0x00005644a41f0622 in mysql_select (thd=0x62a000060208, tables=0x62b0000005f8, wild_num=0, fields=..., conds=0x62b000000e58, og_num=0, order=0x0, group=0x0, 
                having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b0000010a8, unit=0x62a0000640b8, select_lex=0x62a000064850)
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:4340
            #14 0x00005644a41c6a4c in handle_select (thd=0x62a000060208, lex=0x62a000063ff8, result=0x62b0000010a8, setup_tables_done_option=0)
                at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:372
            #15 0x00005644a4135fe0 in execute_sqlcom_select (thd=0x62a000060208, all_tables=0x62b0000005f8) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:6339
            #16 0x00005644a4123d76 in mysql_execute_command (thd=0x62a000060208) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:3870
            #17 0x00005644a413ff2a in mysql_parse (thd=0x62a000060208, rawbuf=0x62b000000228 "SELECT MAX(c) FROM t WHERE c>1", length=30, parser_state=0x7f38dc884740, 
                is_com_multi=false, is_next_command=false) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:7870
            #18 0x00005644a41166ac in dispatch_command (command=COM_QUERY, thd=0x62a000060208, packet=0x6290000dc209 "SELECT MAX(c) FROM t WHERE c>1", packet_length=30, 
                is_com_multi=false, is_next_command=false) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:1852
            #19 0x00005644a41131b5 in do_command (thd=0x62a000060208) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:1398
            #20 0x00005644a44edfdc in do_handle_one_connection (connect=0x608000000a28) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_connect.cc:1403
            #21 0x00005644a44ed8ca in handle_one_connection (arg=0x608000000a28) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_connect.cc:1308
            #22 0x00005644a5b67a54 in pfs_spawn_thread (arg=0x615000003a08) at /home/nayuta_mariadb/repo/mariadb-server/10.3/storage/perfschema/pfs.cc:1869
            #23 0x00007f38e82e9b43 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
            #24 0x00007f38e837abb4 in clone () from /lib/x86_64-linux-gnu/libc.so.6
            

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - - edited The following crashes on 10.3 HEAD (f299351e1c2aa00dcce3c6f58c58bb5e28469c61). --source include/have_partition.inc   CREATE TABLE t (c INT KEY ) PARTITION BY LIST (c) (PARTITION p VALUES IN (0)); SELECT MAX (c) FROM t WHERE c>1;   # Cleanup DROP TABLE t; 0x00007f38e82eba7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6 (rr) bt #0 0x00007f38e82eba7c in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007f38e8297476 in raise () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007f38e827d7f3 in abort () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x00007f38e827d71b in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #4 0x00007f38e828ee96 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6 #5 0x00005644a5bdee73 in ha_partition::handle_ordered_index_scan (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001", reverse_order=false) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/ha_partition.cc:7640 #6 0x00005644a5bcc603 in ha_partition::common_first_last (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001") at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/ha_partition.cc:5855 #7 0x00005644a5bcc419 in ha_partition::index_last (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001") at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/ha_partition.cc:5830 #8 0x00005644a48c7543 in handler::ha_index_last (this=0x61d0001946a8, buf=0x619000082fd0 "\377\001") at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/handler.cc:3026 #9 0x00005644a4cb9bd0 in get_index_max_value (table=0x61f000043688, ref=0x7f38dc881510, range_fl=2) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/opt_sum.cc:211 #10 0x00005644a4cbafed in opt_sum_query (thd=0x62a000060208, tables=..., all_fields=..., conds=0x62b000000e58) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/opt_sum.cc:410 #11 0x00005644a41d6eda in JOIN::optimize_inner (this=0x62b0000010d8) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:1888 #12 0x00005644a41d2fe7 in JOIN::optimize (this=0x62b0000010d8) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:1519 #13 0x00005644a41f0622 in mysql_select (thd=0x62a000060208, tables=0x62b0000005f8, wild_num=0, fields=..., conds=0x62b000000e58, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b0000010a8, unit=0x62a0000640b8, select_lex=0x62a000064850) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:4340 #14 0x00005644a41c6a4c in handle_select (thd=0x62a000060208, lex=0x62a000063ff8, result=0x62b0000010a8, setup_tables_done_option=0) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_select.cc:372 #15 0x00005644a4135fe0 in execute_sqlcom_select (thd=0x62a000060208, all_tables=0x62b0000005f8) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:6339 #16 0x00005644a4123d76 in mysql_execute_command (thd=0x62a000060208) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:3870 #17 0x00005644a413ff2a in mysql_parse (thd=0x62a000060208, rawbuf=0x62b000000228 "SELECT MAX(c) FROM t WHERE c>1", length=30, parser_state=0x7f38dc884740, is_com_multi=false, is_next_command=false) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:7870 #18 0x00005644a41166ac in dispatch_command (command=COM_QUERY, thd=0x62a000060208, packet=0x6290000dc209 "SELECT MAX(c) FROM t WHERE c>1", packet_length=30, is_com_multi=false, is_next_command=false) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:1852 #19 0x00005644a41131b5 in do_command (thd=0x62a000060208) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_parse.cc:1398 #20 0x00005644a44edfdc in do_handle_one_connection (connect=0x608000000a28) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_connect.cc:1403 #21 0x00005644a44ed8ca in handle_one_connection (arg=0x608000000a28) at /home/nayuta_mariadb/repo/mariadb-server/10.3/sql/sql_connect.cc:1308 #22 0x00005644a5b67a54 in pfs_spawn_thread (arg=0x615000003a08) at /home/nayuta_mariadb/repo/mariadb-server/10.3/storage/perfschema/pfs.cc:1869 #23 0x00007f38e82e9b43 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #24 0x00007f38e837abb4 in clone () from /lib/x86_64-linux-gnu/libc.so.6
            nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - - edited psergei Please review: https://github.com/MariaDB/server/commit/9a80cab74d5ccef3d4a79e9b94830a9dd6f520b2

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.