enabled setting version for ndb

parent 7ffe3ce6
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <ndb_version.h> #include <ndb_version.h>
#include <version.h> #include <version.h>
#include <NdbEnv.h>
#include <NdbOut.hpp>
Uint32 getMajor(Uint32 version) { Uint32 getMajor(Uint32 version) {
return (version >> 16) & 0xFF; return (version >> 16) & 0xFF;
...@@ -67,6 +69,24 @@ struct NdbUpGradeCompatible { ...@@ -67,6 +69,24 @@ struct NdbUpGradeCompatible {
/*#define TEST_VERSION*/ /*#define TEST_VERSION*/
#define HAVE_NDB_SETVERSION
#ifdef HAVE_NDB_SETVERSION
Uint32 ndbOwnVersionTesting = 0;
void
ndbSetOwnVersion() {
char buf[256];
if (NdbEnv_GetEnv("NDB_SETVERSION", buf, sizeof(buf))) {
Uint32 _v1,_v2,_v3;
if (sscanf(buf, "%u.%u.%u", &_v1, &_v2, &_v3) == 3) {
ndbOwnVersionTesting = MAKE_VERSION(_v1,_v2,_v3);
ndbout_c("Testing: Version set to 0x%x", ndbOwnVersionTesting);
}
}
}
#else
void ndbSetOwnVersion() {}
#endif
#ifndef TEST_VERSION #ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact }, { MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
...@@ -79,8 +99,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { ...@@ -79,8 +99,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
{ 0, 0, UG_Null } { 0, 0, UG_Null }
}; };
void ndbSetOwnVersion() {}
#else /* testing purposes */ #else /* testing purposes */
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
...@@ -101,19 +119,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { ...@@ -101,19 +119,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
}; };
Uint32 ndbOwnVersionTesting = 0;
void
ndbSetOwnVersion() {
char buf[256];
if (NdbEnv_GetEnv("NDB_SETVERSION", buf, sizeof(buf))) {
Uint32 _v1,_v2,_v3;
if (sscanf(buf, "%u.%u.%u", &_v1, &_v2, &_v3) == 3) {
ndbOwnVersionTesting = MAKE_VERSION(_v1,_v2,_v3);
ndbout_c("Testing: Version set to 0x%x", ndbOwnVersionTesting);
}
}
}
#endif #endif
void ndbPrintVersion() void ndbPrintVersion()
...@@ -127,13 +132,13 @@ void ndbPrintVersion() ...@@ -127,13 +132,13 @@ void ndbPrintVersion()
Uint32 Uint32
ndbGetOwnVersion() ndbGetOwnVersion()
{ {
#ifndef TEST_VERSION #ifdef HAVE_NDB_SETVERSION
return NDB_VERSION_D;
#else /* testing purposes */
if (ndbOwnVersionTesting == 0) if (ndbOwnVersionTesting == 0)
return NDB_VERSION_D; return NDB_VERSION_D;
else else
return ndbOwnVersionTesting; return ndbOwnVersionTesting;
#else
return NDB_VERSION_D;
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment