List:Commits« Previous MessageNext Message »
From:Martin Skold Date:February 6 2007 11:07pm
Subject:bk commit into 5.0 tree (mskold:1.2297) BUG#25821
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-02-06 23:06:58+01:00, mskold@stripped +7 -0
  Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  mysql-test/r/ndb_read_multi_range.result@stripped, 2007-02-06 23:05:56+01:00,
mskold@stripped +7 -0
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  mysql-test/t/ndb_read_multi_range.test@stripped, 2007-02-06 23:05:56+01:00, mskold@stripped
+9 -0
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  ndb/include/ndbapi/NdbIndexScanOperation.hpp@stripped, 2007-02-06 23:05:56+01:00,
mskold@stripped +4 -2
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  ndb/include/ndbapi/NdbScanOperation.hpp@stripped, 2007-02-06 23:05:56+01:00,
mskold@stripped +4 -1
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  ndb/src/ndbapi/NdbScanOperation.cpp@stripped, 2007-02-06 23:05:56+01:00, mskold@stripped +3
-2
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  sql/ha_ndbcluster.cc@stripped, 2007-02-06 23:05:56+01:00, mskold@stripped +1 -1
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

  sql/ha_ndbcluster.h@stripped, 2007-02-06 23:05:56+01:00, mskold@stripped +1 -0
    Fix for bug#25821  Excessive partition pruning for multi-range index scan in NDB API:
don't set distribution key if multi_range

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mskold
# Host:	linux.site
# Root:	/windows/Linux_space/MySQL/mysql-5.0

--- 1.21/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2007-02-06 23:07:05 +01:00
+++ 1.22/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2007-02-06 23:07:05 +01:00
@@ -64,12 +64,14 @@ public:
                         bool order_by,
                         bool order_desc = false,
                         bool read_range_no = false,
-			bool keyinfo = false) {
+			bool keyinfo = false,
+			bool multi_range = false) {
     Uint32 scan_flags =
       (SF_OrderBy & -(Int32)order_by) |
       (SF_Descending & -(Int32)order_desc) |
       (SF_ReadRangeNo & -(Int32)read_range_no) | 
-      (SF_KeyInfo & -(Int32)keyinfo);
+      (SF_KeyInfo & -(Int32)keyinfo) |
+      (SF_MultiRange & -(Int32)multi_range);
     
     return readTuples(lock_mode, scan_flags, parallel, batch);
   }

--- 1.37/ndb/include/ndbapi/NdbScanOperation.hpp	2007-02-06 23:07:06 +01:00
+++ 1.38/ndb/include/ndbapi/NdbScanOperation.hpp	2007-02-06 23:07:06 +01:00
@@ -45,6 +45,7 @@ public:
     SF_OrderBy = (1 << 24),     // index scan in order
     SF_Descending = (2 << 24),  // index scan in descending order
     SF_ReadRangeNo = (4 << 24), // enable @ref get_range_no
+    SF_MultiRange = (8 << 24),  // scan is part of multi-range scan
     SF_KeyInfo = 1              // request KeyInfo to be sent back
   };
 
@@ -71,7 +72,8 @@ public:
    */ 
 #ifdef ndb_readtuples_impossible_overload
   int readTuples(LockMode lock_mode = LM_Read, 
-		 Uint32 batch = 0, Uint32 parallel = 0, bool keyinfo = false);
+		 Uint32 batch = 0, Uint32 parallel = 0, 
+                 bool keyinfo = false, bool multi_range);
 #endif
   
   inline int readTuples(int parallell){
@@ -263,6 +265,7 @@ protected:
   bool m_descending;
   Uint32 m_read_range_no;
   NdbRecAttr *m_curr_row; // Pointer to last returned row
+  bool m_multi_range; // Mark if operation is part of multi-range scan
 };
 
 inline

