List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:May 4 2011 10:52am
Subject:bzr commit into mysql-5.1-telco-7.0-wl4163 branch (pekka:4353) WL#4163
View as plain text  
#At file:///export/space/pekka/ms/ms-wl4163-70/ based on revid:pekka@stripped

 4353 Pekka Nousiainen	2011-05-04
      wl#4163 f02_desc.diff
      store key types and attr headers in metadata pages

    modified:
      storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
      storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2011-05-04 10:51:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2011-05-04 10:52:28 +0000
@@ -30,6 +30,9 @@
 // big brother
 #include <dbtup/Dbtup.hpp>
 
+// packed index keys and bounds
+#include <NdbPack.hpp>
+
 // signal classes
 #include <signaldata/DictTabInfo.hpp>
 #include <signaldata/TuxContinueB.hpp>
@@ -132,7 +135,7 @@ private:
   );
 
 public:
-  STATIC_CONST( DescPageSize = 256 );
+  STATIC_CONST( DescPageSize = 512 );
 private:
   STATIC_CONST( MaxTreeNodeSize = MAX_TTREE_NODE_SIZE );
   STATIC_CONST( MaxPrefSize = MAX_TTREE_PREF_SIZE );
@@ -143,7 +146,6 @@ private:
 
   // forward declarations
   struct TuxCtx;
-  struct DescEnt;
 
   // Pointer to array of Uint32 represents attribute data and bounds
 
@@ -281,7 +283,10 @@ private:
 
   /*
    * Descriptor page.  The "hot" metadata for an index is stored as
-   * a contiguous array of words on some page.
+   * contiguous array of words on some page.  It has 3 parts:
+   * 1) DescHead
+   * 2) array of NdbPack::Type used by NdbPack::Spec of index key
+   * 3) array of attr headers for reading index key values from TUP
    */
   struct DescPage;
   friend struct DescPage;
@@ -298,38 +303,17 @@ private:
   ArrayPool<DescPage> c_descPagePool;
   Uint32 c_descPageList;
 
-  /*
-   * Header for index metadata.  Size must be multiple of word size.
-   */
   struct DescHead {
-    unsigned m_indexId : 24;
-    unsigned pad1 : 8;
+    Uint32 m_indexId;
+    Uint16 m_numAttrs;
+    Uint16 m_magic;
+    enum { Magic = 0xDE5C };
   };
   STATIC_CONST( DescHeadSize = sizeof(DescHead) >> 2 );
 
-  /*
-   * Attribute metadata.  Size must be multiple of word size.
-   *
-   * Prefix comparison of char data must use strxfrm and binary
-   * comparison.  The charset is currently unused.
-   */
-  struct DescAttr {
-    Uint32 m_attrDesc;          // standard AttributeDescriptor
-    Uint16 m_primaryAttrId;
-    unsigned m_typeId : 6;
-    unsigned m_charset : 10;
-  };
-  STATIC_CONST( DescAttrSize = sizeof(DescAttr) >> 2 );
-
-  /*
-   * Complete metadata for one index. The array of attributes has
-   * variable size.
-   */
-  friend struct DescEnt;
-  struct DescEnt {
-    DescHead m_descHead;
-    DescAttr m_descAttr[1];     // variable size data
-  };
+  typedef NdbPack::Type KeyType;
+  typedef NdbPack::Spec KeySpec;
+  STATIC_CONST( KeyTypeSize = sizeof(KeyType) >> 2 );
 
   // range scan
  
@@ -451,6 +435,7 @@ private:
     Uint32 m_descPage;          // descriptor page
     Uint16 m_descOff;           // offset within the page
     Uint16 m_numAttrs;
