List:Internals« Previous MessageNext Message »
From:pekka Date:June 19 2005 4:23pm
Subject:bk commit into 5.1 tree (pekka:1.1913)
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

  storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
    1.30 05/06/19 18:37:07 pekka@stripped +13 -12
    varsize key fixes, passes mysql-test except ndb_restore

  storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
    1.40 05/06/19 18:37:07 pekka@stripped +3 -1
    varsize key fixes, passes mysql-test except ndb_restore

  storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
    1.79 05/06/19 18:37:07 pekka@stripped +18 -12
    varsize key fixes, passes mysql-test except ndb_restore

  storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
    1.30 05/06/19 18:37:07 pekka@stripped +1 -1
    varsize key fixes, passes mysql-test except ndb_restore

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.82 05/06/19 18:37:07 pekka@stripped +1 -1
    varsize key fixes, passes mysql-test except ndb_restore

  storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
    1.57 05/06/19 18:37:07 pekka@stripped +17 -11
    varsize key fixes, passes mysql-test except ndb_restore

  storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
    1.25 05/06/19 18:37:07 pekka@stripped +1 -1
    varsize key fixes, passes mysql-test except ndb_restore

ChangeSet
  1.1913 05/06/19 18:23:18 pekka@stripped +7 -0
  ndb - wl#1751 varsize key fixes, passes sql tests

# 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:	tuna.ndb.mysql.com
# Root:	/orca/space/pekka/ndb/version/my51-vs

--- 1.24/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2005-04-29 16:30:23 +02:00
+++ 1.25/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2005-06-19 18:37:07 +02:00
@@ -713,7 +713,7 @@
   BlockReference tabUserRef;
 
   Uint8 noOfKeyAttr;
-  Uint8 hasCharAttr;
+  Uint8 hasCharAttr; // char or var
   struct KeyAttr {
     Uint32 attributeDescriptor;
     CHARSET_INFO* charsetInfo;

--- 1.56/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2005-06-13 15:24:48 +02:00
+++ 1.57/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2005-06-19 18:37:07 +02:00
@@ -781,12 +781,17 @@
       jam();
       break;
     }
+    csNumber >>= 16;
     CHARSET_INFO* cs = 0;
     if (csNumber != 0) {
       cs = all_charsets[csNumber];
       ndbrequire(cs != 0);
       hasCharAttr = 1;
     }
+    if (AttributeDescriptor::getArrayType(attributeDescriptor) !=
+        NDB_ARRAYTYPE_FIXED) {
+      hasCharAttr = 1; // has Var attr
+    }
     tabptr.p->keyAttr[i].attributeDescriptor = attributeDescriptor;
     tabptr.p->keyAttr[i].charsetInfo = cs;
     i++;
@@ -1384,12 +1389,20 @@
 
   while (i < noOfKeyAttr) {
     const Tabrec::KeyAttr& keyAttr = tabptr.p->keyAttr[i];
+    const uchar* srcPtr = (const uchar*)&src[srcPos];
+
+    Uint32 typeId =
+      AttributeDescriptor::getType(keyAttr.attributeDescriptor);
+    Uint32 maxBytes =
+      AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor);
+    Uint32 lb, len;
+    bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, maxBytes, lb, len);
+    ndbrequire(ok);
 
-    Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor);
+    Uint32 srcBytes = lb + len;
     Uint32 srcWords = (srcBytes + 3) / 4;
     Uint32 dstWords = ~0;
     uchar* dstPtr = (uchar*)&dst[dstPos];
-    const uchar* srcPtr = (const uchar*)&src[srcPos];
     CHARSET_INFO* cs = keyAttr.charsetInfo;
 
     if (cs == 0) {
@@ -1398,15 +1411,11 @@
       dstWords = srcWords;
     } else {
       jam();
-      Uint32 typeId = AttributeDescriptor::getType(keyAttr.attributeDescriptor);
-      Uint32 lb, len;
-      bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
-      ndbrequire(ok);
       Uint32 xmul = cs->strxfrm_multiply;
       if (xmul == 0)
         xmul = 1;
       // see comment in DbtcMain.cpp
-      Uint32 dstLen = xmul * (srcBytes - lb);
+      Uint32 dstLen = xmul * (maxBytes - lb);
       ndbrequire(dstLen <= ((dstSize - dstPos) << 2));
       int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
       ndbrequire(n != -1);
@@ -1504,10 +1513,7 @@
       return;
     }//if
   }//if
