List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:July 6 2005 12:53pm
Subject:bk commit into 5.1 tree (joreland:1.1928)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 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.1928 05/07/06 14:53:01 joreland@stripped +5 -0
  ndb diskdata
    remove attribute reshuffeling...pekka is writing to much crazy code

  storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp
    1.7 05/07/06 14:52:56 joreland@stripped +2 -1
    create new array in tabledescritor containing real attribute order

  storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
    1.34 05/07/06 14:52:56 joreland@stripped +40 -11
    create new array in tabledescritor containing real attribute order

  storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
    1.66 05/07/06 14:52:56 joreland@stripped +17 -13
    remove attribute reshuffeling...

  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
    1.68 05/07/06 14:52:56 joreland@stripped +1 -0
    Order array for expand

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.84 05/07/06 14:52:55 joreland@stripped +5 -2
    remove attribute reshuffeling...

# 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.(none)
# Root:	/home/jonas/src/mysql-5.1-ndb-dd

--- 1.83/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-07-04 08:06:14 +02:00
+++ 1.84/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-07-06 14:52:55 +02:00
@@ -5528,7 +5528,8 @@
       Rope name(c_rope_pool, attrPtr.p->attributeName);
       name.assign(attrDesc.AttributeName, len, name_hash);
     }
-    attrPtr.p->attributeId = attrDesc.AttributeId;
+    attrPtr.p->attributeId = i;
+    //attrPtr.p->attributeId = attrDesc.AttributeId;
     attrPtr.p->tupleKey = (keyCount + 1) * attrDesc.AttributeKeyFlag;
     
     attrPtr.p->extPrecision = attrDesc.AttributeExtPrecision;
@@ -5702,7 +5703,8 @@
      *   dd-fixsize
      *   dd-varsize
      */
-    printf("reshuffle attributes: ");
+    printf("don't reshuffle attributes: ");
+#if 0
     for(Uint32 i= 1; i<5; i++)
     {
       counts[i]+= counts[i-1];
@@ -5728,6 +5730,7 @@
                    CreateTableRef::Inconsistency);
     }
     ndbout_c("");
+#endif
   }
   {
     // link in internal attributeId order  XXX quadratic

--- 1.67/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2005-07-05 14:51:18 +02:00
+++ 1.68/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2005-07-06 14:52:56 +02:00
@@ -767,6 +767,7 @@
     
     Uint32 readKeyArray;
     Uint32 tabDescriptor;
+    Uint32 m_real_order_descriptor;
     
     bool checksumIndicator;
     Uint16 total_rec_size; // Max total size for entire tuple in words

--- 1.65/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2005-04-29 16:30:26 +02:00
+++ 1.66/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2005-07-06 14:52:56 +02:00
@@ -1228,9 +1228,11 @@
   
   Uint32 num_attr= regTabPtr->m_no_of_attributes;
   Uint32 descr_start= regTabPtr->tabDescriptor;
+  Uint32 order_desc= regTabPtr->m_real_order_descriptor;
   TableDescriptor *tab_descr= &tableDescriptor[descr_start];
   ndbrequire(descr_start + (num_attr << ZAD_LOG_SIZE) <= cnoOfTabDescrRec);
   req_struct->attr_descr= tab_descr; 
+  Uint16* order= (Uint16*)&tableDescriptor[order_desc];
 
   const Uint32 cnt1= regTabPtr->m_attributes[MM].m_no_of_varsize;
   const Uint32 cnt2= regTabPtr->m_attributes[DD].m_no_of_varsize;
@@ -1245,13 +1247,12 @@
     dst->m_max_var_offset= regTabPtr->m_offsets[MM].m_max_var_offset;
     // Disk part is 32-bit aligned
     ptr= ALIGN_WORD(dst->m_data_ptr+regTabPtr->m_offsets[MM].m_max_var_offset);
-    tab_descr += (regTabPtr->m_attributes[MM].m_no_of_fixsize << 1);
+    order += regTabPtr->m_attributes[MM].m_no_of_fixsize;
     Uint32 pos= 0;
     for(Uint32 i= 0; i<cnt1; i++)
     {
       dst->m_offset_array_ptr[i]= pos;
-      pos += AttributeDescriptor::getSizeInBytes(* (Uint32*)tab_descr); 
-      tab_descr += 2;
+      pos += AttributeDescriptor::getSizeInBytes(tab_descr[*order++].tabDescr);
     }
   } 
   else
