List:Commits« Previous MessageNext Message »
From:pekka Date:April 26 2007 1:01pm
Subject:bk commit into 5.1 tree (pekka:1.2490)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka 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-04-26 13:00:49+02:00, pekka@stripped +4 -0
  ndb - wl#3717 fix padding in blobs V1 + truncate

  storage/ndb/src/ndbapi/NdbBlob.cpp@stripped, 2007-04-26 12:59:54+02:00,
pekka@stripped +17 -21
    wl#3717 fix padding in blobs V1 + truncate

  storage/ndb/test/ndbapi/testBlobs.cpp@stripped, 2007-04-26 12:59:54+02:00,
pekka@stripped +100 -62
    wl#3717 fix padding in blobs V1 + truncate

  storage/ndb/test/run-test/daily-basic-tests.txt@stripped, 2007-04-26 12:59:54+02:00,
pekka@stripped +4 -0
    wl#3717 fix padding in blobs V1 + truncate

  storage/ndb/test/run-test/daily-devel-tests.txt@stripped, 2007-04-26 12:59:54+02:00,
pekka@stripped +11 -1
    wl#3717 fix padding in blobs V1 + truncate

# 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:	pekka
# Host:	clam.(none)
# Root:	/export/space/pekka/ndb/version/my51-wl3717-a

--- 1.96/storage/ndb/test/run-test/daily-basic-tests.txt	2007-04-26 07:59:30 +02:00
+++ 1.97/storage/ndb/test/run-test/daily-basic-tests.txt	2007-04-26 12:59:54 +02:00
@@ -722,6 +722,10 @@
 
 max-time: 1500
 cmd: testBlobs
+args: -version 1
+
+max-time: 1500
+cmd: testBlobs
 args:
 
 max-time: 600

--- 1.30/storage/ndb/test/run-test/daily-devel-tests.txt	2007-03-19 11:13:08 +01:00
+++ 1.31/storage/ndb/test/run-test/daily-devel-tests.txt	2007-04-26 12:59:54 +02:00
@@ -231,7 +231,17 @@
 #
 max-time: 600
 cmd: test_event_merge
-args: --no-implicit-nulls --separate-events --maxops 10000
+args: --no-implicit-nulls --separate-events --blob-version 1
+
+#
+max-time: 600
+cmd: test_event_merge
+args: --no-implicit-nulls --separate-events
+
+#
+max-time: 600
+cmd: test_event_merge
+args: --no-implicit-nulls --no-multiops --blob-version 1
 
 #
 max-time: 600

--- 1.42/storage/ndb/test/ndbapi/testBlobs.cpp	2007-04-26 09:57:31 +02:00
+++ 1.43/storage/ndb/test/ndbapi/testBlobs.cpp	2007-04-26 12:59:54 +02:00
@@ -43,7 +43,7 @@
     m_len(55),
     m_bytelen(0),
     m_totlen(0),
-    m_cs("utf8"),
+    m_cs("latin1"),
     m_csinfo(0),
     m_caseins(true)
   {}
@@ -514,8 +514,9 @@
     calcBval(g_blob2, tup.m_bval2, keepsize);
 }
 
+// dont remember what the keepsize was for..
 static void
