Bug #45816 assertion failure with index containing DOUBLE column on partitioned table
Submitted: 29 Jun 2009 5:42 Modified: 8 Mar 2010 14:51
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.30-debug, 5.1.37-debug, 6.0.12-debug OS:Any
Assigned to: Satya B CPU Architecture:Any
Tags: assertion

[29 Jun 2009 5:42] Shane Bester
Description:
Version: '5.1.37-debug-log'  socket: ''  port: 3306  Source distribution
Assertion failed: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index)), file .\field.cc, line 4601

mysqld.exe!my_sigabrt_handler()[mysqld.cc:2014]
mysqld.exe!raise()[winsig.c:590]
mysqld.exe!abort()[abort.c:71]
mysqld.exe!_wassert()[assert.c:212]
mysqld.exe!Field_double::cmp()[field.cc:4601]
mysqld.exe!Field::cmp_max()[field.h:222]
mysqld.exe!key_rec_cmp()[key.cc:541]
mysqld.exe!_downheap()[queues.c:298]
mysqld.exe!queue_fix()[queues.c:368]
mysqld.exe!ha_partition::handle_ordered_index_scan()[ha_partition.cc:4555]
mysqld.exe!ha_partition::common_first_last()[ha_partition.cc:3987]
mysqld.exe!ha_partition::index_first()[ha_partition.cc:3935]
mysqld.exe!join_read_first()[sql_select.cc:11832]
mysqld.exe!sub_select()[sql_select.cc:11137]
mysqld.exe!do_select()[sql_select.cc:10894]
mysqld.exe!JOIN::exec()[sql_select.cc:2199]
mysqld.exe!mysql_select()[sql_select.cc:2388]
mysqld.exe!handle_select()[sql_select.cc:268]
mysqld.exe!execute_sqlcom_select()[sql_parse.cc:5013]
mysqld.exe!mysql_execute_command()[sql_parse.cc:2208]
mysqld.exe!mysql_parse()[sql_parse.cc:5933]
mysqld.exe!dispatch_command()[sql_parse.cc:1213]
mysqld.exe!do_command()[sql_parse.cc:854]
mysqld.exe!handle_one_connection()[sql_connect.cc:1127]
mysqld.exe!pthread_start()[my_winthread.c:85]
mysqld.exe!_callthreadstart()[thread.c:293]
mysqld.exe!_threadstart()[thread.c:277]
kernel32.dll!FlsSetValue()

How to repeat:
#on debug build execute the following sql:

drop table if exists t1;
create table `t1` (`a` int,`b` double,`c` int, key `idx2` (`b`,`a`))
engine=myisam partition by hash (microsecond(c)) partitions 3;
insert into `t1` values (6,6,6);
insert into `t1` values (6,6,-666666);
select 1 from `t1` join `t1` as `t2` using (`a`) for update;
[31 Jul 2009 13:04] 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/79775

3054 Satya B	2009-07-31
      Fix for BUG#45816 - assertion failure with index containing double 
                          column on partitioned table
      
      
      An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query 
      is executed with index containing double column on partitioned table.
      The problem is that assertion expects all the fields which are read,
      to be in the read_set.
      
      In this query only the field 'a' is in the readset as the tables in
      the query are joined by the field 'a' and so the assertion fails 
      expecting other field 'b'.
      
      Since the function cmp() is just comparison of two parameters passed, 
      the assertion is not required.
      
      Fixed by removing the assertion in the double fields comparision
      function.
      
      Note: this bug is not reproducible with other datatypes because the
            assertion doesn't exist in comparision function for other 
            datatypes.
      modified:
        mysql-test/r/partition.result
        mysql-test/t/partition.test
        sql/field.cc
[6 Aug 2009 11:47] 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/80264

3057 Satya B	2009-08-06
      Fix for BUG#45816 - assertion failure with index containing double 
                          column on partitioned table
            
            
      An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query 
      is executed with index containing double column on partitioned table.
      The problem is that assertion expects all the fields which are read,
      to be in the read_set.
            
      In this query only the field 'a' is in the readset as the tables in
      the query are joined by the field 'a' and so the assertion fails 
      expecting other field 'b'.
            
      Since the function cmp() is just comparison of two parameters passed, 
      the assertion is not required.
            
      Fixed by removing the assertion in the double fields comparision
      function and also fixed the index initialization to do ordered
      index scan with RW LOCK which ensures all the fields from a key are in
      the read_set.
       
      
      Note: this bug is not reproducible with other datatypes because the
            assertion doesn't exist in comparision function for other 
            datatypes.
      modified:
        mysql-test/r/partition.result
        mysql-test/t/partition.test
        sql/field.cc
        sql/ha_partition.cc
[6 Aug 2009 12:45] Satya B
patch queued to mysql-5.1-bugteam
[11 Aug 2009 14:32] Bugs System
Pushed into 5.1.38 (revid:davi.arnaut@sun.com-20090811142907-uu7nckpe93pii81v) (version source revid:davi.arnaut@sun.com-20090811142907-uu7nckpe93pii81v) (merge vers: 5.1.38) (pib:11)
[12 Aug 2009 5:25] Jon Stephens
Documented bugfix in the 5.1.38 changelog as follows:

      When using a debug build of MySQL, if a query against a partitioned 
      table having an index on one or more DOUBLE columns used that index, 
      the server failed with an assertion.
[21 Aug 2009 11:42] 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/81277

3521 Satya B	2009-08-21
      Disable the testcase for BUG#45816 in partition.test in mysql-pe branch due to BUG#46853
      
      Commented out the testcase for Bug#45816 in mysql-pe branch
      due to valgrind warnings. Please see Bug#46853
      modified:
        mysql-test/r/partition.result
        mysql-test/t/partition.test
[14 Sep 2009 16:06] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (version source revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (merge vers: 5.4.4-alpha) (pib:11)
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)
[25 Nov 2009 18:50] 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/91693

2943 Magne Mahre	2009-11-25
      Disable the testcase for BUG#45816 in partition.test in mysql-pe 
      branch due to BUG#46853
            
      Commented out the testcase for Bug#45816 in mysql-pe branch
      due to valgrind warnings. Please see Bug#46853
[8 Dec 2009 6:45] Bugs System
Pushed into 6.0.14-alpha (revid:alik@ibmvm-20091208064346-e7bavsqpl86x26dy) (version source revid:alik@ibmvm-20091208064346-e7bavsqpl86x26dy) (merge vers: 6.0.14-alpha) (pib:13)
[8 Dec 2009 6:46] Bugs System
Pushed into 5.6.0-beta (revid:alik@ibmvm-20091207060840-4j0ks51bxwcsln6y) (version source revid:magne.mahre@sun.com-20091125184930-c00efnej2x1i01zm) (merge vers: 5.6.0-beta) (pib:13)
[8 Dec 2009 15:03] Jon Stephens
I can't tell what was actually pushed in the latest pushes, but it looks to me like the only thing that's been pushed into trees newer than 5.1 is the disabling of the test case due to the other bug.

Please enlighten me.

Thanks!
[23 Dec 2009 8:12] Satya B
The last push is about disabling the test.
[6 Mar 2010 11:08] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20091210104731-27nl9weemor51ige) (merge vers: 5.6.0-beta) (pib:16)
[8 Mar 2010 14:48] Jon Stephens
Also documented fix in the 5.5.3 changelog. Closed.