Bug #74779 Assertion :bitmap_is_s et(&m_part_info->read_partitions, m_part_spec.start_part)
Submitted: 11 Nov 2014 7:42 Modified: 11 Nov 2014 8:15
Reporter: Ramesh Sivaraman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.20-debug, 5.6.23, 5.7.6 OS:Linux (CentOS 7)
Assigned to: CPU Architecture:Any

[11 Nov 2014 7:42] Ramesh Sivaraman
Description:
mysqld: /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:5914: int ha_partition::handle_ordered_index_scan(uchar*, bool): Assertion `bitmap_is_s
et(&m_part_info->read_partitions, m_part_spec.start_part)' failed.
07:30:04 UTC - mysqld got signal 6 ;

*** GDB
#0  0x00007ffb093f3771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a9035e in my_write_core (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/mysys/stacktrace.c:422
#2  0x0000000000723688 in handle_fatal_signal (sig=6) at /ssd/ramesh/mysql-server/mysql-5.6/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007ffb081ff5c9 in raise () from /lib64/libc.so.6
#5  0x00007ffb08200cd8 in abort () from /lib64/libc.so.6
#6  0x00007ffb081f8536 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007ffb081f85e2 in __assert_fail () from /lib64/libc.so.6
#8  0x0000000000e0da4f in ha_partition::handle_ordered_index_scan (this=0x7ffa6c0a7f10, buf=0x7ffa6c098020 "\215\005", reverse_order=false) at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:5913
#9  0x0000000000e0c89f in ha_partition::common_first_last (this=0x7ffa6c0a7f10, buf=0x7ffa6c098020 "\215\005") at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:5363
#10 0x0000000000e0c809 in ha_partition::index_last (this=0x7ffa6c0a7f10, buf=0x7ffa6c098020 "\215\005") at /ssd/ramesh/mysql-server/mysql-5.6/sql/ha_partition.cc:5342
#11 0x00000000006390a8 in handler::ha_index_last (this=0x7ffa6c0a7f10, buf=0x7ffa6c098020 "\215\005") at /ssd/ramesh/mysql-server/mysql-5.6/sql/handler.cc:2885
#12 0x000000000096838c in get_index_max_value (table=0x7ffa6c050c00, ref=0x7ffb099e89b0, range_fl=2) at /ssd/ramesh/mysql-server/mysql-5.6/sql/opt_sum.cc:207
#13 0x0000000000968aec in opt_sum_query (thd=0x7ffa75f24000, tables=0x7ffa6c01f380, all_fields=..., conds=0x7ffa6c01fab0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/opt_sum.cc:424
#14 0x000000000099eeec in JOIN::optimize (this=0x7ffa6c01fd10) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_optimizer.cc:296
#15 0x00000000007fe0ee in mysql_execute_select (thd=0x7ffa75f24000, select_lex=0x7ffa75f26878, free_join=true) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_select.cc:1086
#16 0x00000000007fe43f in mysql_select (thd=0x7ffa75f24000, tables=0x7ffa6c01f380, wild_num=0, fields=..., conds=0x7ffa6c01fab0, order=0x7ffa75f26a40, group=0x7ffa75f26978, having=0x0, select_options=2147748608, result=0x7ffa6c01fce8, unit=0x7ffa75f26230, select_lex=0x7ffa75f26878) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_select.cc:1221
#17 0x00000000007fc4c7 in handle_select (thd=0x7ffa75f24000, result=0x7ffa6c01fce8, setup_tables_done_option=0) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_select.cc:110
#18 0x00000000007d681b in execute_sqlcom_select (thd=0x7ffa75f24000, all_tables=0x7ffa6c01f380) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:5103
#19 0x00000000007cf5cb in mysql_execute_command (thd=0x7ffa75f24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:2649
#20 0x00000000007d8fa4 in mysql_parse (thd=0x7ffa75f24000, rawbuf=0x7ffa6c01f010 "SELECT MAX(a)FROM t1 WHERE a>5", length=30, parser_state=0x7ffb099eae70) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:6245
#21 0x00000000007cc557 in dispatch_command (command=COM_QUERY, thd=0x7ffa75f24000, packet=0x7ffa75f62001 "SELECT MAX(a)FROM t1 WHERE a>5", packet_length=30) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1332
#22 0x00000000007cb646 in do_command (thd=0x7ffa75f24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_parse.cc:1034
#23 0x0000000000793a61 in do_handle_one_connection (thd_arg=0x7ffa75f24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:982
#24 0x000000000079354a in handle_one_connection (arg=0x7ffa75f24000) at /ssd/ramesh/mysql-server/mysql-5.6/sql/sql_connect.cc:898
#25 0x0000000000ad4b5c in pfs_spawn_thread (arg=0x7ffb057feb00) at /ssd/ramesh/mysql-server/mysql-5.6/storage/perfschema/pfs.cc:1860
#26 0x00007ffb093eedf3 in start_thread () from /lib64/libpthread.so.0
#27 0x00007ffb082c001d in clone () from /lib64/libc.so.6

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(a INT)ENGINE=InnoDB PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1(a);
SELECT MAX(a)FROM t1 WHERE a>5;
[11 Nov 2014 8:15] MySQL Verification Team
Hello Ramesh Sivaraman,

Thank you for the bug report and test case.
Observed that 5.6.23/5.6.7 debug builds affected.

Thanks,
Umesh
[11 Nov 2014 8:16] MySQL Verification Team
// 5.6.23 debug build

(gdb) bt
#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000affdab in my_write_core (sig=6) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/mysys/stacktrace.c:422
#2  0x000000000077ebbc in handle_fatal_signal (sig=6) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x0000003deac32625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x0000003deac33e05 in abort () at abort.c:92
#6  0x0000003deac2b74e in __assert_fail_base (fmt=<value optimized out>, assertion=0x11c3cb8 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)",
    file=0x11c22d0 "/export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/ha_partition.cc", line=<value optimized out>, function=<value optimized out>) at assert.c:96
#7  0x0000003deac2b810 in __assert_fail (assertion=0x11c3cb8 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)",
    file=0x11c22d0 "/export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/ha_partition.cc", line=5950,
    function=0x11c57a0 "int ha_partition::handle_ordered_index_scan(uchar*, bool)") at assert.c:105
#8  0x0000000000e8821a in ha_partition::handle_ordered_index_scan (this=0x7fbcbc022f20, buf=0x7fbcbc02cb58 "\215\005", reverse_order=false)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/ha_partition.cc:5950
#9  0x0000000000e8708b in ha_partition::common_first_last (this=0x7fbcbc022f20, buf=0x7fbcbc02cb58 "\215\005")
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/ha_partition.cc:5399
#10 0x0000000000e86fff in ha_partition::index_last (this=0x7fbcbc022f20, buf=0x7fbcbc02cb58 "\215\005")
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/ha_partition.cc:5378
#11 0x000000000069086c in handler::ha_index_last (this=0x7fbcbc022f20, buf=0x7fbcbc02cb58 "\215\005")
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/handler.cc:2885
#12 0x00000000009d0924 in get_index_max_value (table=0x7fbcbc022630, ref=0x7fbceca44830, range_fl=2) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/opt_sum.cc:207
#13 0x00000000009d10a0 in opt_sum_query (thd=0x3a7c200, tables=0x7fbcbc005360, all_fields=..., conds=0x7fbcbc005a90)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/opt_sum.cc:424
#14 0x0000000000a0868b in JOIN::optimize (this=0x7fbcbc005cf0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_optimizer.cc:296
#15 0x000000000085d6e3 in mysql_execute_select (thd=0x3a7c200, select_lex=0x3a7ea78, free_join=true)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_select.cc:1086
#16 0x000000000085da4b in mysql_select (thd=0x3a7c200, tables=0x7fbcbc005360, wild_num=0, fields=..., conds=0x7fbcbc005a90, order=0x3a7ec40, group=0x3a7eb78, having=0x0,
    select_options=2147748608, result=0x7fbcbc005cc8, unit=0x3a7e430, select_lex=0x3a7ea78) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_select.cc:1221
#17 0x000000000085ba57 in handle_select (thd=0x3a7c200, result=0x7fbcbc005cc8, setup_tables_done_option=0)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_select.cc:110
#18 0x0000000000835384 in execute_sqlcom_select (thd=0x3a7c200, all_tables=0x7fbcbc005360) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:5103
#19 0x000000000082dadc in mysql_execute_command (thd=0x3a7c200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:2649
#20 0x0000000000837fa9 in mysql_parse (thd=0x3a7c200, rawbuf=0x7fbcbc004ff0 "SELECT MAX(a)FROM t1 WHERE a>5", length=30, parser_state=0x7fbceca46680)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:6357
#21 0x000000000082a92b in dispatch_command (command=COM_QUERY, thd=0x3a7c200, packet=0x3baaa91 "SELECT MAX(a)FROM t1 WHERE a>5", packet_length=30)
    at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1332
#22 0x0000000000829990 in do_command (thd=0x3a7c200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_parse.cc:1034
#23 0x00000000007f0d8f in do_handle_one_connection (thd_arg=0x3a7c200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:982
#24 0x00000000007f0860 in handle_one_connection (arg=0x3a7c200) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/sql/sql_connect.cc:898
#25 0x0000000000e5f509 in pfs_spawn_thread (arg=0x3b6e1c0) at /export/home/pb2/build/sb_0-13622626-1415294505.52/mysqlcom-pro-5.6.23/storage/perfschema/pfs.cc:1860
#26 0x0000003deb0079d1 in start_thread (arg=0x7fbceca47700) at pthread_create.c:301
#27 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
[11 Nov 2014 8:16] MySQL Verification Team
// 5.7.6 debug build

(gdb) bt
#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000f990a1 in my_write_core (sig=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/mysys/stacktrace.c:247
#2  0x000000000092d7cc in handle_fatal_signal (sig=6) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x0000003deac32625 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x0000003deac33e05 in abort () at abort.c:92
#6  0x0000003deac2b74e in __assert_fail_base (fmt=<value optimized out>, assertion=0x17c83f8 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)",
    file=0x17c6940 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/ha_partition.cc", line=<value optimized out>, function=<value optimized out>) at assert.c:96
#7  0x0000003deac2b810 in __assert_fail (assertion=0x17c83f8 "bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)",
    file=0x17c6940 "/pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/ha_partition.cc", line=6043, function=0x17ca360 "int ha_partition::handle_ordered_index_scan(uchar*)")
    at assert.c:105
#8  0x00000000013f2a2b in ha_partition::handle_ordered_index_scan (this=0x7fdbd8021610, buf=0x7fdbd802fa80 "\025\005")
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/ha_partition.cc:6043
#9  0x00000000013f1786 in ha_partition::common_first_last (this=0x7fdbd8021610, buf=0x7fdbd802fa80 "\025\005")
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/ha_partition.cc:5487
#10 0x00000000013f16ae in ha_partition::index_last (this=0x7fdbd8021610, buf=0x7fdbd802fa80 "\025\005") at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/ha_partition.cc:5464
#11 0x0000000000995002 in handler::ha_index_last (this=0x7fdbd8021610, buf=0x7fdbd802fa80 "\025\005") at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/handler.cc:2874
#12 0x0000000000e690d7 in get_index_max_value (table=0x7fdbd8036ca0, ref=0x7fdc183ae770, range_fl=2) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/opt_sum.cc:208
#13 0x0000000000e698a7 in opt_sum_query (thd=0x7fdbd8000cf0, tables=0x7fdbd8006678, all_fields=..., conds=0x7fdbd8006d28)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/opt_sum.cc:438
#14 0x0000000000c8f7b3 in JOIN::optimize (this=0x7fdbd8006f98) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_optimizer.cc:259
#15 0x0000000000cf49c2 in mysql_prepare_and_optimize_select (thd=0x7fdbd8000cf0, fields=..., select_options=2147748608, result=0x7fdbd8006f70, select_lex=0x7fdbd8005490,
    free_join=0x7fdc183aed7e) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_select.cc:1014
#16 0x0000000000cf4a84 in mysql_select (thd=0x7fdbd8000cf0, fields=..., select_options=2147748608, result=0x7fdbd8006f70, select_lex=0x7fdbd8005490)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_select.cc:1051
#17 0x0000000000cf2f6f in handle_select (thd=0x7fdbd8000cf0, result=0x7fdbd8006f70, setup_tables_done_option=0)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_select.cc:97
#18 0x0000000000cbbfbc in execute_sqlcom_select (thd=0x7fdbd8000cf0, all_tables=0x7fdbd8006678) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:4998
#19 0x0000000000cb4078 in mysql_execute_command (thd=0x7fdbd8000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:2487
#20 0x0000000000cbce6a in mysql_parse (thd=0x7fdbd8000cf0, parser_state=0x7fdc183b0660) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:5397
#21 0x0000000000cb0f2c in dispatch_command (command=COM_QUERY, thd=0x7fdbd8000cf0, packet=0x7fdbd8009a21 "SELECT MAX(a)FROM t1 WHERE a>5", packet_length=30)
    at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:1249
#22 0x0000000000cafbd4 in do_command (thd=0x7fdbd8000cf0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/sql_parse.cc:833
#23 0x0000000000dbe89c in handle_connection (arg=0x4a065c0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/sql/conn_handler/connection_handler_per_thread.cc:298
#24 0x000000000138347f in pfs_spawn_thread (arg=0x485cbd0) at /pb2/build/sb_0-13559856-1414670154.69/mysqlcom-pro-5.7.6-m16/storage/perfschema/pfs.cc:2137
#25 0x0000003deb0079d1 in start_thread (arg=0x7fdc183b1700) at pthread_create.c:301
#26 0x0000003deace89dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
[19 Nov 2014 17:28] Mattias Jonsson
Posted by developer:
 
The assert is showing that we do work when not necessary. Not harmful in release build.

partition_scan_set_up() should directly return HA_ERR_END_OF_FILE when no matching partition exists.
[29 Jul 2016 10:37] Sveta Smirnova
Saw same crash in release build 5.5.41