List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:May 5 2011 8:05am
Subject:bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch
(ole.john.aske:3490 to 3491)
View as plain text  
 3491 Ole John Aske	2011-05-05 [merge]
      Merge telco-7.0 -> SPJ

    modified:
      mysql-test/include/ndb_backup_id.inc
      mysql-test/suite/ndb/t/ndb_show_tables_result.inc
      storage/ndb/src/ndbapi/NdbQueryBuilder.cpp
      storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp
 3490 Ole John Aske	2011-05-04
      Enable 'bushy-scans' to be part of a pushed query - Which was mainly 
      to remove the 'depend_parents.add(ancestor_no)' restriction from
      ha_ndbcluster_push.cc
      
      Added new bushy MTR testcases, and updated comments on a few existing
      testcases which used to be enforced to be non-bushy.

    modified:
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      mysql-test/suite/ndb/t/ndb_join_pushdown.test
      sql/ha_ndbcluster_push.cc
=== modified file 'mysql-test/include/ndb_backup_id.inc'
--- a/mysql-test/include/ndb_backup_id.inc	2009-07-14 07:52:35 +0000
+++ b/mysql-test/include/ndb_backup_id.inc	2011-05-04 13:00:44 +0000
@@ -1,6 +1,6 @@
 # there is no neat way to find the backupid, this is a hack to find it...
 --let $dump_file= $MYSQLTEST_VARDIR/tmp/select_all.txt
---exec $NDB_SELECT_ALL -d sys --delimiter=, SYSTAB_0 > $dump_file
+--exec $NDB_SELECT_ALL --no-defaults -d sys --delimiter=, SYSTAB_0 > $dump_file
 
 CREATE TEMPORARY TABLE test.backup_info(
   a BIGINT,

=== modified file 'mysql-test/suite/ndb/t/ndb_show_tables_result.inc'
--- a/mysql-test/suite/ndb/t/ndb_show_tables_result.inc	2009-10-09 16:13:54 +0000
+++ b/mysql-test/suite/ndb/t/ndb_show_tables_result.inc	2011-05-04 13:00:44 +0000
@@ -2,7 +2,7 @@
 let $dump_file = $MYSQLTEST_VARDIR/tmp/ndb_show_tables.txt;
 
 # Dump the output of ndb_show_tables to file
---exec $NDB_SHOW_TABLES --p > $dump_file
+--exec $NDB_SHOW_TABLES --no-defaults --p > $dump_file
 
 TRUNCATE ndb_show_tables_results;
 

=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp	2011-05-04 11:48:48 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp	2011-05-05 08:04:49 +0000
@@ -855,13 +855,9 @@ NdbQueryBuilder::readTuple(const NdbDict
                                        ident,
                                        m_impl.m_operations.size(),
                                        error);
-  returnErrIf(op==0, Err_MemoryAlloc);
-  if (unlikely(error != 0))
-  {
-    m_impl.setErrorCode(error);
-    delete op;
-    return NULL;
-  }
+
+  returnErrIf(m_impl.takeOwnership(op)!=0, Err_MemoryAlloc);
+  returnErrIf(error!=0, error); // C'tor returned error, bailout
 
   Uint32 keyindex = 0;
   for (i=0; i<colcount; ++i)
@@ -871,11 +867,7 @@ NdbQueryBuilder::readTuple(const NdbDict
     {
       assert (keyindex==col->m_keyInfoPos);
       int error = op->m_keys[col->m_keyInfoPos]->bindOperand(*col,*op);
-      if (unlikely(error))
-      { m_impl.setErrorCode(error);
-        delete op;
-        return NULL;
-      }
+      returnErrIf(error!=0, error);
 
       keyindex++;
       if (keyindex >= static_cast<Uint32>(keyfields))
@@ -883,17 +875,7 @@ NdbQueryBuilder::readTuple(const NdbDict
     }
   }
   
-  if (likely(m_impl.m_operations.push_back(op) == 0))
-  {
-    return &op->m_interface;
-  }
-  else
-  {
-    assert(errno == ENOMEM);
-    delete op;
-    m_impl.setErrorCode(Err_MemoryAlloc);
-    return NULL;
-  }
+  return &op->m_interface;
 }
 
 
@@ -942,13 +924,9 @@ NdbQueryBuilder::readTuple(const NdbDict
                                        ident,
                                        m_impl.m_operations.size(),
                                        error);
-  returnErrIf(op==0, Err_MemoryAlloc);
-  if (unlikely(error != 0))
-  {
-    m_impl.setErrorCode(error);
-    delete op;
-    return NULL;
-  }
+
+  returnErrIf(m_impl.takeOwnership(op)!=0, Err_MemoryAlloc);
+  returnErrIf(error!=0, error); // C'tor returned error, bailout
 
   // Bind to Column and check type compatibility
   for (i=0; i<inxfields; ++i)
@@ -957,24 +935,10 @@ NdbQueryBuilder::readTuple(const NdbDict
     assert (col.getColumnNo() == i);
 
     error = keys[i]->getImpl().bindOperand(col,*op);
-    if (unlikely(error))
-    { m_impl.setErrorCode(error);
-      delete op;
-      return NULL;
-    }
+    returnErrIf(error!=0, error);
   }
 
-  if (likely(m_impl.m_operations.push_back(op) == 0))
-  {
-    return &op->m_interface;
-  }
-  else
-  {
-    assert(errno == ENOMEM);
-    delete op;
-    m_impl.setErrorCode(Err_MemoryAlloc);
-    return NULL;
-  }
+  return &op->m_interface;
 }
 
 
