From 99bc9c3a4ad121eca16bb083b6a3939d1534346f Mon Sep 17 00:00:00 2001
From: "jonas@perch.ndb.mysql.com" <>
Date: Mon, 17 Oct 2005 09:29:41 +0200
Subject: [PATCH] Fix testDict -n FragmentTypeSingle T1 Init KeyDescriptor
 before sending to DIH,   make sure that its always inited

---
 ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 76 ++++++++++++-------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index 7c4b97c8f0..45efaac30b 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -4346,6 +4346,44 @@ Dbdict::createTab_dih(Signal* signal,
 
   sendSignal(DBDIH_REF, GSN_DIADDTABREQ, signal, 
 	     DiAddTabReq::SignalLength, JBB);
+
+  /**
+   * Create KeyDescriptor
+   */
+  KeyDescriptor* desc= g_key_descriptor_pool.getPtr(tabPtr.i);
+  new (desc) KeyDescriptor();
+
+  Uint32 key = 0;
+  Uint32 tAttr = tabPtr.p->firstAttribute;
+  while (tAttr != RNIL) 
+  {
+    jam();
+    AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr);
+    if (aRec->tupleKey) 
+    {
+      desc->noOfKeyAttr ++;
+      desc->keyAttr[key].attributeDescriptor = aRec->attributeDescriptor;
+      
+      Uint32 csNumber = (aRec->extPrecision >> 16);
+      if(csNumber)
+      {
+	desc->keyAttr[key].charsetInfo = all_charsets[csNumber];
+	ndbrequire(all_charsets[csNumber]);
+	desc->hasCharAttr = 1;
+      }
+      else
+      {
+	desc->keyAttr[key].charsetInfo = 0;	  
+      }
+      if(AttributeDescriptor::getDKey(aRec->attributeDescriptor))
+      {
+	desc->noOfDistrKeys ++;
+      }
+      key++;
+    }
+    tAttr = aRec->nextAttrInTable;
+  }
+  ndbrequire(key == tabPtr.p->noOfPrimkey);
 }
 
 static
@@ -4448,44 +4486,6 @@ Dbdict::execADD_FRAGREQ(Signal* signal) {
     sendSignal(DBLQH_REF, GSN_LQHFRAGREQ, signal, 
 	       LqhFragReq::SignalLength, JBB);
   }
-
-  /**
-   * Create KeyDescriptor
-   */
-  KeyDescriptor* desc= g_key_descriptor_pool.getPtr(tabPtr.i);
-  new (desc) KeyDescriptor();
-
-  Uint32 key = 0;
-  Uint32 tAttr = tabPtr.p->firstAttribute;
-  while (tAttr != RNIL) 
-  {
-    jam();
-    AttributeRecord* aRec = c_attributeRecordPool.getPtr(tAttr);
-    if (aRec->tupleKey) 
-    {
-      desc->noOfKeyAttr ++;
-      desc->keyAttr[key].attributeDescriptor = aRec->attributeDescriptor;
-      
-      Uint32 csNumber = (aRec->extPrecision >> 16);
-      if(csNumber)
-      {
-	desc->keyAttr[key].charsetInfo = all_charsets[csNumber];
-	ndbrequire(all_charsets[csNumber]);
-	desc->hasCharAttr = 1;
-      }
-      else
-      {
-	desc->keyAttr[key].charsetInfo = 0;	  
-      }
-      if(AttributeDescriptor::getDKey(aRec->attributeDescriptor))
-      {
-	desc->noOfDistrKeys ++;
-      }
-      key++;
-    }
-    tAttr = aRec->nextAttrInTable;
-  }
-  ndbrequire(key == tabPtr.p->noOfPrimkey);
 }
 
 void
-- 
2.30.9