@@ -2414,7 +2415,9 @@
  */
 Uint32*
 expand_var_part(Dbtup::KeyReqStruct::Var_data *dst, 
-		const Uint32* src, const Uint32* tabDesc)
+		const Uint32* src, 
+		const Uint32 * const tabDesc, 
+		const Uint16* order)
 {
   char* dst_ptr= dst->m_data_ptr;
   Uint32 no_attr= dst->m_var_len_offset;
@@ -2434,10 +2437,9 @@
     memcpy(dst_ptr, src_ptr, len);
     src_ptr += len;
     
-    max_len= AttributeDescriptor::getSizeInBytes(* tabDesc);
+    max_len= AttributeDescriptor::getSizeInBytes(tabDesc[* order++]);
     dst_ptr += max_len; // Max size
     dst_off += max_len;
-    tabDesc += 2;
     
     tmp= next_pos;
   }
@@ -2455,12 +2457,14 @@
   Uint16 dd_tot= tabPtrP->m_no_of_disk_attributes;
   Uint16 mm_vars= tabPtrP->m_attributes[MM].m_no_of_varsize;
   Uint32 fix_size= tabPtrP->m_offsets[MM].m_varpart_offset;
-  
+  Uint32 order_desc= tabPtrP->m_real_order_descriptor;
+
   Uint32 *dst_ptr= ptr->get_var_part_ptr(tabPtrP);
   const Uint32 *disk_ref= src->get_disk_ref_ptr(tabPtrP);
   const Uint32 *src_ptr= src->get_var_part_ptr(tabPtrP);
-  const Uint32 *desc= (Uint32*)req_struct->attr_descr;
-  desc += (tabPtrP->m_attributes[MM].m_no_of_fixsize << 1);
+  const Uint32 * const desc= (Uint32*)req_struct->attr_descr;
+  const Uint16 *order = (Uint16*)(&tableDescriptor[order_desc]);
+  order += tabPtrP->m_attributes[MM].m_no_of_fixsize;
   
   if(mm_vars)
   {
@@ -2487,7 +2491,7 @@
     dst->m_var_len_offset= mm_vars;
     dst->m_max_var_offset= tabPtrP->m_offsets[MM].m_max_var_offset;
     
-    dst_ptr= expand_var_part(dst, src_data, desc);
+    dst_ptr= expand_var_part(dst, src_data, desc, order);
     ndbassert(dst_ptr == ALIGN_WORD(dst->m_data_ptr + dst->m_max_var_offset));
     ndbassert((UintPtr(src_ptr) & 3) == 0);
     src_ptr = ALIGN_WORD(((char*)src_ptr)+step);
@@ -2511,7 +2515,7 @@
   if(dd_tot)
   {
     const Uint16 dd_vars= tabPtrP->m_attributes[DD].m_no_of_varsize;
-    desc += (mm_vars << 1);
+    order += mm_vars;
     
     if(bits & Tuple_header::DISK_INLINE)
     {
@@ -2536,14 +2540,14 @@
       KeyReqStruct::Var_data* dst= &req_struct->m_var_data[DD];
       dst_ptr += tabPtrP->m_offsets[DD].m_varpart_offset;
       src_ptr += tabPtrP->m_offsets[DD].m_varpart_offset;
-      desc += (tabPtrP->m_attributes[DD].m_no_of_fixsize << 1);
+      order += tabPtrP->m_attributes[DD].m_no_of_fixsize;
       
       dst->m_data_ptr= (char*)(char*)(((Uint16*)dst_ptr)+dd_vars+1);
       dst->m_offset_array_ptr= req_struct->var_pos_array + (mm_vars << 1);
       dst->m_var_len_offset= dd_vars;
       dst->m_max_var_offset= tabPtrP->m_offsets[DD].m_max_var_offset;
 
-      expand_var_part(dst, src_ptr, desc);
+      expand_var_part(dst, src_ptr, desc, order);
     }
   }
 }