--- 1.79/ndb/src/ndbapi/NdbScanOperation.cpp	2007-02-06 23:07:06 +01:00
+++ 1.80/ndb/src/ndbapi/NdbScanOperation.cpp	2007-02-06 23:07:06 +01:00
@@ -1189,7 +1189,7 @@ NdbIndexScanOperation::setBound(const Nd
      * so it's safe to use [tIndexAttrId] 
      * (instead of looping as is NdbOperation::equal_impl)
      */
-    if(type == BoundEQ && tDistrKey)
+    if(type == BoundEQ && tDistrKey && !m_multi_range)
     {
       theNoOfTupKeyLeft--;
       return handle_distribution_key((Uint64*)aValue, sizeInWords);
@@ -1250,7 +1250,8 @@ NdbIndexScanOperation::readTuples(LockMo
   const bool order_by = scan_flags & SF_OrderBy;
   const bool order_desc = scan_flags & SF_Descending;
   const bool read_range_no = scan_flags & SF_ReadRangeNo;
-  
+  m_multi_range = scan_flags & SF_MultiRange;
+
   int res = NdbScanOperation::readTuples(lm, scan_flags, parallel, batch);
   if(!res && read_range_no)
   {

--- 1.293/sql/ha_ndbcluster.cc	2007-02-06 23:07:06 +01:00
+++ 1.294/sql/ha_ndbcluster.cc	2007-02-06 23:07:06 +01:00
@@ -6348,7 +6348,7 @@ ha_ndbcluster::read_multi_range_first(KE
         }
         else if ((scanOp= m_active_trans->getNdbIndexScanOperation(idx, tab)) 
                  &&!scanOp->readTuples(lm, 0, parallelism, sorted, 
-				       FALSE, TRUE, need_pk)
+				       FALSE, TRUE, need_pk, TRUE)
                  &&!generate_scan_filter(m_cond_stack, scanOp)
                  &&!define_read_attrs(end_of_buffer-reclength, scanOp))
         {

--- 1.107/sql/ha_ndbcluster.h	2007-02-06 23:07:06 +01:00
+++ 1.108/sql/ha_ndbcluster.h	2007-02-06 23:07:06 +01:00
@@ -661,6 +661,7 @@ private:
                                       const NdbOperation *first,
                                       const NdbOperation *last,
                                       uint errcode);
+  bool key_fields_not_in_write_set(THD *thd, const KEY* key_info);
   int peek_indexed_rows(const byte *record, bool check_pk);
   int unique_index_read(const byte *key, uint key_len, 
                         byte *buf);

--- 1.7/mysql-test/r/ndb_read_multi_range.result	2007-02-06 23:07:06 +01:00
+++ 1.8/mysql-test/r/ndb_read_multi_range.result	2007-02-06 23:07:06 +01:00
@@ -398,3 +398,10 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
 UPDATE t1 SET var2 = 9 WHERE var1 IN(1,2,3);
 DROP TRIGGER testtrigger;
 DROP TABLE t1, t2;
+create table t2 (a int, b int, primary key (a), key ab (a,b)) engine=ndbcluster;
+insert into t2 values (1,1), (10,10);
+select * from t2 use index (ab) where a in(1,10) order by a;
+a	b
+1	1
+10	10
+drop table t2;

--- 1.8/mysql-test/t/ndb_read_multi_range.test	2007-02-06 23:07:06 +01:00
+++ 1.9/mysql-test/t/ndb_read_multi_range.test	2007-02-06 23:07:06 +01:00
@@ -282,3 +282,12 @@ UPDATE t1 SET var2 = 9 WHERE var1 IN(1,2
 DROP TRIGGER testtrigger;
 
 DROP TABLE t1, t2;
+
+#bug#25821
+create table t2 (a int, b int, primary key (a), key ab (a,b)) engine=ndbcluster;
+
+insert into t2 values (1,1), (10,10);
+
+select * from t2 use index (ab) where a in(1,10) order by a;
+
+drop table t2;
Thread
bk commit into 5.0 tree (mskold:1.2297) BUG#25821Martin Skold6 Feb