3988 Jan Wedvik 2012-09-13 [merge]
Merge 7.1->7.2
modified:
storage/ndb/src/ndbapi/NdbQueryBuilder.cpp
storage/ndb/test/ndbapi/testSpj.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
3987 Frazer Clement 2012-09-12 [merge]
Merge 7.1->7.2
modified:
sql/ha_ndb_index_stat.cc
sql/ha_ndb_index_stat.h
storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp
storage/ndb/include/util/NdbOut.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/src/mgmapi/LocalConfig.cpp
storage/ndb/src/mgmapi/LocalConfig.hpp
storage/ndb/test/include/NDBT_Stats.hpp
storage/ndb/test/ndbapi/testRedo.cpp
storage/ndb/test/ndbapi/testScan.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilder.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2012-05-08 08:03:29 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilder.cpp 2012-09-13 08:36:35 +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;
@@ -702,7 +703,21 @@ NdbQueryOperationDef::getIndex() const
NdbQueryBuilder* NdbQueryBuilder::create()
{
NdbQueryBuilderImpl* const impl = new NdbQueryBuilderImpl();
- return (likely(impl!=NULL)) ? &impl->m_interface : NULL;
+ if (likely (impl != NULL))
+ {
+ 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
+ {
+ return NULL;
+ }
}
void NdbQueryBuilder::destroy()
=== modified file 'storage/ndb/test/ndbapi/testSpj.cpp'
--- a/storage/ndb/test/ndbapi/testSpj.cpp 2012-09-07 15:52:18 +0000
+++ b/storage/ndb/test/ndbapi/testSpj.cpp 2012-09-13 08:36:35 +0000
@@ -26,6 +26,7 @@
#include <HugoQueryBuilder.hpp>
#include <HugoQueries.hpp>
#include <NdbSchemaCon.hpp>
+#include <ndb_version.h>
static int faultToInject = 0;
@@ -535,6 +536,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;
@@ -560,6 +562,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;
@@ -577,6 +582,7 @@ private:
int runGraphTest() const;
int runSetBoundTest() const;
int runValueTest() const;
+ int runFeatureDisabledTest() const;
// No copy.
NegativeTest(const NegativeTest&);
NegativeTest& operator=(const NegativeTest&);
@@ -1296,6 +1302,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)
{
@@ -1324,6 +1385,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 15:11:40 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2012-09-13 08:36:35 +0000
@@ -146,6 +146,10 @@ cmd: testSpj
args: -n MixedJoin
max-time: 500
+cmd: testSpj
+args: -n FeatureDisabled T1
+
+max-time: 500
cmd: testBasic
args: -n PkReadAndLocker T6 D1 D2
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster-7.2 branch (jan.wedvik:3987 to 3988) | Jan Wedvik | 13 Sep |