@@ -994,21 +958,9 @@ NdbQueryBuilder::scanTable(const NdbDict
                                           ident,
                                           m_impl.m_operations.size(),
                                           error);
-  returnErrIf(op==0, Err_MemoryAlloc);
-  if (unlikely(error != 0))
-  {
-    m_impl.setErrorCode(error);
-    delete op;
-    return NULL;
-  }
 
-  if (unlikely(m_impl.m_operations.push_back(op) != 0))
-  {
-    assert(errno == ENOMEM);
-    delete op;
-    m_impl.setErrorCode(Err_MemoryAlloc);
-    return NULL;
-  }
+  returnErrIf(m_impl.takeOwnership(op)!=0, Err_MemoryAlloc);
+  returnErrIf(error!=0, error); // C'tor returned error, bailout
 
   error = op->markScanAncestors();
   returnErrIf(error!=0, error);
@@ -1051,20 +1003,13 @@ NdbQueryBuilder::scanIndex(const NdbDict
                                           ident,
                                           m_impl.m_operations.size(),
                                           error);
-  returnErrIf(op==0, Err_MemoryAlloc);
-  if (unlikely(error != 0))
-  {
-    m_impl.setErrorCode(error);
-    delete op;
-    return NULL;
-  }
 
-  if (unlikely(op->m_bound.lowKeys  > indexImpl.getNoOfColumns() ||
-               op->m_bound.highKeys > indexImpl.getNoOfColumns()))
-  { m_impl.setErrorCode(QRY_TOO_MANY_KEY_VALUES);
-    delete op;
-    return NULL;
-  }
+  returnErrIf(m_impl.takeOwnership(op)!=0, Err_MemoryAlloc);
+  returnErrIf(error!=0, error); // C'tor returned error, bailout
+
+  returnErrIf(op->m_bound.lowKeys  > indexImpl.getNoOfColumns() ||
+              op->m_bound.highKeys > indexImpl.getNoOfColumns(),
+              QRY_TOO_MANY_KEY_VALUES);
 
   // Bind lowKeys, and if applicable, highKeys to the column being refered
   Uint32 i;
