enabled setting version for ndb

parent 7ffe3ce6
......@@ -17,6 +17,8 @@
#include <ndb_global.h>
#include <ndb_version.h>
#include <version.h>
#include <NdbEnv.h>
#include <NdbOut.hpp>
Uint32 getMajor(Uint32 version) {
return (version >> 16) & 0xFF;
......@@ -67,6 +69,24 @@ struct NdbUpGradeCompatible {
/*#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
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
......@@ -79,8 +99,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
{ 0, 0, UG_Null }
};
void ndbSetOwnVersion() {}
#else /* testing purposes */
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
......@@ -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
void ndbPrintVersion()
......@@ -127,13 +132,13 @@ void ndbPrintVersion()
Uint32
ndbGetOwnVersion()
{
#ifndef TEST_VERSION
return NDB_VERSION_D;
#else /* testing purposes */
#ifdef HAVE_NDB_SETVERSION
if (ndbOwnVersionTesting == 0)
return NDB_VERSION_D;
else
return ndbOwnVersionTesting;
#else
return NDB_VERSION_D;
#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