-  if (fragrecptr.p->keyLength != operationRecPtr.p->tupkeylen) {
-    // historical
-    ndbrequire(fragrecptr.p->keyLength == 0);
-  }//if
+  ndbrequire(operationRecPtr.p->tupkeylen <= fragrecptr.p->keyLength);
 
   Uint32 localKey;
   if(!operationRecPtr.p->isAccLockReq)

--- 1.81/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-06-17 18:22:01 +02:00
+++ 1.82/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-06-19 18:37:07 +02:00
@@ -5027,7 +5027,7 @@
       if (attrPtr.p->tupleKey) {
         buf[sz++] = attrPtr.p->attributeDescriptor;
         // TODO send 2nd word of AttributeDescriptor instead
-        buf[sz++] = (attrPtr.p->extPrecision >> 16); // charset number
+        buf[sz++] = attrPtr.p->extPrecision; // charset number in upper half
       }
       attrPtr.i = attrPtr.p->nextAttributeIdPtrI;
     }

--- 1.29/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2005-05-24 17:30:59 +02:00
+++ 1.30/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2005-06-19 18:37:07 +02:00
@@ -959,7 +959,7 @@
     Uint8 storedTable;
 
     Uint8 noOfKeyAttr;
-    Uint8 hasCharAttr;
+    Uint8 hasCharAttr; // char or var
     Uint8 noOfDistrKeys;
     
     struct KeyAttr {

--- 1.78/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2005-06-13 15:24:50 +02:00
+++ 1.79/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2005-06-19 18:37:07 +02:00
@@ -344,12 +344,17 @@
       jam();
       break;
     }
+    csNumber >>= 16;
     CHARSET_INFO* cs = 0;
     if (csNumber != 0) {
       cs = all_charsets[csNumber];
       ndbrequire(cs != 0);
       hasCharAttr = 1;
     }
+    if (AttributeDescriptor::getArrayType(attributeDescriptor) !=
+        NDB_ARRAYTYPE_FIXED) {
+      hasCharAttr = 1; // has Var attr
+    }
     
     noOfDistrKeys += AttributeDescriptor::getDKey(attributeDescriptor);
     tabptr.p->keyAttr[i].attributeDescriptor = attributeDescriptor;
@@ -2331,17 +2336,24 @@
   Uint32 dstPos = 0;
   Uint32 srcPos = 0;
   Uint32 keyPartLen[MAX_ATTRIBUTES_IN_INDEX];
