[Commits] Rev 2829: BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set in file:///home/psergey/dev2/maria-5.3-dsmrr-cpk-r5/

Sergey Petrunya psergey at askmonty.org
Wed Sep 15 15:14:22 EEST 2010


At file:///home/psergey/dev2/maria-5.3-dsmrr-cpk-r5/

------------------------------------------------------------
revno: 2829
revision-id: psergey at askmonty.org-20100915121419-xpe0bcsrew0ok1vo
parent: psergey at askmonty.org-20100913160551-ea7aigfw3kkh788g
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: maria-5.3-dsmrr-cpk-r5
timestamp: Wed 2010-09-15 16:14:19 +0400
message:
  BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
  - When find_all_keys() checks which table columns are needed for table scan
    that is done before the sorting, it should also analyze pushed index condition.
    This is achieved by remembering/checking pre-index-pushed condition.
=== modified file 'mysql-test/r/myisam_mrr.result'
--- a/mysql-test/r/myisam_mrr.result	2010-09-13 16:05:51 +0000
+++ b/mysql-test/r/myisam_mrr.result	2010-09-15 12:14:19 +0000
@@ -437,3 +437,28 @@
 NULL	NULL	5678
 set @@join_cache_level=@save_join_cache_level;
 drop table t0, t1;
+#
+# BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
+#             (table->read_set, field_index))' on REPLACE ... SELECT with MRR
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (
+key1 varchar(10),
+col1 char(255), col2 char(255),
+col3 char(244), col4 char(255),
+key(key1)
+);
+create table t2 like t1;
+insert into t1
+select
+1000+A.a+100*B.a + 10*C.a,
+'col1val', 'col2val',
+'col3val', 'col4val'
+from t0 A, t0 B, t0 C;
+REPLACE INTO t2(col2,col3,col4)
+SELECT col2,col3,col4
+FROM t1
+WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
+ORDER BY col1 LIMIT 7;
+drop table t0, t1, t2;

=== modified file 'mysql-test/t/myisam_mrr.test'
--- a/mysql-test/t/myisam_mrr.test	2010-09-13 16:05:51 +0000
+++ b/mysql-test/t/myisam_mrr.test	2010-09-15 12:14:19 +0000
@@ -140,3 +140,32 @@
 
 set @@join_cache_level=@save_join_cache_level;
 drop table t0, t1;
+
+--echo #
+--echo # BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
+--echo #             (table->read_set, field_index))' on REPLACE ... SELECT with MRR
+--echo #
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (
+  key1 varchar(10),
+  col1 char(255), col2 char(255),
+  col3 char(244), col4 char(255),
+  key(key1)
+);
+create table t2 like t1;
+
+insert into t1
+select
+  1000+A.a+100*B.a + 10*C.a,
+  'col1val', 'col2val',
+  'col3val', 'col4val'
+from t0 A, t0 B, t0 C;
+
+REPLACE INTO t2(col2,col3,col4)
+SELECT col2,col3,col4
+FROM t1
+WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
+ORDER BY col1 LIMIT 7;
+drop table t0, t1, t2;

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2010-07-16 07:33:01 +0000
+++ b/sql/filesort.cc	2010-09-15 12:14:19 +0000
@@ -542,11 +542,6 @@
 		    current_thd->variables.read_buff_size);
   }
 
-  if (quick_select)
-  {
-    if (select->quick->reset())
-      DBUG_RETURN(HA_POS_ERROR);
-  }
 
   /* Remember original bitmaps */
   save_read_set=  sort_form->read_set;
@@ -559,8 +554,18 @@
   if (select && select->cond)
     select->cond->walk(&Item::register_field_in_read_map, 1,
                        (uchar*) sort_form);
+  if (select && select->pre_idx_push_select_cond)
+    select->pre_idx_push_select_cond->walk(&Item::register_field_in_read_map,
+                                           1, (uchar*) sort_form);
+
   sort_form->column_bitmaps_set(&sort_form->tmp_set, &sort_form->tmp_set);
 
+  if (quick_select)
+  {
+    if (select->quick->reset())
+      DBUG_RETURN(HA_POS_ERROR);
+  }
+
   for (;;)
   {
     if (quick_select)

=== modified file 'sql/opt_index_cond_pushdown.cc'
--- a/sql/opt_index_cond_pushdown.cc	2009-12-22 12:49:15 +0000
+++ b/sql/opt_index_cond_pushdown.cc	2010-09-15 12:14:19 +0000
@@ -378,6 +378,7 @@
                                  QT_ORDINARY););
 
         tab->select->cond= tab->select_cond;
+        tab->select->pre_idx_push_select_cond= tab->pre_idx_push_select_cond;
       }
     }
   }

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2010-07-16 09:38:23 +0000
+++ b/sql/opt_range.cc	2010-09-15 12:14:19 +0000
@@ -1119,7 +1119,7 @@
 }
 
 
-SQL_SELECT::SQL_SELECT() :quick(0),cond(0),free_cond(0)
+SQL_SELECT::SQL_SELECT() :quick(0),cond(0),pre_idx_push_select_cond(NULL),free_cond(0)
 {
   quick_keys.clear_all(); needed_reg.clear_all();
   my_b_clear(&file);

=== modified file 'sql/opt_range.h'
--- a/sql/opt_range.h	2010-06-26 10:05:41 +0000
+++ b/sql/opt_range.h	2010-09-15 12:14:19 +0000
@@ -738,6 +738,13 @@
  public:
   QUICK_SELECT_I *quick;	// If quick-select used
   COND		*cond;		// where condition
+
+  /*
+    When using Index Condition Pushdown: condition that we've had before
+    extracting and pushing index condition.
+    In other cases, NULL.
+  */
+  Item *pre_idx_push_select_cond;
   TABLE	*head;
   IO_CACHE file;		// Positions to used records
   ha_rows records;		// Records in use if read from file



More information about the commits mailing list