List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:April 15 2005 12:41pm
Subject:bk commit into 5.1-ndb tree (joreland:1.1853)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1-ndb repository of jonas. When jonas 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
  1.1853 05/04/15 12:41:40 joreland@stripped +6 -0
  wl1751 - ndb varsize
    mysqld - ndb - varsize integration

  ndb/test/src/HugoOperations.cpp
    1.23 05/04/15 12:41:35 joreland@stripped +2 -1
    Use correct updates value

  ndb/test/src/HugoCalculator.cpp
    1.20 05/04/15 12:41:35 joreland@stripped +19 -8
    Adopt to "putting lenght in beginning scheme"

  ndb/test/ndbapi/testOIBasic.cpp
    1.38 05/04/15 12:41:35 joreland@stripped +6 -4
    Remove hash indexes on varsize columns

  ndb/src/ndbapi/NdbOperationDefine.cpp
    1.23 05/04/15 12:41:35 joreland@stripped +37 -25
    Read varsize length from len bytes in beginning of ptr
      ignore value passed in setValue

  ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
    1.62 05/04/15 12:41:35 joreland@stripped +1 -2
    Move assertion to correct branch

  ndb/src/common/util/NdbSqlUtil.cpp
    1.30 05/04/15 12:41:35 joreland@stripped +2 -2
    Don't allow Varchar in primary key

# 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:	joreland
# Host:	eel.ndb.mysql.com.ndb.mysql.com.ndb.mysql.com.ndb.mysql.com
# Root:	/home/jonas/src/mysql-5.1-ndb-dd

