List:Internals« Previous MessageNext Message »
From:pekka Date:November 15 2005 4:24pm
Subject:bk commit into 4.1 tree (pekka:1.2472) BUG#14007
View as plain text  
Below is the list of changes that have just been committed into a local
4.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
  1.2472 05/11/15 16:24:37 pekka@stripped +4 -0
  ndb - bug#14007 4.1 *** do not AUTOmerge to 5.0 ***

  ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
    1.8 05/11/15 16:23:14 pekka@stripped +22 -1
    bug#14007 4.1 *** do not AUTOmerge to 5.0 ***

  ndb/include/kernel/AttributeDescriptor.hpp
    1.2 05/11/15 16:21:57 pekka@stripped +9 -0
    bug#14007 4.1 need getSizeInBytes

  mysql-test/t/ndb_charset.test
    1.6 05/11/15 16:21:19 pekka@stripped +11 -8
    bug#14007 test

  mysql-test/r/ndb_charset.result
    1.4 05/11/15 16:21:19 pekka@stripped +16 -6
    bug#14007 test

# 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.ndb.mysql.com
# Root:	/export/space/pekka/ndb/version/my41

--- 1.1/ndb/include/kernel/AttributeDescriptor.hpp	2004-04-14 10:23:52 +02:00
+++ 1.2/ndb/include/kernel/AttributeDescriptor.hpp	2005-11-15 16:21:57 +01:00
@@ -36,6 +36,7 @@
   
   static Uint32 getType(const Uint32 &);
   static Uint32 getSize(const Uint32 &);
+  static Uint32 getSizeInBytes(const Uint32 &);
   static Uint32 getSizeInWords(const Uint32 &);
   static Uint32 getArrayType(const Uint32 &);
   static Uint32 getArraySize(const Uint32 &);
@@ -79,6 +80,7 @@
 #define AD_SIZE_SHIFT       (4)
 #define AD_SIZE_MASK        (7)
 
+#define AD_SIZE_IN_BYTES_SHIFT (3)
 #define AD_SIZE_IN_WORDS_OFFSET (31)
 #define AD_SIZE_IN_WORDS_SHIFT  (5)
 
@@ -183,6 +185,13 @@
 Uint32
 AttributeDescriptor::getSize(const Uint32 & desc){
   return (desc >> AD_SIZE_SHIFT) & AD_SIZE_MASK;
+}
+
+inline
+Uint32
+AttributeDescriptor::getSizeInBytes(const Uint32 & desc){
+  return (getArraySize(desc) << getSize(desc)) 
+                             >> AD_SIZE_IN_BYTES_SHIFT;
 }
 
 inline

--- 1.7/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2004-12-01 10:04:46 +01:00
+++ 1.8/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2005-11-15 16:23:14 +01:00
@@ -700,6 +700,27 @@
   Uint32 attrDescriptorIndex = regTabPtr->tabDescriptor + (attributeId <<
ZAD_LOG_SIZE);
   Uint32 attrDescriptor = tableDescriptor[attrDescriptorIndex].tabDescr;
   Uint32 attributeOffset = tableDescriptor[attrDescriptorIndex + 1].tabDescr;
+
+  Uint32 xfrmBuffer[1 + MAX_KEY_SIZE_IN_WORDS * 1]; // strxfrm_multiply == 1
+  Uint32 charsetFlag = AttributeOffset::getCharsetFlag(attributeOffset);
+  if (charsetFlag) {
+    Uint32 csPos = AttributeOffset::getCharsetPos(attributeOffset);
+    CHARSET_INFO* cs = regTabPtr->charsetArray[csPos];
+    Uint32 sizeInBytes = AttributeDescriptor::getSizeInBytes(attrDescriptor);
+    Uint32 sizeInWords = AttributeDescriptor::getSizeInWords(attrDescriptor);
+    const uchar* srcPtr = (uchar*)&updateBuffer[1];
+    uchar* dstPtr = (uchar*)&xfrmBuffer[1];
+    Uint32 n =
+      (*cs->coll->strnxfrm)(cs, dstPtr, sizeInBytes, srcPtr, sizeInBytes);
+    // pad with blanks (unlikely) and zeroes to match NDB API behaviour
+    while (n < sizeInBytes)
+      dstPtr[n++] = 0x20;
+    while (n < 4 * sizeInWords)
+      dstPtr[n++] = 0;
+    xfrmBuffer[0] = ahIn.m_value;
+    updateBuffer = xfrmBuffer;
+  }
+
   ReadFunction f = regTabPtr->readFunctionArray[attributeId];
 
   AttributeHeader::init(&attributeHeader, attributeId, 0);
@@ -707,7 +728,7 @@
   tMaxRead = MAX_KEY_SIZE_IN_WORDS;
 
   bool tmp = tXfrmFlag;
-  tXfrmFlag = false;
+  tXfrmFlag = true;
   ndbrequire((this->*f)(&keyReadBuffer[0], ahOut, attrDescriptor,
attributeOffset));
   tXfrmFlag = tmp;
   ndbrequire(tOutBufIndex == ahOut->getDataSize());

--- 1.3/mysql-test/r/ndb_charset.result	2004-12-01 10:13:15 +01:00
+++ 1.4/mysql-test/r/ndb_charset.result	2005-11-15 16:21:19 +01:00
@@ -190,12 +190,22 @@
 6	AAA
 drop table t1;
 create table t1 (
-a varchar(10) primary key
-) engine=ndb;
-insert into t1 values ('jonas % ');
-replace into t1 values ('jonas % ');
-replace into t1 values ('jonas % ');
+a char(10) primary key
+) engine=ndbcluster default charset=latin1;
+insert into t1 values ('aaabb');
 select * from t1;
 a
-jonas %
+aaabb
+replace into t1 set a = 'AAABB';
+select * from t1;
+a
+AAABB
+replace into t1 set a = 'aAaBb';
+select * from t1;
+a
+aAaBb
+replace into t1 set a = 'aaabb';
+select * from t1;
+a
+aaabb
 drop table t1;

--- 1.5/mysql-test/t/ndb_charset.test	2005-07-28 02:21:44 +02:00
+++ 1.6/mysql-test/t/ndb_charset.test	2005-11-15 16:21:19 +01:00
@@ -159,14 +159,17 @@
 select * from t1 where a = 'AAA' order by p;
 drop table t1;
 
-# bug 
+# bug#14007
 create table t1 (
-  a varchar(10) primary key
-) engine=ndb;
-insert into t1 values ('jonas % ');
-replace into t1 values ('jonas % ');
-replace into t1 values ('jonas % ');
+  a char(10) primary key
+) engine=ndbcluster default charset=latin1;
+
+insert into t1 values ('aaabb');
+select * from t1;
+replace into t1 set a = 'AAABB';
+select * from t1;
+replace into t1 set a = 'aAaBb';
+select * from t1;
+replace into t1 set a = 'aaabb';
 select * from t1;
 drop table t1;
-
-# End of 4.1 tests
Thread
bk commit into 4.1 tree (pekka:1.2472) BUG#14007pekka15 Nov