MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jonas Date:June 27 2006 9:41am
Subject:bk commit into 5.0 tree (jonas:1.2128) BUG#20252
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.2128 06/06/27 11:41:00 jonas@stripped +5 -0
  ndb - bug#20252
    allow user to specify scan batch size in readTuples

  ndb/src/ndbapi/NdbScanOperation.cpp
    1.70 06/06/27 11:40:57 jonas@stripped +15 -8
    Allow user to specify batchsize

  ndb/src/ndbapi/NdbReceiver.cpp
    1.16 06/06/27 11:40:57 jonas@stripped +9 -1
    Allow user yo specify batch size

  ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
    1.87 06/06/27 11:40:57 jonas@stripped +4 -4
    Fix so that last row works even if batch is complete

  ndb/include/ndbapi/NdbScanOperation.hpp
    1.34 06/06/27 11:40:57 jonas@stripped +3 -1
    Allow user to specify batch size

  ndb/include/ndbapi/NdbIndexScanOperation.hpp
    1.19 06/06/27 11:40:57 jonas@stripped +4 -2
    Allow user to specify batch size

# 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:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/50-work

--- 1.18/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2005-09-20 10:46:30 +02:00
+++ 1.19/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2006-06-27 11:40:57 +02:00
@@ -41,7 +41,9 @@ public:
    * @param parallel No of fragments to scan in parallel (0=max)
    */ 
   virtual int readTuples(LockMode lock_mode = LM_Read, 
-                         Uint32 scan_flags = 0, Uint32 parallel = 0);
+                         Uint32 scan_flags = 0, 
+			 Uint32 parallel = 0,
+			 Uint32 batch = 0);
 
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
   /**
@@ -66,7 +68,7 @@ public:
       (SF_OrderBy & -(Int32)order_by) |
       (SF_Descending & -(Int32)order_desc) |
       (SF_ReadRangeNo & -(Int32)read_range_no);
-    return readTuples(lock_mode, scan_flags, parallel);
+    return readTuples(lock_mode, scan_flags, parallel, batch);
   }
 #endif
 

--- 1.33/ndb/include/ndbapi/NdbScanOperation.hpp	2006-03-23 09:57:45 +01:00
+++ 1.34/ndb/include/ndbapi/NdbScanOperation.hpp	2006-06-27 11:40:57 +02:00
@@ -56,7 +56,9 @@ public:
    */ 
   virtual
   int readTuples(LockMode lock_mode = LM_Read, 
-                 Uint32 scan_flags = 0, Uint32 parallel = 0);
+                 Uint32 scan_flags = 0, 
+		 Uint32 parallel = 0,
+		 Uint32 batch = 0);
 
 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
   /**

--- 1.86/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2006-03-23 15:46:57 +01:00
+++ 1.87/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2006-06-27 11:40:57 +02:00
@@ -7349,15 +7349,15 @@ void Dblqh::scanLockReleasedLab(Signal* 
       scanptr.p->m_curr_batch_size_rows = 0;
       scanptr.p->m_curr_batch_size_bytes = 0;
       closeScanLab(signal);
+    } else if (scanptr.p->m_last_row && !scanptr.p->scanLockHold) {
+      jam();
+      closeScanLab(signal);
+      return;
     } else if (scanptr.p->check_scan_batch_completed() &&
                scanptr.p->scanLockHold != ZTRUE) {
       jam();
       scanptr.p->scanState = ScanRecord::WAIT_SCAN_NEXTREQ;
       sendScanFragConf(signal, ZFALSE);
-    } else if (scanptr.p->m_last_row && !scanptr.p->scanLockHold) {
-      jam();
-      closeScanLab(signal);
-      return;
     } else {
       jam();
       /*

--- 1.15/ndb/src/ndbapi/NdbReceiver.cpp	2004-12-31 06:19:25 +01:00
+++ 1.16/ndb/src/ndbapi/NdbReceiver.cpp	2006-06-27 11:40:57 +02:00
@@ -121,7 +121,15 @@ NdbReceiver::calculate_batch_size(Uint32
    * no more than MAX_SCAN_BATCH_SIZE is sent from all nodes in total per
    * batch.
    */