--- 1.29/ndb/src/common/util/NdbSqlUtil.cpp	Sat Feb 26 16:40:39 2005
+++ 1.30/ndb/src/common/util/NdbSqlUtil.cpp	Fri Apr 15 12:41:35 2005
@@ -878,8 +878,6 @@
   const Type& type = getType(typeId);
   switch (type.m_typeId) {
   case Type::Char:
-  case Type::Varchar:
-  case Type::Longvarchar:
     {
       const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
       return
@@ -890,6 +888,8 @@
         cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY;
     }
     break;
+  case Type::Varchar:
+  case Type::Longvarchar:
   case Type::Undefined:
   case Type::Blob:
   case Type::Text:

--- 1.61/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	Wed Apr  6 08:18:14 2005
+++ 1.62/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	Fri Apr 15 12:41:35 2005
@@ -2824,12 +2824,11 @@
     }
     else
     {
-      assert(fix_sz < alloc);
-
       Local_key key;
 
       if(! (bits & Tuple_header::CHAINED_ROW))
       {
+	assert(fix_sz < alloc);
 	org->m_header_bits |= Tuple_header::CHAINED_ROW;
 	Uint32 id, *dst= alloc_var_rec(regFragPtr, regTabPtr, 
 				       needed - fix_sz, &key, &id, 

--- 1.22/ndb/src/ndbapi/NdbOperationDefine.cpp	Fri Apr 15 09:14:17 2005
+++ 1.23/ndb/src/ndbapi/NdbOperationDefine.cpp	Fri Apr 15 12:41:35 2005
@@ -515,26 +515,45 @@
   }//if
   
   // Insert Attribute Id into ATTRINFO part. 
-  const Uint32 max = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
-  const Uint32 sizeInBytes = len ? len : max;
+  const Uint32 tArrayType= tAttrInfo->m_arrayType;
+  const Uint32 tAttrSize = tAttrInfo->m_attrSize;
+  const Uint32 tArraySize = tAttrInfo->m_arraySize;
+
+  const Uint32 max = tAttrSize * tArraySize;
+  switch(tArrayType){
+  case NDB_ARRAYTYPE_SHORT_VAR:
+    len = * ((Uint8*)aValue) + 1;
+    break;
+  case NDB_ARRAYTYPE_MEDIUM_VAR:
+    len = uint2korr(aValue) + 2;
+    break;
+  default:
+    len = max;
+    break;
+  }
+
+  const Uint32 sizeInBytes = len;
+  const Uint32 bitsInLastWord = 8 * (sizeInBytes & 3) ;
   
-#if 0
-  tAttrSize = tAttrInfo->theAttrSize;
-  tArraySize = tAttrInfo->theArraySize;
-  if (tArraySize == 0) {
-    setErrorCodeAbort(4201);      
-    return -1;
+  const int attributeSize = sizeInBytes;
+  const int slack = sizeInBytes & 3;
+  
+  if (((UintPtr)aValue & 3) != 0 || (slack != 0)){
+    memcpy(&tempData[0], aValue, attributeSize);
+    aValue = (char*)&tempData[0];
+    if(slack != 0) {
+      char * tmp = (char*)&tempData[0];
+      memset(&tmp[attributeSize], 0, (4 - slack));
+    }//if
   }//if
-  tAttrSizeInBits = tAttrSize*tArraySize;
-  tAttrSizeInWords = tAttrSizeInBits >> 5;
-#endif
-  const Uint32 bitsInLastWord = 8 * (sizeInBytes & 3) ;
-  if ((tAttrInfo->m_arrayType == NDB_ARRAYTYPE_FIXED && sizeInBytes != max) ||
-      (tAttrInfo->m_arrayType != NDB_ARRAYTYPE_FIXED && sizeInBytes > max))
+  
+  if ((tArrayType == NDB_ARRAYTYPE_FIXED && sizeInBytes != max) ||
+      (tArrayType && sizeInBytes > max))
   {
     setErrorCodeAbort(4209);
     DBUG_RETURN(-1);
   }//if
+
   // Including bits in last word
   const Uint32 totalSizeInWords = (sizeInBytes + 3)/4; 
   // Excluding bits in last word
@@ -548,17 +567,6 @@
    * If it is not aligned then we start by copying the value to tempData and 
    * use this as aValue instead.
    *************************************************************************/
-  const int attributeSize = sizeInBytes;
-  const int slack = sizeInBytes & 3;
-  
-  if (((UintPtr)aValue & 3) != 0 || (slack != 0)){
-    memcpy(&tempData[0], aValue, attributeSize);
-    aValue = (char*)&tempData[0];
-    if(slack != 0) {
-      char * tmp = (char*)&tempData[0];
-      memset(&tmp[attributeSize], 0, (4 - slack));
-    }//if
-  }//if
   
   tReturnCode = insertATTRINFOloop((Uint32*)aValue, sizeInWords);
   if (tReturnCode == -1) {
@@ -576,6 +584,10 @@
   }//if
   theErrorLine++;  
   DBUG_RETURN(0);
+
+error:
+  setErrorCodeAbort(tReturnCode);
+  DBUG_RETURN(-1);  
 }//NdbOperation::setValue()
 
 NdbBlob*

--- 1.37/ndb/test/ndbapi/testOIBasic.cpp	Wed Apr 13 07:42:59 2005
+++ 1.38/ndb/test/ndbapi/testOIBasic.cpp	Fri Apr 15 12:41:35 2005
@@ -1057,10 +1057,11 @@
     }
     if (useindex(par, 5)) {
       // a, b, d
-      ITab* x = new ITab(*t, "ti1z5", ITab::UniqueHashIndex, 3);
+      ITab* x = new ITab(*t, "ti1z5", ITab::UniqueHashIndex, 2);
       x->icoladd(0, new ICol(*x, 0, *t->m_col[0]));
       x->icoladd(1, new ICol(*x, 1, *t->m_col[1]));
-      x->icoladd(2, new ICol(*x, 2, *t->m_col[3]));
+      /** Hash index is currently not supported on var size columns */
+      //x->icoladd(2, new ICol(*x, 2, *t->m_col[3]));
       t->itabadd(5, x);
     }
     tablist[1] = t;
@@ -1072,7 +1073,7 @@
     t->coladd(0, new Col(*t, 0, "a", 1, Col::Char, 31, 0, getcs(par)));
     t->coladd(1, new Col(*t, 1, "b", 0, Col::Char, 4, 1, getcs(par)));
     t->coladd(2, new Col(*t, 2, "c", 1, Col::Unsigned, 1, 0, 0));
-    t->coladd(3, new Col(*t, 3, "d", 1, Col::Varchar, 128, 0, getcs(par)));
+    t->coladd(3, new Col(*t, 3, "d", 0, Col::Varchar, 128, 0, getcs(par)));
     t->coladd(4, new Col(*t, 4, "e", 0, Col::Varchar, 7, 0, getcs(par)));
     if (useindex(par, 0)) {
       // a, c, d
@@ -1111,7 +1112,8 @@
       x->icoladd(1, new ICol(*x, 1, *t->m_col[2]));
       t->itabadd(4, x);
     }
-    if (useindex(par, 5)) {
+    if (false && useindex(par, 5)) {
+      /** Hash index is currently not supported on var size */
       // a, c, d, e
       ITab* x = new ITab(*t, "ti2z5", ITab::UniqueHashIndex, 4);
       x->icoladd(0, new ICol(*x, 0, *t->m_col[0]));

--- 1.19/ndb/test/src/HugoCalculator.cpp	Fri Apr  8 11:05:57 2005
+++ 1.20/ndb/test/src/HugoCalculator.cpp	Fri Apr 15 12:41:35 2005
@@ -138,6 +138,7 @@
   }
 
   int pos= 0;
+  char* dst= buf;
   switch(attr->getType()){
   case NdbDictionary::Column::Tinyint:
   case NdbDictionary::Column::Tinyunsigned:
@@ -179,32 +180,42 @@
     break;
   case NdbDictionary::Column::Varbinary:
   case NdbDictionary::Column::Varchar:
-  case NdbDictionary::Column::Text:
+    len = 1 + (myRand(&seed) % (len - 1));
+    assert(len < 256);
+    * outlen = len + 1;
+    * buf = len;
+    dst++;
+    goto write_char;
   case NdbDictionary::Column::Longvarchar:
   case NdbDictionary::Column::Longvarbinary:
-    len = 1 + (myRand(&seed) % len);
-    * outlen = len;
+    len = 1 + (myRand(&seed) % (len - 2));
+    assert(len < 65536);
+    * outlen = len + 2;
+    int2store(buf, len);
+    dst += 2;
+write_char:
   case NdbDictionary::Column::Char:
   {
     char* ptr= (char*)&val;
     while(len >= 4)
     {
       len -= 4;
-      buf[pos++] = base64_table[ptr[0] & 0x3f];
-      buf[pos++] = base64_table[ptr[1] & 0x3f];
-      buf[pos++] = base64_table[ptr[2] & 0x3f];
-      buf[pos++] = base64_table[ptr[3] & 0x3f];
+      dst[pos++] = base64_table[ptr[0] & 0x3f];
+      dst[pos++] = base64_table[ptr[1] & 0x3f];
+      dst[pos++] = base64_table[ptr[2] & 0x3f];
+      dst[pos++] = base64_table[ptr[3] & 0x3f];
       val= myRand(&seed);
     }
     
     for(; len; len--, pos++)
-      buf[pos] = base64_table[ptr[len] & 0x3f];
+      dst[pos] = base64_table[ptr[len] & 0x3f];
 
     pos--;
     break;
   }
   case NdbDictionary::Column::Blob:
   case NdbDictionary::Column::Undefined:
+  case NdbDictionary::Column::Text:
     abort();
     break;
   }

--- 1.22/ndb/test/src/HugoOperations.cpp	Mon Apr 11 14:37:59 2005
+++ 1.23/ndb/test/src/HugoOperations.cpp	Fri Apr 15 12:41:35 2005
@@ -408,7 +408,8 @@
   char buf[8000];
   memset(buf, 0, sizeof(buf));
   Uint32 real_len;
-  const char * value = calc.calcValue(rowId, attrId, 0, buf, len, &real_len);
+  const char * value = calc.calcValue(rowId, attrId, 
+				      updateId, buf, len, &real_len);
   return pOp->setValue( attr->getName(), value, real_len);
 }
 
Thread
bk commit into 5.1-ndb tree (joreland:1.1853)jonas.oreland15 Apr