List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:November 1 2010 3:11pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (frazer:3909 to 3910) Bug#57848
View as plain text  
 3910 Frazer Clement	2010-11-01
      Bug#57848 Ndb : Table reorg scan should probably use TUP order
      
      Modify table reorg code to use TUP order scan when table contains disk columns.
      
      This should tend towards a more sequential access pattern to data on disk.

    modified:
      storage/ndb/include/kernel/signaldata/CopyData.hpp
      storage/ndb/include/kernel/signaldata/SumaImpl.hpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/suma/Suma.cpp
      storage/ndb/src/kernel/blocks/trix/Trix.cpp
      storage/ndb/src/kernel/blocks/trix/Trix.hpp
 3909 Frazer Clement	2010-11-01 [merge]
      Merge 6.3->7.0

    modified:
      mysql-test/suite/ndb/r/ndb_index_unique.result
      mysql-test/suite/ndb/t/ndb_index_unique.test
      storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp
      storage/ndb/include/kernel/signaldata/SumaImpl.hpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/suma/Suma.cpp
      storage/ndb/src/kernel/blocks/trix/Trix.cpp
      storage/ndb/src/kernel/blocks/trix/Trix.hpp
=== modified file 'storage/ndb/include/kernel/signaldata/CopyData.hpp'
--- a/storage/ndb/include/kernel/signaldata/CopyData.hpp	2008-06-05 20:29:13 +0000
+++ b/storage/ndb/include/kernel/signaldata/CopyData.hpp	2010-11-01 14:48:53 +0000
@@ -29,6 +29,10 @@ struct CopyDataReq
     // AlterTableCopy
   };
 
+  enum Flags {
+    TupOrder = 1
+  };
+
   union {
     Uint32 clientRef;
     Uint32 senderRef;

=== modified file 'storage/ndb/include/kernel/signaldata/SumaImpl.hpp'
--- a/storage/ndb/include/kernel/signaldata/SumaImpl.hpp	2010-11-01 14:16:07 +0000
+++ b/storage/ndb/include/kernel/signaldata/SumaImpl.hpp	2010-11-01 14:48:53 +0000
@@ -265,6 +265,7 @@ struct SubSyncReq {
     LM_Exclusive = 0x1
     ,Reorg = 0x2
     ,NoDisk = 0x4
+    ,TupOrder = 0x8
   };
 
   SECTION( ATTRIBUTE_LIST = 0); // Used when doing SingelTableScan  

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2010-11-01 14:16:07 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2010-11-01 14:48:53 +0000
@@ -13733,6 +13733,7 @@ Dbdict::copyData_prepare(Signal* signal,
 
   Uint32 cnt =0;
   Uint32 tmp[MAX_ATTRIBUTES_IN_TABLE];
+  bool tabHasDiskCols = false;
   TableRecordPtr tabPtr;
   c_tableRecordPool.getPtr(tabPtr, impl_req->srcTableId);
   {
@@ -13747,10 +13748,22 @@ Dbdict::copyData_prepare(Signal* signal,
     for (alist.first(attrPtr); !attrPtr.isNull(); alist.next(attrPtr))
     {
       if (!AttributeDescriptor::getPrimaryKey(attrPtr.p->attributeDescriptor))
+      {
         tmp[cnt++] = attrPtr.p->attributeId;
+
+        if (AttributeDescriptor::getDiskBased(attrPtr.p->attributeDescriptor))
+          tabHasDiskCols = true;
+      }
     }
   }
   
+  /* Request Tup-ordered copy when we have disk columns for efficiency */
+  if (tabHasDiskCols)
+  {
+    jam();
+    req->requestInfo |= CopyDataReq::TupOrder;
+  }
+  
   LinearSectionPtr ls_ptr[3];
   ls_ptr[0].sz = cnt;
   ls_ptr[0].p = tmp;
@@ -13821,6 +13834,7 @@ Dbdict::copyData_complete(Signal* signal
 
   Uint32 cnt =0;
   Uint32 tmp[MAX_ATTRIBUTES_IN_TABLE];
+  bool tabHasDiskCols = false;
   TableRecordPtr tabPtr;
   c_tableRecordPool.getPtr(tabPtr, impl_req->srcTableId);
   {
@@ -13831,9 +13845,21 @@ Dbdict::copyData_complete(Signal* signal
     {
       if (AttributeDescriptor::getPrimaryKey(attrPtr.p->attributeDescriptor))
         tmp[cnt++] = attrPtr.p->attributeId;
+      else
+      {
+        if (AttributeDescriptor::getDiskBased(attrPtr.p->attributeDescriptor))
+          tabHasDiskCols = true;
+      }
     }
   }
 
+  /* Request Tup-ordered delete when we have disk columns for efficiency */
+  if (tabHasDiskCols)
+  {
+    jam();
+    req->requestInfo |= CopyDataReq::TupOrder;
+  }
+
   LinearSectionPtr ls_ptr[3];
   ls_ptr[0].sz = cnt;
   ls_ptr[0].p = tmp;

=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2010-11-01 14:16:07 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2010-11-01 14:48:53 +0000
@@ -2723,6 +2723,11 @@ Suma::SyncRecord::nextScan(Signal* signa
     ScanFragReq::setReorgFlag(req->requestInfo, ScanFragReq::REORG_MOVED);
   }
 
+  if (m_requestInfo & SubSyncReq::TupOrder)
+  {
+    ScanFragReq::setTupScanFlag(req->requestInfo, 1);
+  }
+
   req->fragmentNoKeyLen = fd.m_fragDesc.m_fragmentNo;
   req->schemaVersion = tabPtr.p->m_schemaVersion;
   req->transId1 = 0;

=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.cpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2010-11-01 14:16:07 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2010-11-01 14:48:53 +0000
@@ -957,6 +957,12 @@ void Trix::startTableScan(Signal* signal
     jam();
     subSyncReq->requestInfo |= SubSyncReq::NoDisk;
   }
+
+  if (subRec->m_flags & SubscriptionRecord::RF_TUP_ORDER)
+  {
+    jam();
+    subSyncReq->requestInfo |= SubSyncReq::TupOrder;
+  }
   
   if (subRec->requestType == REORG_COPY)
   {
@@ -1405,6 +1411,12 @@ Trix::execCOPY_DATA_IMPL_REQ(Signal* sig
     ndbrequire(false);
   }
 
+  if (req->requestInfo & CopyDataReq::TupOrder)
+  {
+    jam();
+    subRec->m_flags |= SubscriptionRecord::RF_TUP_ORDER;
+  }
+
   // Get column order segments
   Uint32 noOfSections = handle.m_cnt;
   if (noOfSections > 0) {

=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.hpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.hpp	2010-11-01 14:16:07 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.hpp	2010-11-01 14:48:53 +0000
@@ -109,6 +109,7 @@ private:
     enum RequestFlags {
       RF_WAIT_GCP = 0x1
       ,RF_NO_DISK = 0x2
+      ,RF_TUP_ORDER = 0x4
     };
     Uint32 m_flags;
     RequestType requestType;


Attachment: [text/bzr-bundle] bzr/frazer@mysql.com-20101101144853-ok4iws7cp1n4ydsm.bundle
Thread
bzr push into mysql-5.1-telco-7.0 branch (frazer:3909 to 3910) Bug#57848Frazer Clement1 Nov