List:Commits« Previous MessageNext Message »
From:Jan Wedvik Date:September 13 2012 8:17am
Subject:bzr push into mysql-5.1-telco-7.1 branch (jan.wedvik:4601 to 4602)
View as plain text  
 4602 Jan Wedvik	2012-09-13 [merge]
      Merge 7.0->7.1.

    modified:
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
      storage/ndb/src/ndbapi/NdbQueryBuilder.cpp
      storage/ndb/src/ndbapi/NdbQueryOperation.cpp
      storage/ndb/test/ndbapi/testSpj.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
 4601 Frazer Clement	2012-09-12 [merge]
      Merge 7.0->7.1

    modified:
      storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
      storage/ndb/test/ndbapi/testScan.cpp
      storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2012-09-12 14:46:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2012-09-13 08:16:29 +0000
@@ -1863,6 +1863,14 @@ start_failure:
     abortErrorLab(signal);
     return;
   }
+  case 66:
+  {
+    jam();
+    /* Function not implemented yet */
+    terrorCode = 4003;
+    abortErrorLab(signal);
+    return;
+  }
   default:
     jam();
     systemErrorLab(signal, __LINE__);
@@ -2931,6 +2939,17 @@ void Dbtc::execTCKEYREQ(Signal* signal)
     return;
   }
   
