List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:December 19 2008 9:44am
Subject:bzr push into mysql-5.1 branch (jonas:3186 to 3187) Bug#41353
View as plain text  
 3187 Jonas Oreland	2008-12-19
      ndb - bug#41353 - handle any order pk
modified:
  mysql-test/suite/ndb/r/ndb_add_partition.result
  mysql-test/suite/ndb/t/ndb_add_partition.test
  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
  storage/ndb/src/kernel/blocks/trix/Trix.cpp

 3186 Jonas Oreland	2008-12-19
      arg, new file not in CMake
modified:
  storage/ndb/src/mgmapi/CMakeLists.txt

=== modified file 'mysql-test/suite/ndb/r/ndb_add_partition.result'
--- a/mysql-test/suite/ndb/r/ndb_add_partition.result	2008-10-29 14:11:08 +0000
+++ b/mysql-test/suite/ndb/r/ndb_add_partition.result	2008-12-19 09:42:22 +0000
@@ -11,7 +11,7 @@ ENGINE NDB;
 CREATE TABLE t1 (a int unsigned not null,
 b int unsigned not null,
 c int unsigned not null,
-primary key(a,b),
+primary key(a,c),
 unique (b))
 ENGINE = NDB
 partition by key(a);

=== modified file 'mysql-test/suite/ndb/t/ndb_add_partition.test'
--- a/mysql-test/suite/ndb/t/ndb_add_partition.test	2008-10-29 14:11:08 +0000
+++ b/mysql-test/suite/ndb/t/ndb_add_partition.test	2008-12-19 09:42:22 +0000
@@ -18,7 +18,7 @@ ENGINE NDB;
 CREATE TABLE t1 (a int unsigned not null,
                  b int unsigned not null,
                  c int unsigned not null,
-                 primary key(a,b),
+                 primary key(a,c),
                  unique (b))
 ENGINE = NDB
 partition by key(a);

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-12-12 14:30:54 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-12-19 09:42:22 +0000
@@ -12904,10 +12904,16 @@ Dbdict::copyData_prepare(Signal* signal,
     AttributeRecordPtr attrPtr;
     for (alist.first(attrPtr); !attrPtr.isNull(); alist.next(attrPtr))
     {
-      tmp[cnt++] = attrPtr.p->attributeId;
+      if (AttributeDescriptor::getPrimaryKey(attrPtr.p->attributeDescriptor))
+        tmp[cnt++] = attrPtr.p->attributeId;
+    }
+    for (alist.first(attrPtr); !attrPtr.isNull(); alist.next(attrPtr))
+    {
+      if (!AttributeDescriptor::getPrimaryKey(attrPtr.p->attributeDescriptor))
+        tmp[cnt++] = attrPtr.p->attributeId;
     }
   }
-
+  
   LinearSectionPtr ls_ptr[3];
   ls_ptr[0].sz = cnt;
   ls_ptr[0].p = tmp;

=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.cpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2008-12-17 19:54:19 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2008-12-19 09:42:22 +0000
@@ -1364,6 +1364,7 @@ Trix::execCOPY_DATA_IMPL_REQ(Signal* sig
     append(subRec->attributeOrder, ptr, getSectionSegmentPool());
     subRec->noOfIndexColumns = ptr.sz;
   }
+
   if (noOfSections > 1) {
     jam();
     SegmentedSectionPtr ptr;
@@ -1397,10 +1398,16 @@ Trix::execCOPY_DATA_IMPL_REQ(Signal* sig
     w.add(UtilPrepareReq::ScanTakeOverInd, 1);
     w.add(UtilPrepareReq::ReorgInd, 1);
     w.add(UtilPrepareReq::TableId, subRec->targetTableId);
-    // Add index attributes in increasing order and one PK attribute
-    for(Uint32 i = 0; i < subRec->noOfIndexColumns; i++)
-      w.add(UtilPrepareReq::AttributeId, i);
 
+    AttrOrderBuffer::DataBufferIterator iter;
+    ndbrequire(subRec->attributeOrder.first(iter));
+    
+    for(Uint32 i = 0; i < subRec->noOfIndexColumns; i++)
+    {
+      w.add(UtilPrepareReq::AttributeId, * iter.data);
+      subRec->attributeOrder.next(iter);
+    }
+    
     struct LinearSectionPtr sectionsPtr[UtilPrepareReq::NoOfSections];
     sectionsPtr[UtilPrepareReq::PROPERTIES_SECTION].p = propPage;
     sectionsPtr[UtilPrepareReq::PROPERTIES_SECTION].sz = w.getWordsUsed();

Thread
bzr push into mysql-5.1 branch (jonas:3186 to 3187) Bug#41353Jonas Oreland19 Dec