List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:August 21 2008 10:05pm
Subject:bzr commit into mysql-5.1 branch (jonas:2656)
View as plain text  
#At file:///home/jonas/src/telco-6.2/

 2656 Jonas Oreland	2008-08-22
      ndb - fix testIndex -n SR1
        1) use Uint8 instead of char for correct sign handling in restore.cpp (6.2 only)
        2) always include PK in "random" unique index generation
modified:
  storage/ndb/src/kernel/blocks/restore.cpp
  storage/ndb/test/ndbapi/testIndex.cpp

=== modified file 'storage/ndb/src/kernel/blocks/restore.cpp'
--- a/storage/ndb/src/kernel/blocks/restore.cpp	2007-07-11 12:47:05 +0000
+++ b/storage/ndb/src/kernel/blocks/restore.cpp	2008-08-21 22:05:42 +0000
@@ -1121,12 +1121,12 @@ Restore::reorder_key(const KeyDescriptor
       src += sz;
       break;
     case NDB_ARRAYTYPE_SHORT_VAR:
-      sz = (1 + ((char*)var)[0] + 3) >> 2;
+      sz = (1 + ((Uint8*)var)[0] + 3) >> 2;
       memcpy(dst, var, 4 * sz);
       var += sz;
       break;
     case NDB_ARRAYTYPE_MEDIUM_VAR:
-      sz = (2 + ((char*)var)[0] +  256*((char*)var)[1] + 3) >> 2;
+      sz = (2 + ((Uint8*)var)[0] +  256*((Uint8*)var)[1] + 3) >> 2;
       memcpy(dst, var, 4 * sz);
       var += sz;
       break;

=== modified file 'storage/ndb/test/ndbapi/testIndex.cpp'
--- a/storage/ndb/test/ndbapi/testIndex.cpp	2008-03-25 14:17:03 +0000
+++ b/storage/ndb/test/ndbapi/testIndex.cpp	2008-08-21 22:05:42 +0000
@@ -169,6 +169,29 @@ int create_index(NDBT_Context* ctx, int 
     ndbout << pTab->getColumn(attrNo)->getName()<<" ";
   }
   
+  if (!orderedIndex)
+  {
+    /**
+     * For unique indexes we must add PK, otherwise it's not guaranteed
+     *  to be unique
+     */
+    for (int i = 0; i<pTab->getNoOfColumns(); i++)
+    {
+      if (pTab->getColumn(i)->getPrimaryKey())
+      {
+        for (int j = 0; j<attr->numAttribs; j++)
+        {
+          if (attr->attribs[j] == i)
+            goto next;
+        }
+        pIdx.addIndexColumn(pTab->getColumn(i)->getName());
+        ndbout << pTab->getColumn(i)->getName() << " ";
+      }
+  next:
+      (void)i;
+    }
+  }
+
   pIdx.setStoredIndex(logged);
   ndbout << ") ";
   if (pNdb->getDictionary()->createIndex(pIdx) != 0){

Thread
bzr commit into mysql-5.1 branch (jonas:2656) Jonas Oreland22 Aug