--- 1.33/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2005-05-05 13:57:25 +02:00
+++ 1.34/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2005-07-06 14:52:56 +02:00
@@ -472,21 +472,11 @@
   pos[DD]+= regTabPtr.p->m_offsets[DD].m_null_words;
 
   Uint32 *tabDesc = (Uint32*)(tableDescriptor+regTabPtr.p->tabDescriptor);
-  Uint32 check= 0;
   for(Uint32 i= 0; i<regTabPtr.p->m_no_of_attributes; i++)
   {
     Uint32 ind= AttributeDescriptor::getDiskBased(* tabDesc);
     Uint32 arr= AttributeDescriptor::getArrayType(* tabDesc++);
 
-    Uint32 tmp= 2*(ind ? 1 : 0) + (arr == NDB_ARRAYTYPE_FIXED ? 0 : 1);
-    if(tmp < check)
-    {
-      // TUP requires attributes to sorted
-      // XXX Fix error code
-      ndbrequire(false);
-    }
-    check= tmp;
-    
     if(arr == NDB_ARRAYTYPE_FIXED)
     {
       Uint32 desc= * tabDesc;
@@ -496,7 +486,6 @@
     }
     tabDesc++;
   }
-  
 
   regTabPtr.p->m_offsets[MM].m_fix_header_size= 
     fragOperPtr.p->m_fix_attributes_size[MM] + 
@@ -588,6 +577,7 @@
   regTabPtr->charsetArray= (CHARSET_INFO**)(desc + offset[2]);
   regTabPtr->readKeyArray= descriptorReference + offset[3];
   regTabPtr->tabDescriptor= descriptorReference + offset[4];
+  regTabPtr->m_real_order_descriptor = descriptorReference + offset[5];
 }
 
 Uint32
@@ -616,6 +606,45 @@
     }
   }
   ndbrequire(countKeyAttr == regTabPtr->noOfKeyAttr);
+
+  /**
+   * Setup real order array (16 bit per column)
+   */
+  const Uint32 off= regTabPtr->m_real_order_descriptor;
+  const Uint32 sz= (regTabPtr->m_no_of_attributes + 1) >> 1;
+  ndbrequire((off + sz) < cnoOfTabDescrRec);
+  
+  Uint32 cnt= 0;
+  Uint16* order= (Uint16*)&tableDescriptor[off].tabDescr;
+  printf("order: ");
+  for (Uint32 type = 0; type < 4; type++)
+  {
+    for (Uint32 i= 0; i < regTabPtr->m_no_of_attributes; i++) 
+    {
+      ljam();
+      Uint32 refAttr= regTabPtr->tabDescriptor + (i * ZAD_SIZE);
+      Uint32 desc = getTabDescrWord(refAttr);
+      Uint32 t = 0;
+
+      if (AttributeDescriptor::getArrayType(desc) != NDB_ARRAYTYPE_FIXED) 
+      {
+	t += 1;
+      }
+      if (AttributeDescriptor::getDiskBased(desc))
+      {
+	t += 2;
+      }
+      ndbrequire(t < 4);
+      if(t == type)
+      {
+	* order++ = i << ZAD_LOG_SIZE;
+	printf("%d ", i << ZAD_LOG_SIZE);
+	cnt++;
+      }
+    }
+  }
+  ndbout_c("");
+  ndbrequire(cnt == regTabPtr->m_no_of_attributes);
 }
 
 void Dbtup::addattrrefuseLab(Signal* signal,

--- 1.6/storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp	2005-04-29 16:30:26 +02:00
+++ 1.7/storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp	2005-07-06 14:52:56 +02:00
@@ -47,7 +47,8 @@
   offset[2] = allocSize += regTabPtr->m_no_of_attributes* sizeOfReadFunction();
   offset[3] = allocSize += regTabPtr->noOfCharsets * sizeOfPointer;
   offset[4] = allocSize += regTabPtr->noOfKeyAttr;
-  allocSize += regTabPtr->m_no_of_attributes * ZAD_SIZE;
+  offset[5] = allocSize += regTabPtr->m_no_of_attributes * ZAD_SIZE;
+  offset[6] = allocSize += (regTabPtr->m_no_of_attributes + 1) >> 2; // real order
   allocSize += ZTD_TRAILER_SIZE;
   // return number of words
   return allocSize;
Thread
bk commit into 5.1 tree (joreland:1.1928)jonas.oreland6 Jul