List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:August 17 2009 7:25am
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:3009) Bug#46651
View as plain text  
#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped

 3009 Jonas Oreland	2009-08-17
      ndb - bug#46651 - fix handling of VAR_PART-bit

    modified:
      storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
      storage/ndb/test/ndbapi/testSystemRestart.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp	2009-08-17 07:25:41 +0000
@@ -93,8 +93,10 @@ Dbtup::do_tup_abort_operation(Signal* si
 
     if(! (bits & Tuple_header::ALLOC))
     {
+      jam();
       if(bits & Tuple_header::MM_GROWN)
       {
+        jam();
 	if (0) ndbout_c("abort grow");
 	Ptr<Page> vpage;
 	Uint32 idx= opPtrP->m_tuple_location.m_page_idx;
@@ -122,26 +124,30 @@ Dbtup::do_tup_abort_operation(Signal* si
         ndbassert(sz < len);
         if (sz)
         {
+          jam();
           pageP->shrink_entry(idx, sz);
+          update_free_page_list(fragPtrP, vpage);
         }
         else
         {
-          pageP->free_record(tmp.m_page_idx, Var_page::CHAIN);
+          jam();
+          free_var_part(fragPtrP, vpage, tmp.m_page_idx);
           tmp.m_page_no = RNIL;
           ref->assign(&tmp);
           bits &= ~(Uint32)Tuple_header::VAR_PART;
         }
-        update_free_page_list(fragPtrP, vpage);
         tuple_ptr->m_header_bits= bits & ~Tuple_header::MM_GROWN;
         change = true;
       } 
       else if(bits & Tuple_header::MM_SHRINK)
       {
+        jam();
 	if (0) ndbout_c("abort shrink");
       }
     }
     else if (opPtrP->is_first_operation())
     {
+      jam();
       /**
        * Aborting last operation that performed ALLOC
        */
@@ -152,8 +158,10 @@ Dbtup::do_tup_abort_operation(Signal* si
   }
   else if (opPtrP->is_first_operation())
   {
+    jam();
     if (bits & Tuple_header::ALLOC)
     {
+      jam();
       change = true;
       tuple_ptr->m_header_bits &= ~(Uint32)Tuple_header::ALLOC;
       tuple_ptr->m_header_bits |= Tuple_header::FREED;

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp	2009-08-17 07:25:41 +0000
@@ -267,12 +267,13 @@ Dbtup::commit_operation(Signal* signal,
     if (copy_bits & Tuple_header::VAR_PART)
     {
       jam();
-      ndbassert(tmp.m_page_no != RNIL);
       ndbassert(bits & Tuple_header::VAR_PART);
+      ndbassert(tmp.m_page_no != RNIL);
+      ndbassert(copy_bits & Tuple_header::COPY_TUPLE);
+
       Uint32 *dst= get_ptr(&vpagePtr, *ref);
       Var_page* vpagePtrP = (Var_page*)vpagePtr.p;
       Varpart_copy*vp =(Varpart_copy*)copy->get_end_of_fix_part_ptr(regTabPtr);
-      ndbassert(copy_bits & Tuple_header::COPY_TUPLE);
       /* The first word of shrunken tuple holds the lenght in words. */
       Uint32 len = vp->m_len;
       memcpy(dst, vp->m_data, 4*len);
@@ -285,16 +286,16 @@ Dbtup::commit_operation(Signal* signal,
         {
           jam();
           vpagePtrP->shrink_entry(tmp.m_page_idx, len);
+          update_free_page_list(regFragPtr, vpagePtr);
         }
         else
         {
           jam();
-          vpagePtrP->free_record(tmp.m_page_idx, Var_page::CHAIN);
+          free_var_part(regFragPtr, vpagePtr, tmp.m_page_idx);
           tmp.m_page_no = RNIL;
           ref->assign(&tmp);
           copy_bits &= ~(Uint32)Tuple_header::VAR_PART;
         }
-        update_free_page_list(regFragPtr, vpagePtr);
       }
       else
       {

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2009-08-17 07:25:41 +0000
@@ -1280,8 +1280,10 @@ Dbtup::prepare_initial_insert(KeyReqStru
 
   if(mm_vars || mm_dyns)
   {
-    bits |= Tuple_header::VAR_PART;
-    /* Reserve room for length word. */
+    jam();
+    /* Init Varpart_copy struct */
+    Varpart_copy * cp = (Varpart_copy*)ptr;
+    cp->m_len = 0;
     ptr += Varpart_copy::SZ32;
 
     /* Prepare empty varsize part. */
@@ -1312,6 +1314,7 @@ Dbtup::prepare_initial_insert(KeyReqStru
 
     if (mm_dyns)
     {
+      jam();
       /* Prepare empty dynamic part. */
       dst->m_dyn_data_ptr= (char *)ptr;
       dst->m_dyn_offset_arr_ptr= req_struct->var_pos_array+2*mm_vars;
@@ -1576,7 +1579,7 @@ int Dbtup::handleInsertReq(Signal* signa
     base = (Tuple_header*)ptr;
     base->m_operation_ptr_i= regOperPtr.i;
     base->m_header_bits= Tuple_header::ALLOC |
-      (vardynsize ? Tuple_header::VAR_PART : 0);
+      (sizes[2+MM] > 0 ? Tuple_header::VAR_PART : 0);
 
     regOperPtr.p->m_tuple_location.m_page_no = real_page_id;
   }
@@ -2915,7 +2918,6 @@ Dbtup::expand_tuple(KeyReqStruct* req_st
     
     ndbassert((UintPtr(src_ptr) & 3) == 0);
     src_ptr = src_ptr + step;
-    extra_bits |= Tuple_header::VAR_PART;
   }
 
   src->m_header_bits= bits & 
@@ -3228,6 +3230,12 @@ Dbtup::shrink_tuple(KeyReqStruct* req_st
       /* If no dynamic variables, store nothing. */
       ndbassert(bm_len);
       {
+        /**
+         * clear bm-len bits, so they won't incorrect indicate
+         *   a non-zero map
+         */
+        * dyn_src_ptr &= ~Uint32(DYN_BM_LEN_MASK);
+
         Uint32 *bm_ptr= (Uint32 *)dyn_src_ptr + bm_len - 1;
         while(*bm_ptr == 0)
         {
@@ -3345,6 +3353,7 @@ Dbtup::shrink_tuple(KeyReqStruct* req_st
     Uint32 varpart_len= dst_ptr - varstart;
     vp->m_len = varpart_len;
     sizes[MM] = varpart_len;
+    ptr->m_header_bits |= (varpart_len) ? Tuple_header::VAR_PART : 0;
     
     ndbassert((UintPtr(ptr) & 3) == 0);
     ndbassert(varpart_len < 0x10000);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2009-08-17 07:25:41 +0000
@@ -2923,6 +2923,8 @@ Dbtup::update_lcp(KeyReqStruct* req_stru
   req_struct->m_lcp_varpart_len = varlen32;
   ptr->m_header_bits |= (tabPtrP->m_bits & Tablerec::TR_DiskPart) ? 
     Tuple_header::DISK_PART : 0;
+  ptr->m_header_bits |= (varlen32) ? Tuple_header::VAR_PART : 0;
+
   req_struct->changeMask.set();
 }
 

=== modified file 'storage/ndb/test/ndbapi/testSystemRestart.cpp'
--- a/storage/ndb/test/ndbapi/testSystemRestart.cpp	2009-05-28 12:51:47 +0000
+++ b/storage/ndb/test/ndbapi/testSystemRestart.cpp	2009-08-17 07:25:41 +0000
@@ -1832,6 +1832,93 @@ int runBug45154(NDBT_Context* ctx, NDBT_
   return result;
 }
 
+int runBug46651(NDBT_Context* ctx, NDBT_Step* step)
+{
+  Ndb* pNdb = GETNDB(step);
+  NdbDictionary::Dictionary * pDict = pNdb->getDictionary();
+  Uint32 rows = ctx->getNumRecords();
+  NdbRestarter res;
+
+  NdbDictionary::Table tab;
+  tab.setName("BUG_46651");
+
+  NdbDictionary::Column col;
+  col.setName("ATTR1");
+  col.setType(NdbDictionary::Column::Unsigned);
+  col.setLength(1);
+  col.setPrimaryKey(true);
+  col.setNullable(false);
+  col.setAutoIncrement(false);
+  tab.addColumn(col);
+  col.setName("ATTR2");
+  col.setType(NdbDictionary::Column::Unsigned);
+  col.setLength(1);
+  col.setPrimaryKey(false);
+  col.setNullable(false);
+  tab.addColumn(col);
+  col.setName("ATTR3");
+  col.setType(NdbDictionary::Column::Unsigned);
+  col.setLength(1);
+  col.setPrimaryKey(false);
+  col.setNullable(false);
+  tab.addColumn(col);
+  tab.setForceVarPart(true);
+  pDict->dropTable(tab.getName());
+  if (pDict->createTable(tab))
+  {
+    ndbout << pDict->getNdbError() << endl;
+    return NDBT_FAILED;
+  }
+
+  const NdbDictionary::Table* pTab = pDict->getTable(tab.getName());
+  if (pTab == 0)
+  {
+    ndbout << pDict->getNdbError() << endl;
+    return NDBT_FAILED;
+  }
+
+  {
+    HugoTransactions trans(* pTab);
+    if (trans.loadTable(pNdb, rows) != 0)
+    {
+      return NDBT_FAILED;
+    }
+  }
+
+  res.restartAll2(NdbRestarter::NRRF_NOSTART);
+  if (res.waitClusterNoStart())
+    return NDBT_FAILED;
+  res.startAll();
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+
+  NdbDictionary::Table newTab = *pTab;
+  col.setName("ATTR4");
+  col.setType(NdbDictionary::Column::Varbinary);
+  col.setLength(25);
+  col.setPrimaryKey(false);
+  col.setNullable(true);
+  col.setDynamic(true);
+  newTab.addColumn(col);
+
+  if (pDict->alterTable(*pTab, newTab))
+  {
+    ndbout << pDict->getNdbError() << endl;
+    return NDBT_FAILED;
+  }
+
+  res.restartAll2(NdbRestarter::NRRF_NOSTART | NdbRestarter::NRRF_ABORT);
+  if (res.waitClusterNoStart())
+    return NDBT_FAILED;
+  res.startAll();
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+
+  pDict->dropTable(tab.getName());
+
+  return NDBT_OK;
+}
+
 NDBT_TESTSUITE(testSystemRestart);
 TESTCASE("SR1", 
 	 "Basic system restart test. Focus on testing restart from REDO log.\n"
@@ -2131,6 +2218,10 @@ TESTCASE("Bug45154", "")
 {
   INITIALIZER(runBug45154);
 }
+TESTCASE("Bug46651", "")
+{
+  INITIALIZER(runBug46651);
+}
 NDBT_TESTSUITE_END(testSystemRestart);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2009-08-07 11:59:45 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2009-08-17 07:25:41 +0000
@@ -1320,3 +1320,7 @@ max-time: 300
 cmd: testSystemRestart
 args: -n Bug45154 D1
 
+max-time: 300
+cmd: testSystemRestart
+args: -n Bug46651 T1
+


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20090817072541-hev1n1lc0940i6a7.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:3009) Bug#46651Jonas Oreland17 Aug