@@ -1076,11 +1021,7 @@ NdbQueryBuilder::scanIndex(const NdbDict
        ? op->m_bound.low[i]->bindOperand(col,*op) || op->m_bound.high[i]->bindOperand(col,*op)
        : op->m_bound.low[i]->bindOperand(col,*op);
 
-    if (unlikely(error))
-    { m_impl.setErrorCode(error);
-      delete op;
-      return NULL;
-    }
+    returnErrIf(error!=0, error);
   }
 
   // Bind any remaining highKeys past '#lowKeys'
@@ -1088,31 +1029,13 @@ NdbQueryBuilder::scanIndex(const NdbDict
   {
     const NdbColumnImpl& col = NdbColumnImpl::getImpl(*indexImpl.getColumn(i));
     error = op->m_bound.high[i]->bindOperand(col,*op);
-    if (unlikely(error))
-    { m_impl.setErrorCode(error);
-      delete op;
-      return NULL;
-    }
+    returnErrIf(error!=0, error);
   }
 
   error = op->markScanAncestors();
-  if (unlikely(error))
-  { m_impl.setErrorCode(error);
-    delete op;
-    return NULL;
-  }
+  returnErrIf(error!=0, error);
 
-  if (likely(m_impl.m_operations.push_back(op) == 0))
-  {
-    return &op->m_interface;
-  }
-  else
-  {
-    assert(errno == ENOMEM);
-    delete op;
-    m_impl.setErrorCode(Err_MemoryAlloc);
-    return NULL;
-  }
+  return &op->m_interface;
 }
 
 const NdbQueryDef*
@@ -1219,27 +1142,43 @@ NdbQueryBuilderImpl::prepare()
   return def;
 }
 
-
-NdbQueryOperand* 
-NdbQueryBuilderImpl::addOperand(NdbQueryOperandImpl* operand)
+inline int 
+NdbQueryBuilderImpl::takeOwnership(NdbQueryOperandImpl* operand)
 {
   if (unlikely(operand == NULL))
   {
-    setErrorCode(Err_MemoryAlloc);
-    return NULL;
+    return Err_MemoryAlloc;
   }
+  else if (unlikely(m_operands.push_back(operand) != 0))
+  {
+    assert(errno == ENOMEM);
+    delete operand;
+    return Err_MemoryAlloc;
+  }
+  return 0;
+}
 
-  if (likely(m_operands.push_back(operand) == 0))
+inline int 
+NdbQueryBuilderImpl::takeOwnership(NdbQueryOperationDefImpl* operation)
+{
+  if (unlikely(operation == NULL))
   {
-    return &operand->getInterface();
+    return Err_MemoryAlloc;
   }
-  else
+  else if (unlikely(m_operations.push_back(operation) != 0))
   {
     assert(errno == ENOMEM);
-    delete operand;
-    setErrorCode(Err_MemoryAlloc);
-    return NULL;
+    delete operation;
+    return Err_MemoryAlloc;
   }
+  return 0;
+}
+
+NdbQueryOperand* 
+NdbQueryBuilderImpl::addOperand(NdbQueryOperandImpl* operand)
+{
+  returnErrIf(takeOwnership(operand)!=0, Err_MemoryAlloc);
+  return &operand->getInterface();
 }
 
 ///////////////////////////////////

=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp	2011-05-04 11:48:48 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp	2011-05-05 08:04:49 +0000
@@ -663,6 +663,17 @@ private:
    */
   NdbQueryOperand* addOperand(NdbQueryOperandImpl* operand);
 
+  /**
+   * Take ownership of specified object: From now on it is the
+   * responsibility of this NdbQueryBuilderImpl to manage the
+   * lifetime of the object. If takeOwnership() fails, the 
+   * specified object is deleted before it returns.
+   * @param[in] operand to take ownership for (may be NULL).
+   * @return 0 if ok, else there has been an 'Err_MemoryAlloc'
+   */
+  int takeOwnership(NdbQueryOperandImpl*);
+  int takeOwnership(NdbQueryOperationDefImpl*);
+
   bool contains(const NdbQueryOperationDefImpl*);
 
   NdbQueryBuilder m_interface;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3490 to 3491) Ole John Aske5 May