Bug #26117 index_merge sort-union over partitioned table crashes
Submitted: 6 Feb 2007 15:19 Modified: 1 Mar 2007 4:51
Reporter: Jake Chung Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.14-Beta/5.1bk OS:Microsoft Windows (Windows/Linux)
Assigned to: Sergey Petrunya CPU Architecture:Any
Tags: crash, index merge, partition

[6 Feb 2007 15:19] Jake Chung
Description:
Performing a query that uses an index merge on a partitioned table will crash mysqld-nt.exe.  

I have tried the same index merge query on a non-partitioned table, and mysqld-nt.exe did not crash.

I am running on a Windows XP Pro machine with 3Ghz Xeon processor and 2 GB of RAM.

my.ini contents:
[client]
port=3306
[mysql]
default-character-set=latin1
[mysqld]
port=3306
default-character-set=latin1
default-storage-engine=INNODB
max_connections=100
query_cache_size=0M
table_cache=100
thread_cache_size=8
innodb_additional_mem_pool_size=5M
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=50M
innodb_log_file_size=100M
innodb_thread_concurrency=8
datadir=c:\mysql\data
basedir=c:\mysql
innodb_buffer_pool_size=750M

How to repeat:
1. Create the table defined in the attachment and insert the records that are provided also in the attachment.

2. EXPLAIN a select query that OR's two indexes from the table (i.e. EXPLAIN SELECT * FROM transaction WHERE first_name='Andy' OR last_name='Jake';).  Make sure that the query is of type 'index_merge'
+----+-------------+-------------+-------------+------------------------+------------------------
| id | select_type | table       | type        | possible_keys          | ...                    |
+----+-------------+-------------+-------------+------------------------+------------------------+
|  1 | SIMPLE      | transaction | index_merge | first_index,last_index | ... |
+----+-------------+-------------+-------------+------------------------+------------------------+
  
If the query does not use an index merge, insert more random entries until the indexes are big enough that the query will use an index merge.

3. Perform the select query (SELECT * FROM transaction WHERE first_name='Jake' OR last_name='Chung';).  An error message will pop up indicating that mysqld-nt.exe has crashed.
[6 Feb 2007 15:21] Jake Chung
Table definition and records to reproduce the bug.

Attachment: mysqlbug.sql (text/plain), 7.23 KiB.

[6 Feb 2007 16:43] MySQL Verification Team
Call Stack for Windows server source 5.1.16

Attachment: call-stack-bug26117.txt (text/plain), 3.52 KiB.

[6 Feb 2007 16:56] MySQL Verification Team
Back Trace on Linux

Attachment: bt-bug26117.txt (text/plain), 7.93 KiB.

[6 Feb 2007 16:58] MySQL Verification Team
Thank you for the bug report. Verified on Windows and Linux with source
servers (both back trace files attached).
[26 Feb 2007 21:44] Sergey Petrunya
Changed synopsis to reflect bug's nature
[26 Feb 2007 21:55] 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/20616

ChangeSet@1.2436, 2007-02-27 00:54:47+03:00, sergefp@mysql.com +4 -0
  BUG#26117 "index_merge sort-union over partitioned table crashes"
  - Add ha_partition::clone() and adjust ha_partition::close() so that 
    m_part_info!=NULL for the clone but is "owned" by the primary instance
    of ha_partition.
[27 Feb 2007 19:02] 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/20681

ChangeSet@1.2436, 2007-02-27 22:01:03+03:00, sergefp@mysql.com +4 -0
  BUG#26117 "index_merge sort-union over partitioned table crashes"
  Before the fix: 
    ha_partition objects had ha_partition::m_part_info==NULL and that caused
    crash
  After: 
  - The new ha_partition::clone() function makes the clones use parent's
    m_part_info value.
  - The parent ha_partition object remains responsible for deallocation of
    m_part_info.
[28 Feb 2007 17:48] Sergei Glukhov
Fixed in 5.1.17-beta
[1 Mar 2007 4:51] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.17 changelog.