+  if (unlikely(TViaSPJFlag &&
+               /* Check that all nodes can handle SPJ requests. */
+               !ndb_join_pushdown(getNodeVersionInfo().m_type[NodeInfo::DB]
+                                  .m_min_version)))
+  {
+    jam();
+    releaseSections(handle);
+    TCKEY_abort(signal, 66);
+    return;
+  }
+
   /* KeyInfo and AttrInfo are buffered in segmented sections
    * If they arrived in segmented sections then there's nothing to do
    * If they arrived in short signals then they are appended into
@@ -10522,6 +10541,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signa
     goto SCAN_TAB_error;
   }
 
+  if (unlikely (ScanTabReq::getViaSPJFlag(ri) &&
+                /* Check that all nodes can handle SPJ requests. */
+                !ndb_join_pushdown(getNodeVersionInfo().m_type[NodeInfo::DB]
+                                   .m_min_version)))
+  {
+    jam();
+    errCode = 4003; // Function not implemented
+    goto SCAN_TAB_error;
+  }
+
   ptrAss(tabptr, tableRecord);
   if ((aiLength == 0) ||
       (!tabptr.p->checkTable(schemaVersion)) ||

=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp	2011-10-20 12:45:36 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp	2012-09-13 08:05:29 +0000
@@ -53,6 +53,7 @@ static const bool doPrintQueryTree = fal
 
 /* Various error codes that are not specific to NdbQuery. */
 static const int Err_MemoryAlloc = 4000;
+static const int Err_FunctionNotImplemented = 4003;
 static const int Err_UnknownColumn = 4004;
 static const int Err_FinaliseNotCalled = 4519;
 
@@ -703,6 +704,13 @@ NdbQueryBuilder* NdbQueryBuilder::create
   {
     if (likely(impl->getNdbError().code == 0))
     {
+      if((!ndb_join_pushdown(ndbGetOwnVersion())))
+      {
+        /* The SPJ code is present in releases where the SPJ feature is
+         * not yet enabled.
+         */
+        impl->setErrorCode(Err_FunctionNotImplemented);
+      }
       return &impl->m_interface;
     }
     else

=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2012-06-21 12:33:15 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp	2012-09-13 08:05:29 +0000
@@ -1893,6 +1893,12 @@ NdbQueryImpl::buildQuery(NdbTransaction&
                          const NdbQueryDefImpl& queryDef)
 {
   assert(queryDef.getNoOfOperations() > 0);
+  // Check for online upgrade/downgrade.
+  if (unlikely(!ndb_join_pushdown(trans.getNdb()->getMinDbNodeVersion())))
+  {
+    trans.setOperationErrorCodeAbort(Err_FunctionNotImplemented);
+    return NULL;
+  }
   NdbQueryImpl* const query = new NdbQueryImpl(trans, queryDef);
   if (unlikely(query==NULL)) {
     trans.setOperationErrorCodeAbort(Err_MemoryAlloc);

=== modified file 'storage/ndb/test/ndbapi/testSpj.cpp'
--- a/storage/ndb/test/ndbapi/testSpj.cpp	2011-09-14 10:30:08 +0000
+++ b/storage/ndb/test/ndbapi/testSpj.cpp	2012-09-13 08:05:29 +0000
@@ -26,6 +26,7 @@
 #include <HugoQueryBuilder.hpp>
 #include <HugoQueries.hpp>
 #include <NdbSchemaCon.hpp>
+#include <ndb_version.h>
 
 int
 runLoadTable(NDBT_Context* ctx, NDBT_Step* step)
@@ -389,6 +390,7 @@ createNegativeSchema(NDBT_Context* ctx,
 #define QRY_EMPTY_PROJECTION 4826
 
 /* Various error codes that are not specific to NdbQuery. */
+static const int Err_FunctionNotImplemented = 4003;
 static const int Err_UnknownColumn = 4004;
 static const int Err_WrongFieldLength = 4209;
 static const int Err_InvalidRangeNo = 4286;
@@ -414,6 +416,9 @@ public:
   static int valueTest(NDBT_Context* ctx, NDBT_Step* step)
   { return NegativeTest(ctx, step).runValueTest();}
 
+  static int featureDisabledTest(NDBT_Context* ctx, NDBT_Step* step)
+  { return NegativeTest(ctx, step).runFeatureDisabledTest();}
+
 private:
   Ndb* m_ndb;
   NdbDictionary::Dictionary* m_dictionary;
@@ -431,6 +436,7 @@ private:
   int runGraphTest() const;
   int runSetBoundTest() const;
   int runValueTest() const;
+  int runFeatureDisabledTest() const;
   // No copy.
   NegativeTest(const NegativeTest&);
   NegativeTest& operator=(const NegativeTest&);
@@ -1176,6 +1182,61 @@ NegativeTest::runValueTest() const
   return NDBT_OK;
 } // NegativeTest::runValueBoundTest()
 
+/**
+ * Check that query pushdown is disabled in older versions of the code
+ * (even if the API extensions are present in the code).
+ */
+int
+NegativeTest::runFeatureDisabledTest() const
+{
+  NdbQueryBuilder* const builder = NdbQueryBuilder::create();
+  
+  const NdbQueryTableScanOperationDef* const parentOperation
+    = builder->scanTable(m_nt1Tab);
+  
+  int result = NDBT_OK;
+
+  if (ndb_join_pushdown(ndbGetOwnVersion()))
+  {
+    if (parentOperation == NULL)
+    {
+      g_err << "scanTable() failed: " << builder->getNdbError()
+            << endl;
+      result = NDBT_FAILED;
+    }
+    else
+    {
+      g_info << "scanTable() succeeded in version "
+             << ndbGetOwnVersionString() << " as expected." << endl;
+    }
+  }
+  else
+  {
+    // Query pushdown should not be enabled in this version.
+    if (parentOperation != NULL)
+    {
+      g_err << "Succeeded with creating scan operation, which should not be "
+        "possible in version " << ndbGetOwnVersionString() << endl;
+      result = NDBT_FAILED;      
+    }
+    else if (builder->getNdbError().code != Err_FunctionNotImplemented)
+    {
+      g_err << "scanTable() failed with unexpected error: " 
+            << builder->getNdbError() << endl;
+      result = NDBT_FAILED;
+    }
+    else
+    {
+      g_info << "scanTable() failed in version "
+             << ndbGetOwnVersionString() << " as expected with error: " 
+             << builder->getNdbError() << endl;
+    }
+  }
+
+  builder->destroy();
+  return result;
+} // NegativeTest::runFeatureDisabledTest()
+
 static int
 dropNegativeSchema(NDBT_Context* ctx, NDBT_Step* step)
 {
@@ -1204,6 +1265,11 @@ TESTCASE("NegativeJoin", ""){
   INITIALIZER(NegativeTest::valueTest);
   FINALIZER(dropNegativeSchema);
 }
+TESTCASE("FeatureDisabled", ""){
+  INITIALIZER(createNegativeSchema);
+  INITIALIZER(NegativeTest::featureDisabledTest);
+  FINALIZER(dropNegativeSchema);
+}
 TESTCASE("LookupJoin", ""){
   INITIALIZER(runLoadTable);
   STEP(runLookupJoin);

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2012-09-12 14:18:33 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2012-09-13 08:05:29 +0000
@@ -135,15 +135,7 @@ args: -n DeleteRead
 
 max-time: 500
 cmd: testSpj
-args: -n LookupJoin
-
-max-time: 500
-cmd: testSpj
-args: -n ScanJoin
-
-max-time: 500
-cmd: testSpj
-args: -n MixedJoin
+args: -n FeatureDisabled T1
 
 max-time: 500
 cmd: testBasic
@@ -739,10 +731,6 @@ max-time: 2500
 cmd: testIndex
 args: -n NFNR2_O T6 T13 
 
-max-time: 2500
-cmd: testSpj
-args: -n NF_Join T6 T13
-
 #
 # DICT TESTS
 max-time: 500

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.1 branch (jan.wedvik:4601 to 4602) Jan Wedvik13 Sep