-  if(hasCharAttr){
+  if (hasCharAttr){
     Uint32 i = 0;
     while (i < noOfKeyAttr) {
       const TableRecord::KeyAttr& keyAttr = tabPtrP->keyAttr[i];
+      const uchar* srcPtr = (const uchar*)&src[srcPos];
       
-      Uint32 srcBytes = 
+      Uint32 typeId =
+        AttributeDescriptor::getType(keyAttr.attributeDescriptor);
+      Uint32 maxBytes = 
 	AttributeDescriptor::getSizeInBytes(keyAttr.attributeDescriptor);
+      Uint32 lb, len;
+      bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, maxBytes, lb, len);
+      ndbrequire(ok);
+
+      Uint32 srcBytes = lb + len;
       Uint32 srcWords = (srcBytes + 3) / 4;
       Uint32 dstWords = ~0;
       uchar* dstPtr = (uchar*)&dst[dstPos];
-      const uchar* srcPtr = (const uchar*)&src[srcPos];
       CHARSET_INFO* cs = keyAttr.charsetInfo;
       
       if (cs == NULL) {
@@ -2350,20 +2362,14 @@
 	dstWords = srcWords;
       } else {
 	jam();
-        Uint32 typeId =
-          AttributeDescriptor::getType(keyAttr.attributeDescriptor);
-        Uint32 lb, len;
-        bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
-        ndbrequire(ok);
 	Uint32 xmul = cs->strxfrm_multiply;
 	if (xmul == 0)
 	  xmul = 1;
         /*
-         * Varchar is really Char.  End spaces do not matter.  To get
-         * same hash we blank-pad to maximum length via strnxfrm.
-         * TODO use MySQL charset-aware hash function instead
+         * Varchar end spaces do not matter.  To get same hash we
+         * blank-pad to maximum length via strnxfrm.
          */
-	Uint32 dstLen = xmul * (srcBytes - lb);
+	Uint32 dstLen = xmul * (maxBytes - lb);
 	ndbrequire(dstLen <= ((dstSize - dstPos) << 2));
 	int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
         ndbrequire(n != -1);

--- 1.39/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2005-04-29 16:30:26 +02:00
+++ 1.40/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2005-06-19 18:37:07 +02:00
@@ -489,6 +489,7 @@
   {
     ljam();
     Tablerec* regTabPtr = tabptr.p;
+    Uint32 maxBytes = AttributeDescriptor::getSizeInBytes(attr_descriptor);
     Uint32 srcBytes = vsize_in_bytes;
     uchar* dstPtr = (uchar*)(out_buffer+index_buf);
     const uchar* srcPtr = (uchar*)(req_struct->m_var_data[MM].m_data_ptr+var_attr_pos);
@@ -501,7 +502,8 @@
     Uint32 xmul = cs->strxfrm_multiply;
     if (xmul == 0)
       xmul = 1;
-    Uint32 dstLen = xmul * (srcBytes - lb);
+    // see comment in DbtcMain.cpp
+    Uint32 dstLen = xmul * (maxBytes - lb);
     Uint32 maxIndexBuf = index_buf + (dstLen >> 2);
     if (maxIndexBuf <= max_read && ok) {
       ljam();

--- 1.29/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2005-04-29 16:30:27 +02:00
+++ 1.30/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2005-06-19 18:37:07 +02:00
@@ -161,8 +161,19 @@
     Uint32 dstWords = 0;
     if (! ah->isNULL()) {
       jam();
+      const uchar* srcPtr = (const uchar*)&data[offset + 2];
       const DescAttr& descAttr = descEnt.m_descAttr[attrId];
-      Uint32 srcBytes = AttributeDescriptor::getSizeInBytes(descAttr.m_attrDesc);
+      Uint32 typeId = descAttr.m_typeId;
+      Uint32 maxBytes = AttributeDescriptor::getSizeInBytes(descAttr.m_attrDesc);
+      Uint32 lb, len;
+      bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, maxBytes, lb, len);
+      if (! ok) {
+        jam();
+        scan.m_state = ScanOp::Invalid;
+        sig->errorCode = TuxBoundInfo::InvalidCharFormat;
+        return;
+      }
+      Uint32 srcBytes = lb + len;
       Uint32 srcWords = (srcBytes + 3) / 4;
       if (srcWords != dataSize) {
         jam();
@@ -171,27 +182,17 @@
         return;
       }
       uchar* dstPtr = (uchar*)&xfrmData[dstPos + 2];
-      const uchar* srcPtr = (const uchar*)&data[offset + 2];
       if (descAttr.m_charset == 0) {
         memcpy(dstPtr, srcPtr, srcWords << 2);
         dstWords = srcWords;
       } else {
         jam();
-        Uint32 typeId = descAttr.m_typeId;
-        Uint32 lb, len;
-        bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, srcBytes, lb, len);
-        if (! ok) {
-          jam();
-          scan.m_state = ScanOp::Invalid;
-          sig->errorCode = TuxBoundInfo::InvalidCharFormat;
-          return;
-        }
         CHARSET_INFO* cs = all_charsets[descAttr.m_charset];
         Uint32 xmul = cs->strxfrm_multiply;
         if (xmul == 0)
           xmul = 1;
         // see comment in DbtcMain.cpp
-        Uint32 dstLen = xmul * (srcBytes - lb);
+        Uint32 dstLen = xmul * (maxBytes - lb);
         if (dstLen > ((dstSize - dstPos) << 2)) {
           jam();
           scan.m_state = ScanOp::Invalid;
Thread
bk commit into 5.1 tree (pekka:1.1913)pekka19 Jun