Bug #30583 Partition on DOUBLE key + INNODB + count(*) == crash
Submitted: 23 Aug 2007 1:33 Modified: 22 Oct 2007 18:20
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.22 OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any

[23 Aug 2007 1:33] Timothy Smith
Description:
Found while running partition_float_innodb.test.  I'll attach the backtrace as a file.

The crash doesn't happen with MyISAM.  It requires at least two rows in the table.

How to repeat:
# Doesn't show up with MyISAM
--source include/have_innodb.inc
--disable_warnings
drop table if exists t2;
--enable_warnings

create table t2 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 10;
# Must be at least two rows to trigger the crash
eval insert into t2 values (1);
eval insert into t2 values (2);

select count(*) from t2;

drop table t2;
[23 Aug 2007 1:34] Timothy Smith
bt full

Attachment: gdb.txt (text/plain), 7.71 KiB.

[6 Sep 2007 13:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33812

ChangeSet@1.2569, 2007-09-06 17:05:07+05:00, svoj@mysql.com +3 -0
  BUG#30583 - Partition on DOUBLE key + INNODB + count(*) == crash
  
  Issuing SELECT COUNT(*) against partitioned InnoDB table may cause
  server crash.
  
  Fixed that not all required fields were included into read_set.
[13 Sep 2007 14:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34190

ChangeSet@1.2569, 2007-09-13 18:33:40+05:00, svoj@mysql.com +3 -0
  BUG#30583 - Partition on DOUBLE key + INNODB + count(*) == crash
  
  Issuing SELECT COUNT(*) against partitioned InnoDB table may cause
  server crash.
  
  Fixed that not all required fields were included into read_set.
[22 Oct 2007 17:03] Bugs System
Pushed into 5.1.23-beta
[22 Oct 2007 18:20] Jon Stephens
Documented bugfix in 5.1.23 changelog.
[13 Aug 2013 11:05] Eldad Kohavi
hey
this happens to me on a 5.5.23 linux 64 bit 
i have a partitioned table with the partition being on date + id (which is auto incremented), and doing a count, even an explain on count causes the server to crash

select count(*) into @c1 from x where date_created >= '2013-11-29';

note - there is no data in the table matching this date

error log 

10:55:34 UTC - mysqld got signal 8 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

key_buffer_size=33554432
read_buffer_size=524288
max_used_connections=50
max_threads=500
thread_count=46
connection_count=46
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1318475 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x2aaaf11d2900
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 41be30e0 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x7d2a55]
/usr/sbin/mysqld(handle_fatal_signal+0x3e1)[0x68b441]
/lib64/libpthread.so.0[0x302620ebe0]
/usr/sbin/mysqld(_ZN12ha_partition21min_rows_for_estimateEv+0x5a)[0x961e9a]
/usr/sbin/mysqld[0x7628a9]
/usr/sbin/mysqld[0x763176]
/usr/sbin/mysqld[0x76342b]
/usr/sbin/mysqld(_ZN10SQL_SELECT17test_quick_selectEP3THD6BitmapILj64EEyyb+0xe49)[0x76a8b9]
/usr/sbin/mysqld[0x5ad11f]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x55d)[0x5aef7d]
/usr/sbin/mysqld(_Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xd2)[0x5b9172]
/usr/sbin/mysqld(_Z19mysql_explain_unionP3THDP18st_select_lex_unitP13select_result+0x192)[0x5b9922]
/usr/sbin/mysqld[0x573510]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x32da)[0x57adaa]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x10b)[0x57dd9b]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x14fb)[0x57f31b]
/usr/sbin/mysqld(_Z10do_commandP3THD+0xc4)[0x57f694]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0xef)[0x61902f]
/usr/sbin/mysqld(handle_one_connection+0x54)[0x619124]
/lib64/libpthread.so.0[0x302620677d]
/lib64/libc.so.6(clone+0x6d)[0x3025ad325d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (2aaaadff7110): is an invalid pointer
Connection ID (thread ID): 78
Status: NOT_KILLED
[13 Aug 2013 11:19] Eldad Kohavi
please ignore last comment