+    KeySpec m_keySpec;
     union {
     bool m_storeNullKey;
     Uint32 nextPool;
@@ -698,7 +683,7 @@ private:
   friend class NdbOut& operator<<(NdbOut&, const TreeNode&);
   friend class NdbOut& operator<<(NdbOut&, const TreeHead&);
   friend class NdbOut& operator<<(NdbOut&, const TreePos&);
-  friend class NdbOut& operator<<(NdbOut&, const DescAttr&);
+  friend class NdbOut& operator<<(NdbOut&, const KeyType&);
   friend class NdbOut& operator<<(NdbOut&, const ScanOp&);
   friend class NdbOut& operator<<(NdbOut&, const Index&);
   friend class NdbOut& operator<<(NdbOut&, const Frag&);
@@ -757,7 +742,13 @@ private:
   Data c_dataBuffer;
 
   // inlined utils
-  DescEnt& getDescEnt(Uint32 descPage, Uint32 descOff);
+  Uint32 getDescSize(const Index& index);
+  DescHead& getDescHead(const Index& index);
+  KeyType* getKeyTypes(DescHead& descHead);
+  const KeyType* getKeyTypes(const DescHead& descHead);
+  AttributeHeader* getKeyAttrs(DescHead& descHead);
+  const AttributeHeader* getKeyAttrs(const DescHead& descHead);
+  //
   void getTupAddr(const Frag& frag, TreeEnt ent, Uint32& lkey1, Uint32& lkey2);
   static unsigned min(unsigned x, unsigned y);
   static unsigned max(unsigned x, unsigned y);
@@ -994,6 +985,7 @@ Dbtux::Index::Index() :
   m_descPage(RNIL),
   m_descOff(0),
   m_numAttrs(0),
+  m_keySpec(),
   m_storeNullKey(false)
 {
   for (unsigned i = 0; i < MaxIndexFragments; i++) {
@@ -1185,15 +1177,60 @@ Dbtux::PrintPar::PrintPar() :
 
 // utils
 
-inline Dbtux::DescEnt&
-Dbtux::getDescEnt(Uint32 descPage, Uint32 descOff)
+inline Uint32
+Dbtux::getDescSize(const Index& index)
+{
+  return
+    DescHeadSize +
+    index.m_numAttrs * KeyTypeSize +
+    index.m_numAttrs * AttributeHeaderSize;
+}
+
+inline Dbtux::DescHead&
+Dbtux::getDescHead(const Index& index)
 {
   DescPagePtr pagePtr;
-  pagePtr.i = descPage;
+  pagePtr.i = index.m_descPage;
   c_descPagePool.getPtr(pagePtr);
-  ndbrequire(descOff < DescPageSize);
-  DescEnt* descEnt = (DescEnt*)&pagePtr.p->m_data[descOff];
-  return *descEnt;
+  ndbrequire(index.m_descOff < DescPageSize);
+  Uint32* ptr = &pagePtr.p->m_data[index.m_descOff];
+  DescHead* descHead = reinterpret_cast<DescHead*>(ptr);
+  ndbrequire(descHead->m_magic == DescHead::Magic);
+  return *descHead;
+}
+
+inline Dbtux::KeyType*
+Dbtux::getKeyTypes(DescHead& descHead)
+{
+  Uint32* ptr = reinterpret_cast<Uint32*>(&descHead);
+  ptr += DescHeadSize;
+  return reinterpret_cast<KeyType*>(ptr);
+}
+
+inline const Dbtux::KeyType*
+Dbtux::getKeyTypes(const DescHead& descHead)
+{
+  const Uint32* ptr = reinterpret_cast<const Uint32*>(&descHead);
+  ptr += DescHeadSize;
+  return reinterpret_cast<const KeyType*>(ptr);
+}
+
+inline AttributeHeader*
+Dbtux::getKeyAttrs(DescHead& descHead)
+{
+  Uint32* ptr = reinterpret_cast<Uint32*>(&descHead);
+  ptr += DescHeadSize;
+  ptr += descHead.m_numAttrs * KeyTypeSize;
+  return reinterpret_cast<AttributeHeader*>(ptr);
+}
+
+inline const AttributeHeader*
+Dbtux::getKeyAttrs(const DescHead& descHead)
+{
+  const Uint32* ptr = reinterpret_cast<const Uint32*>(&descHead);
+  ptr += DescHeadSize;
+  ptr += descHead.m_numAttrs * KeyTypeSize;
+  return reinterpret_cast<const AttributeHeader*>(ptr);
 }
 
 inline

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp	2011-05-04 10:51:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp	2011-05-04 10:52:28 +0000
@@ -34,7 +34,9 @@ Dbtux::cmpSearchKey(TuxCtx& ctx,
 {
   const Index& index = *c_indexPool.getPtr(frag.m_indexId);
   const unsigned numAttrs = index.m_numAttrs;
-  const DescEnt& descEnt = getDescEnt(index.m_descPage, index.m_descOff);
+  const DescHead& descHead = getDescHead(index);
+  const KeyType* keyTypes = getKeyTypes(descHead);
+  const AttributeHeader* keyAttrs = getKeyAttrs(descHead);
   // skip to right position in search key only
   for (unsigned i = 0; i < start; i++) {
     thrjam(ctx.jamBuffer);
@@ -54,9 +56,10 @@ Dbtux::cmpSearchKey(TuxCtx& ctx,
       if (! ah(entryData).isNULL()) {
         thrjam(ctx.jamBuffer);
         // verify attribute id
-        const DescAttr& descAttr = descEnt.m_descAttr[start];
-        ndbrequire(ah(searchKey).getAttributeId() == descAttr.m_primaryAttrId);
-        ndbrequire(ah(entryData).getAttributeId() == descAttr.m_primaryAttrId);
+        const KeyType& keyType = keyTypes[start];
+        Uint32 primaryAttrId = keyAttrs[start].getAttributeId();
+        ndbrequire(ah(searchKey).getAttributeId() == primaryAttrId);
+        ndbrequire(ah(entryData).getAttributeId() == primaryAttrId);
         // sizes
         const unsigned bytes1 = ah(searchKey).getByteSize();
         const unsigned bytes2 = min(ah(entryData).getByteSize(), len2 << 2);
@@ -120,7 +123,9 @@ int
 Dbtux::cmpScanBound(const Frag& frag, unsigned idir, ConstData boundInfo, unsigned boundCount, ConstData entryData, unsigned maxlen)
 {
   const Index& index = *c_indexPool.getPtr(frag.m_indexId);
-  const DescEnt& descEnt = getDescEnt(index.m_descPage, index.m_descOff);
+  const DescHead& descHead = getDescHead(index);
+  const KeyType* keyTypes = getKeyTypes(descHead);
+  const AttributeHeader* keyAttrs = getKeyAttrs(descHead);
   // direction 0-lower 1-upper
   ndbrequire(idir <= 1);
   // number of words of data left
@@ -142,8 +147,9 @@ Dbtux::cmpScanBound(const Frag& frag, un
         // verify attribute id
         const Uint32 attrId = ah(boundInfo).getAttributeId();
         ndbrequire(attrId < index.m_numAttrs);
-        const DescAttr& descAttr = descEnt.m_descAttr[attrId];
-        ndbrequire(ah(entryData).getAttributeId() == descAttr.m_primaryAttrId);
+        const KeyType& keyType = keyTypes[attrId];
+        Uint32 primaryAttrId = keyAttrs[attrId].getAttributeId();
+        ndbrequire(ah(entryData).getAttributeId() == primaryAttrId);
         // sizes
         const unsigned bytes1 = ah(boundInfo).getByteSize();
         const unsigned bytes2 = min(ah(entryData).getByteSize(), len2 << 2);

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp	2011-05-04 10:51:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp	2011-05-04 10:52:28 +0000
@@ -406,17 +406,6 @@ operator<<(NdbOut& out, const Dbtux::Tre
 }
 
 NdbOut&
-operator<<(NdbOut& out, const Dbtux::DescAttr& descAttr)
-{
-  out << "[DescAttr " << hex << &descAttr;
-  out << " [attrDesc " << hex << descAttr.m_attrDesc;
-  out << " [primaryAttrId " << dec << descAttr.m_primaryAttrId << "]";
-  out << " [typeId " << dec << descAttr.m_typeId << "]";
-  out << "]";
-  return out;
-}
-
-NdbOut&
 operator<<(NdbOut& out, const Dbtux::ScanOp& scan)
 {
   Dbtux* tux = (Dbtux*)globalData.getBlock(DBTUX);

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp	2011-05-04 10:51:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp	2011-05-04 10:52:28 +0000
@@ -39,7 +39,7 @@ Dbtux::Dbtux(Block_context& ctx, Uint32
       (sizeof(TreeEnt) & 0x3) == 0 &&
       (sizeof(TreeNode) & 0x3) == 0 &&
       (sizeof(DescHead) & 0x3) == 0 &&
-      (sizeof(DescAttr) & 0x3) == 0
+      (sizeof(KeyType) & 0x3) == 0
   );
   /*
    * DbtuxGen.cpp
@@ -201,7 +201,7 @@ Dbtux::execREAD_CONFIG_REQ(Signal* signa
   ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
   ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_BATCH_SIZE, &nScanBatch));
 
-  const Uint32 nDescPage = (nIndex * DescHeadSize + nAttribute * DescAttrSize + DescPageSize - 1) / DescPageSize;
+  const Uint32 nDescPage = (nIndex * DescHeadSize + nAttribute * KeyTypeSize + nAttribute * AttributeHeaderSize + DescPageSize - 1) / DescPageSize;
   const Uint32 nScanBoundWords = nScanOp * ScanBoundSegmentSize * 4;
   const Uint32 nScanLock = nScanOp * nScanBatch;
   
@@ -250,21 +250,19 @@ void
 Dbtux::setKeyAttrs(TuxCtx& ctx, const Frag& frag)
 {
   const Index& index = *c_indexPool.getPtr(frag.m_indexId);
-  Data keyAttrs = ctx.c_keyAttrs;
-  NdbSqlUtil::Cmp** sqlCmp = ctx.c_sqlCmp; // global
-  const unsigned numAttrs = index.m_numAttrs;
-  const DescEnt& descEnt = getDescEnt(index.m_descPage, index.m_descOff);
-  for (unsigned i = 0; i < numAttrs; i++) {
+  const DescHead& descHead = getDescHead(index);
+  const KeyType* keyTypes = getKeyTypes(descHead);
+  const AttributeHeader* keyAttrs = getKeyAttrs(descHead);
+  const Uint32 numAttrs = index.m_numAttrs;
+  Uint32 i;
+  for (i = 0; i < numAttrs; i++) {
     thrjam(ctx.jamBuffer);
-    const DescAttr& descAttr = descEnt.m_descAttr[i];
-    Uint32 size = AttributeDescriptor::getSizeInWords(descAttr.m_attrDesc);
-    // set attr id and fixed size
-    ah(keyAttrs) = AttributeHeader(descAttr.m_primaryAttrId, size);
-    keyAttrs += 1;
+    ctx.c_keyAttrs[i] = keyAttrs[i].m_value;
     // set comparison method pointer
-    const NdbSqlUtil::Type& sqlType = NdbSqlUtil::getTypeBinary(descAttr.m_typeId);
+    const NdbSqlUtil::Type& sqlType =
+      NdbSqlUtil::getTypeBinary(keyTypes[i].get_type_id());
     ndbrequire(sqlType.m_cmp != 0);
-    *(sqlCmp++) = sqlType.m_cmp;
+    ctx.c_sqlCmp[i] = sqlType.m_cmp;
   }
 }
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp	2011-05-04 10:51:37 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp	2011-05-04 10:52:28 +0000
@@ -157,31 +157,45 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signa
         indexPtr.p->m_state == Index::Defining &&
         attrId < indexPtr.p->m_numAttrs &&
         attrId == req->attrId);
-    // define the attribute
-    DescEnt& descEnt = getDescEnt(indexPtr.p->m_descPage, indexPtr.p->m_descOff);
-    DescAttr& descAttr = descEnt.m_descAttr[attrId];
-    descAttr.m_attrDesc = req->attrDescriptor;
-    descAttr.m_primaryAttrId = req->primaryAttrId;
-    descAttr.m_typeId = AttributeDescriptor::getType(req->attrDescriptor);
-    descAttr.m_charset = (req->extTypeInfo >> 16);
+    const Uint32 ad = req->attrDescriptor;
+    const Uint32 typeId = AttributeDescriptor::getType(ad);
+    const Uint32 sizeInBytes = AttributeDescriptor::getSizeInBytes(ad);
+    const Uint32 nullable = AttributeDescriptor::getNullable(ad);
+    const Uint32 csNumber = req->extTypeInfo >> 16;
+    const Uint32 primaryAttrId = req->primaryAttrId;
+
+    DescHead& descHead = getDescHead(*indexPtr.p);
+    // add type to spec
+    KeySpec& keySpec = indexPtr.p->m_keySpec;
+    KeyType keyType(typeId, sizeInBytes, nullable, csNumber);
+    if (keySpec.add(keyType) == -1) {
+      jam();
+      errorCode = TuxAddAttrRef::InvalidAttributeType;
+      break;
+    }
+    // add primary attr to read keys array
+    AttributeHeader* keyAttrs = getKeyAttrs(descHead);
+    AttributeHeader& keyAttr = keyAttrs[attrId];
+    new (&keyAttr) AttributeHeader(primaryAttrId, sizeInBytes);
 #ifdef VM_TRACE
     if (debugFlags & DebugMeta) {
-      debugOut << "attr " << attrId << " " << descAttr << endl;
+      debugOut << "attr " << attrId << " " << keyType << endl;
     }
 #endif
     // check that type is valid and has a binary comparison method
-    const NdbSqlUtil::Type& type = NdbSqlUtil::getTypeBinary(descAttr.m_typeId);
+    // XXX remove when XFRM is gone
+    const NdbSqlUtil::Type& type = NdbSqlUtil::getTypeBinary(typeId);
     if (type.m_typeId == NdbSqlUtil::Type::Undefined ||
         type.m_cmp == 0) {
       jam();
       errorCode = TuxAddAttrRef::InvalidAttributeType;
       break;
     }
-    if (descAttr.m_charset != 0) {
+    if (csNumber != 0) {
       uint err;
-      CHARSET_INFO *cs = all_charsets[descAttr.m_charset];
+      CHARSET_INFO *cs = all_charsets[csNumber];
       ndbrequire(cs != 0);
-      if ((err = NdbSqlUtil::check_column_for_ordered_index(descAttr.m_typeId, cs))) {
+      if ((err = NdbSqlUtil::check_column_for_ordered_index(typeId, cs))) {
         jam();
         errorCode = (TuxAddAttrRef::ErrorCode) err;
         break;
@@ -536,7 +550,7 @@ bool
 Dbtux::allocDescEnt(IndexPtr indexPtr)
 {
   jam();
-  const unsigned size = DescHeadSize + indexPtr.p->m_numAttrs * DescAttrSize;
+  const Uint32 size = getDescSize(*indexPtr.p);
   DescPagePtr pagePtr;
   pagePtr.i = c_descPageList;
   while (pagePtr.i != RNIL) {
@@ -564,9 +578,13 @@ Dbtux::allocDescEnt(IndexPtr indexPtr)
   indexPtr.p->m_descPage = pagePtr.i;
   indexPtr.p->m_descOff = DescPageSize - pagePtr.p->m_numFree;
   pagePtr.p->m_numFree -= size;
-  DescEnt& descEnt = getDescEnt(indexPtr.p->m_descPage, indexPtr.p->m_descOff);
-  descEnt.m_descHead.m_indexId = indexPtr.i;
-  descEnt.m_descHead.pad1 = 0;
+  DescHead& descHead = *(DescHead*)&pagePtr.p->m_data[indexPtr.p->m_descOff];
+  descHead.m_indexId = indexPtr.i;
+  descHead.m_numAttrs = indexPtr.p->m_numAttrs;
+  descHead.m_magic = DescHead::Magic;
+  KeySpec& keySpec = indexPtr.p->m_keySpec;
+  KeyType* keyTypes = getKeyTypes(descHead);
+  keySpec.set_buf(keyTypes, indexPtr.p->m_numAttrs);
   return true;
 }
 
@@ -576,21 +594,22 @@ Dbtux::freeDescEnt(IndexPtr indexPtr)
   DescPagePtr pagePtr;
   c_descPagePool.getPtr(pagePtr, indexPtr.p->m_descPage);
   Uint32* const data = pagePtr.p->m_data;
-  const unsigned size = DescHeadSize + indexPtr.p->m_numAttrs * DescAttrSize;
-  unsigned off = indexPtr.p->m_descOff;
+  const Uint32 size = getDescSize(*indexPtr.p);
+  Uint32 off = indexPtr.p->m_descOff;
   // move the gap to the free area at the top
   while (off + size < DescPageSize - pagePtr.p->m_numFree) {
     jam();
     // next entry to move over the gap
-    DescEnt& descEnt2 = *(DescEnt*)&data[off + size];
-    Uint32 indexId2 = descEnt2.m_descHead.m_indexId;
+    DescHead& descHead2 = *(DescHead*)&data[off + size];
+    Uint32 indexId2 = descHead2.m_indexId;
     Index& index2 = *c_indexPool.getPtr(indexId2);
-    unsigned size2 = DescHeadSize + index2.m_numAttrs * DescAttrSize;
+    Uint32 size2 = getDescSize(index2);
     ndbrequire(
         index2.m_descPage == pagePtr.i &&
-        index2.m_descOff == off + size);
+        index2.m_descOff == off + size &&
+        index2.m_numAttrs == descHead2.m_numAttrs);
     // move the entry (overlapping copy if size < size2)
-    unsigned i;
+    Uint32 i;
     for (i = 0; i < size2; i++) {
       jam();
       data[off + i] = data[off + size + i];
@@ -598,6 +617,13 @@ Dbtux::freeDescEnt(IndexPtr indexPtr)
     off += size2;
     // adjust page offset in index
     index2.m_descOff -= size;
+    {
+      // move KeySpec pointer
+      DescHead& descHead2 = getDescHead(index2);
+      KeyType* keyType2 = getKeyTypes(descHead2);
+      index2.m_keySpec.set_buf(keyType2);
+      ndbrequire(index2.m_keySpec.validate() == 0);
+     }
   }
   ndbrequire(off + size == DescPageSize - pagePtr.p->m_numFree);
   pagePtr.p->m_numFree += size;

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-04-25 15:57:28 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp	2011-05-04 10:52:28 +0000
@@ -147,7 +147,8 @@ Dbtux::execTUX_BOUND_INFO(Signal* signal
   const TuxBoundInfo* const req = (const TuxBoundInfo*)sig;
   ScanOp& scan = *c_scanOpPool.getPtr(req->tuxScanPtrI);
   const Index& index = *c_indexPool.getPtr(scan.m_indexId);
-  const DescEnt& descEnt = getDescEnt(index.m_descPage, index.m_descOff);
+  const DescHead& descHead = getDescHead(index);
+  const KeyType* keyTypes = getKeyTypes(descHead);
   // collect normalized lower and upper bounds
   struct BoundInfo {
     int type2;     // with EQ -> LE/GE
@@ -186,9 +187,9 @@ Dbtux::execTUX_BOUND_INFO(Signal* signal
     if (! ah->isNULL()) {
       jam();
       const uchar* srcPtr = (const uchar*)&data[offset + 2];
-      const DescAttr& descAttr = descEnt.m_descAttr[attrId];
-      Uint32 typeId = descAttr.m_typeId;
-      Uint32 maxBytes = AttributeDescriptor::getSizeInBytes(descAttr.m_attrDesc);
+      const KeyType& keyType = keyTypes[attrId];
+      Uint32 typeId = keyType.get_type_id();
+      Uint32 maxBytes = keyType.get_byte_size();
       Uint32 lb, len;
       bool ok = NdbSqlUtil::get_var_length(typeId, srcPtr, maxBytes, lb, len);
       if (! ok) {
@@ -206,13 +207,13 @@ Dbtux::execTUX_BOUND_INFO(Signal* signal
         return;
       }
       uchar* dstPtr = (uchar*)&xfrmData[dstPos + 2];
-      if (descAttr.m_charset == 0) {
+      if (keyType.get_cs_number() == 0) {
         memcpy(dstPtr, srcPtr, srcWords << 2);
         dstBytes = srcBytes;
         dstWords = srcWords;
       } else {
         jam();
-        CHARSET_INFO* cs = all_charsets[descAttr.m_charset];
+        CHARSET_INFO* cs = all_charsets[keyType.get_cs_number()];
         Uint32 xmul = cs->strxfrm_multiply;
         if (xmul == 0)
           xmul = 1;


Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20110504105228-8gl0rvydr3uf6249.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-wl4163 branch (pekka:4353) WL#4163Pekka Nousiainen4 May