-  batch_byte_size= max_batch_byte_size;
+  if (batch_size == 0)
+  {
+    batch_byte_size= max_batch_byte_size;
+  }
+  else
+  {
+    batch_byte_size= batch_size * tot_size;
+  }
+  
   if (batch_byte_size * parallelism > max_scan_batch_size) {
     batch_byte_size= max_scan_batch_size / parallelism;
   }

--- 1.69/ndb/src/ndbapi/NdbScanOperation.cpp	2006-04-21 10:17:41 +02:00
+++ 1.70/ndb/src/ndbapi/NdbScanOperation.cpp	2006-06-27 11:40:57 +02:00
@@ -117,7 +117,8 @@ NdbScanOperation::init(const NdbTableImp
 int 
 NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
 			     Uint32 scan_flags, 
-			     Uint32 parallel)
+			     Uint32 parallel,
+			     Uint32 batch)
 {
   m_ordered = m_descending = false;
   Uint32 fragCount = m_currentTable->m_fragmentCount;
@@ -181,9 +182,12 @@ NdbScanOperation::readTuples(NdbScanOper
   bool tupScan = (scan_flags & SF_TupScan);
   if (tupScan && rangeScan)
     tupScan = false;
-  
-  theParallelism = parallel;
 
+  if (rangeScan && (scan_flags & SF_OrderBy))
+    parallel = fragCount;
+  
+  theParallelism = parallel;    
+  
   if(fix_receivers(parallel) == -1){
     setErrorCodeAbort(4000);
     return -1;
@@ -202,6 +206,7 @@ NdbScanOperation::readTuples(NdbScanOper
   req->tableSchemaVersion = m_accessTable->m_version;
   req->storedProcId = 0xFFFF;
   req->buddyConPtr = theNdbCon->theBuddyConPtr;
+  req->first_batch_size = batch; // Save user specified batch size
   
   Uint32 reqInfo = 0;
   ScanTabReq::setParallelism(reqInfo, parallel);
@@ -750,13 +755,14 @@ int NdbScanOperation::prepareSendScan(Ui
    * The number of records sent by each LQH is calculated and the kernel
    * is informed of this number by updating the SCAN_TABREQ signal
    */
-  Uint32 batch_size, batch_byte_size, first_batch_size;
+  ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
+  Uint32 batch_size = req->first_batch_size; // User specified
+  Uint32 batch_byte_size, first_batch_size;
   theReceiver.calculate_batch_size(key_size,
                                    theParallelism,
                                    batch_size,
                                    batch_byte_size,
                                    first_batch_size);
-  ScanTabReq * req = CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
   ScanTabReq::setScanBatch(req->requestInfo, batch_size);
   req->batch_byte_size= batch_byte_size;
   req->first_batch_size= first_batch_size;
@@ -1206,13 +1212,14 @@ error:
 int
 NdbIndexScanOperation::readTuples(LockMode lm,
 				  Uint32 scan_flags,
-				  Uint32 parallel)
+				  Uint32 parallel,
+				  Uint32 batch)
 {
   const bool order_by = scan_flags & SF_OrderBy;
   const bool order_desc = scan_flags & SF_Descending;
   const bool read_range_no = scan_flags & SF_ReadRangeNo;
-
-  int res = NdbScanOperation::readTuples(lm, scan_flags, 0);
+  
+  int res = NdbScanOperation::readTuples(lm, scan_flags, parallel, batch);
   if(!res && read_range_no)
   {
     m_read_range_no = 1;
Thread
bk commit into 5.0 tree (jonas:1.2128) BUG#20252jonas27 Jun