-calcTups(bool keys, bool keepsize)
+calcTups(bool keys, bool keepsize = false)
 {
   for (uint k = 0; k < g_opt.m_rows; k++) {
     Tup& tup = g_tups[k];
@@ -531,7 +532,8 @@
           *(uchar*)&p[0] = *(uchar*)&q[0] = len;
           i++;
         }
-        while (i < len) {
+        uint j = 0;
+        while (j < len) {
           // mixed case for distribution check
           if (urandom(3) == 0) {
             uint u = urandom(26);
@@ -543,14 +545,17 @@
             q[i] = c.m_caseins ? 'A' + u : 'a' + u;
           }
           i++;
+          j++;
         }
-        while (i < c.m_bytelen) {
+        while (j < c.m_bytelen) {
           if (c.m_fixed)
             p[i] = q[i] = 0x20;
           else
             p[i] = q[i] = '#'; // garbage
           i++;
+          j++;
         }
+        assert(i == c.m_totlen);
         p[i] = q[i] = 0; // convenience
       }
       tup.m_pk3 = (Uint16)k;
@@ -981,6 +986,18 @@
         CHK(sz == m);
     }
     CHK(memcmp(data, v.m_val + n, m) == 0);
+    if (b.m_version == 1) {
+      char fillchr;
+      if (b.m_type == NdbDictionary::Column::Text)
+        fillchr = 0x20;
+      else
+        fillchr = 0x0;
+      uint i = m;
+      while (i < b.m_partsize) {
+        CHK(data[i] == fillchr);
+        i++;
+      }
+    }
     Uint32 frag2 = ra_frag->u_32_value();
     DBG("frags main=" << frag << " blob=" << frag2 << " stripe="
<< b.m_stripe);
     if (b.m_stripe == 0)
@@ -1241,7 +1258,21 @@
   Tup no_tup; // bug#24028
   no_tup.m_pk1 = 0xb1ff;
   const Chr& pk2chr = g_opt.m_pk2chr;
-  sprintf(no_tup.m_pk2, "%-*.*s", pk2chr.m_len, pk2chr.m_len,  "b1ff");
+  if (pk2chr.m_len != 0) {
+    char* const p = no_tup.m_pk2;
+    uint len = urandom(pk2chr.m_len + 1);
+    uint i = 0;
+    if (! pk2chr.m_fixed) {
+      *(uchar*)&p[0] = len;
+      i++;
+    }
+    uint j = 0;
+    while (j < len) {
+      p[i] = "b1ff"[j % 4];
+      i++;
+      j++;
+    }
+  }
   no_tup.m_pk3 = 0xb1ff;
   CHK((g_con = g_ndb->startTransaction()) != 0);
   Tup& tup =  no_tup;
@@ -1623,12 +1654,12 @@
         continue;
       DBG("--- pk ops " << stylename[style] << " ---");
       if (testcase('n')) {
-        calcTups(true, false);
+        calcTups(true);
         CHK(insertPk(style) == 0);
         CHK(verifyBlob() == 0);
         CHK(readPk(style) == 0);
         if (testcase('u')) {
-          calcTups(false, style);
+          calcTups(false);
           CHK(updatePk(style) == 0);
           CHK(verifyBlob() == 0);
           CHK(readPk(style) == 0);
@@ -1640,12 +1671,12 @@
         }
       }
       if (testcase('w')) {
-        calcTups(true, false);
+        calcTups(true);
         CHK(writePk(style) == 0);
         CHK(verifyBlob() == 0);
         CHK(readPk(style) == 0);
         if (testcase('u')) {
-          calcTups(false, style);
+          calcTups(false);
           CHK(writePk(style) == 0);
           CHK(verifyBlob() == 0);
           CHK(readPk(style) == 0);
@@ -1663,12 +1694,12 @@
         continue;
       DBG("--- idx ops " << stylename[style] << " ---");
       if (testcase('n')) {
-        calcTups(true, false);
+        calcTups(true);
         CHK(insertPk(style) == 0);
         CHK(verifyBlob() == 0);
         CHK(readIdx(style) == 0);
         if (testcase('u')) {
-          calcTups(false, style);
+          calcTups(false);
           CHK(updateIdx(style) == 0);
           CHK(verifyBlob() == 0);
           CHK(readIdx(style) == 0);
@@ -1679,12 +1710,12 @@
         }
       }
       if (testcase('w')) {
-        calcTups(false, false);
+        calcTups(false);
         CHK(writePk(style) == 0);
         CHK(verifyBlob() == 0);
         CHK(readIdx(style) == 0);
         if (testcase('u')) {
-          calcTups(false, style);
+          calcTups(false);
           CHK(writeIdx(style) == 0);
           CHK(verifyBlob() == 0);
           CHK(readIdx(style) == 0);
@@ -1700,7 +1731,7 @@
       if (! testcase('s') || ! testcase(style))
         continue;
       DBG("--- table scan " << stylename[style] << " ---");
-      calcTups(true, false);
+      calcTups(true);
       CHK(insertPk(style) == 0);
       CHK(verifyBlob() == 0);
       CHK(readScan(style, false) == 0);
@@ -1718,7 +1749,7 @@
       if (! testcase('r') || ! testcase(style))
         continue;
       DBG("--- index scan " << stylename[style] << " ---");
-      calcTups(true, false);
+      calcTups(true);
       CHK(insertPk(style) == 0);
       CHK(verifyBlob() == 0);
       CHK(readScan(style, true) == 0);
@@ -1960,65 +1991,72 @@
   t1.clr();
   t2.clr();
   // scan read char
+  const uint scan_loops = 10;
   {
     DBG("--- scan read char ---");
     Uint32 a;
     char b[20];
-    CHK((g_con = g_ndb->startTransaction()) != 0);
-    CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
-    CHK(g_ops->readTuples(NdbOperation::LM_Read) == 0);
-    CHK(g_ops->getValue(cA, (char*)&a) != 0);
-    CHK(g_ops->getValue(cB, b) != 0);
-    CHK(g_con->execute(NoCommit) == 0);
-    unsigned n = 0;
-    t1.on();
-    while (1) {
-      a = (Uint32)-1;
-      b[0] = 0;
-      int ret;
-      CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
-      if (ret == 1)
-        break;
-      CHK(a < g_opt.m_rowsperf && b[0] == 'b');
-      n++;
+    uint i;
+    for (i = 0; i < scan_loops; i++) {
+      CHK((g_con = g_ndb->startTransaction()) != 0);
+      CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
+      CHK(g_ops->readTuples(NdbOperation::LM_Read) == 0);
+      CHK(g_ops->getValue(cA, (char*)&a) != 0);
+      CHK(g_ops->getValue(cB, b) != 0);
+      CHK(g_con->execute(NoCommit) == 0);
+      unsigned n = 0;
+      t1.on();
+      while (1) {
+        a = (Uint32)-1;
+        b[0] = 0;
+        int ret;
+        CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
+        if (ret == 1)
+          break;
+        CHK(a < g_opt.m_rowsperf && b[0] == 'b');
+        n++;
+      }
+      CHK(n == g_opt.m_rowsperf);
+      t1.off(g_opt.m_rowsperf);
+      g_ndb->closeTransaction(g_con); g_ops = 0;
+      g_con = 0;
     }
-    CHK(n == g_opt.m_rowsperf);
-    t1.off(g_opt.m_rowsperf);
     DBG(t1.time());
-    g_ndb->closeTransaction(g_con); g_ops = 0;
-    g_con = 0;
   }
   // scan read text
   {
     DBG("--- read text ---");
     Uint32 a;
     char c[20];
-    CHK((g_con = g_ndb->startTransaction()) != 0);
-    CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
-    CHK(g_ops->readTuples(NdbOperation::LM_Read) == 0);
-    CHK(g_ops->getValue(cA, (char*)&a) != 0);
-    CHK((g_bh1 = g_ops->getBlobHandle(cC)) != 0);
-    CHK(g_con->execute(NoCommit) == 0);
-    unsigned n = 0;
-    t2.on();
-    while (1) {
-      a = (Uint32)-1;
-      c[0] = 0;
-      int ret;
-      CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
-      if (ret == 1)
-        break;
-      Uint32 m = 20;
-      CHK(g_bh1->readData(c, m) == 0);
-      CHK(a < g_opt.m_rowsperf && m == 1 && c[0] == 'c');
-      n++;
+    uint i;
+    for (i = 0; i < scan_loops; i++) {
+      CHK((g_con = g_ndb->startTransaction()) != 0);
+      CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
+      CHK(g_ops->readTuples(NdbOperation::LM_Read) == 0);
+      CHK(g_ops->getValue(cA, (char*)&a) != 0);
+      CHK((g_bh1 = g_ops->getBlobHandle(cC)) != 0);
+      CHK(g_con->execute(NoCommit) == 0);
+      unsigned n = 0;
+      t2.on();
+      while (1) {
+        a = (Uint32)-1;
+        c[0] = 0;
+        int ret;
+        CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
+        if (ret == 1)
+          break;
+        Uint32 m = 20;
+        CHK(g_bh1->readData(c, m) == 0);
+        CHK(a < g_opt.m_rowsperf && m == 1 && c[0] == 'c');
+        n++;
+      }
+      CHK(n == g_opt.m_rowsperf);
+      t2.off(g_opt.m_rowsperf);
+      g_bh1 = 0;
+      g_ops = 0;
+      g_ndb->closeTransaction(g_con); g_con = 0;
     }
-    CHK(n == g_opt.m_rowsperf);
-    t2.off(g_opt.m_rowsperf);
     DBG(t2.time());
-    g_bh1 = 0;
-    g_ops = 0;
-    g_ndb->closeTransaction(g_con); g_con = 0;
   }
   // scan read overhead
   DBG("scan read overhead: " << t2.over(t1));
@@ -2036,7 +2074,7 @@
   unsigned i;
   DBG("bug test 4088 - ndb api hang with mixed ops on index table");
   // insert rows
-  calcTups(true, false);
+  calcTups(true);
   CHK(insertPk(false) == 0);
   // new trans
   CHK((g_con = g_ndb->startTransaction()) != 0);
@@ -2079,7 +2117,7 @@
   DBG("bug test 27018 - middle partial part write clobbers rest of part");
 
   // insert rows
-  calcTups(true, false);
+  calcTups(true);
   CHK(insertPk(false) == 0);
   // new trans
   for (unsigned k= 0; k < g_opt.m_rows; k++)

--- 1.58/storage/ndb/src/ndbapi/NdbBlob.cpp	2007-04-26 07:59:29 +02:00
+++ 1.59/storage/ndb/src/ndbapi/NdbBlob.cpp	2007-04-26 12:59:54 +02:00
@@ -213,7 +213,6 @@
     { NdbDictionary::Column bc("NDB$PART");
       bc.setType(NdbDictionary::Column::Unsigned);
       bc.setPrimaryKey(true);
-      // wl3717_todo all PK types must be allowed as DK
       bc.setDistributionKey(false);
       bt.addColumn(bc);
     }
@@ -673,7 +672,7 @@
     for (i = 0, n = 0; i < 8; i++, n += 8)
       head.length |= ((Uint64)*p++ << n);
     assert(p - (uchar*)buf == 16);
-    assert(head.reserved == 0); //wl3717_todo catch bad data
+    assert(head.reserved == 0);
     head.headsize = (NDB_BLOB_V2_HEAD_SIZE << 2);
     DBUG_DUMP("info", buf, 16);
   }
@@ -1146,25 +1145,22 @@
       Uint32 part2 = getPartNumber(theLength - 1);
       assert(part2 >= part1);
       if (part2 > part1 && deleteParts(part1 + 1, part2 - part1) == -1)
-        DBUG_RETURN(-1);
-      if (theFixedDataFlag)
-        // wl3717_todo should change padding to be consistent
-        ;
-      else {
-        Uint32 off = getPartOffset(length);
-        if (off != 0) {
-          assert(off < thePartSize);
-          Uint16 len = 0;
-          if (readPart(thePartBuf.data, part1, len) == -1)
-            DBUG_RETURN(-1);
-          if (executePendingBlobReads() == -1)
-            DBUG_RETURN(-1);
-          assert(len != 0);
-          DBUG_PRINT("info", ("part %u length old=%u new=%u",
-                              part1, (Uint32)len, off));
-          if (updatePart(thePartBuf.data, part1, off) == -1)
-            DBUG_RETURN(-1);
-        }
+      DBUG_RETURN(-1);
+      Uint32 off = getPartOffset(length);
+      if (off != 0) {
+        assert(off < thePartSize);
+        Uint16 len = 0;
+        if (readPart(thePartBuf.data, part1, len) == -1)
+          DBUG_RETURN(-1);
+        if (executePendingBlobReads() == -1)
+          DBUG_RETURN(-1);
+        assert(len != 0);
+        DBUG_PRINT("info", ("part %u length old=%u new=%u",
+                            part1, (Uint32)len, off));
+        if (theFixedDataFlag)
+          memset(thePartBuf.data + off, theFillChar, thePartSize - off);
+        if (updatePart(thePartBuf.data, part1, off) == -1)
+          DBUG_RETURN(-1);
       }
     } else {
       if (deleteParts(0, getPartCount()) == -1)
Thread
bk commit into 5.1 tree (pekka:1.2490)pekka26 Apr