5049 Jonas Oreland 2012-12-10
fixes - commit for autotest - attempt 5 - this time including (hopefully) functional upgrade\!
modified:
storage/ndb/include/ndb_version.h.in
storage/ndb/include/util/ConfigValues.hpp
storage/ndb/src/common/util/ConfigValues.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/vm/FixedArray.hpp
storage/ndb/src/kernel/vm/PreallocPool.hpp
storage/ndb/src/mgmsrv/Config.cpp
storage/ndb/src/mgmsrv/Config.hpp
storage/ndb/src/mgmsrv/ConfigInfo.cpp
storage/ndb/src/mgmsrv/ConfigInfo.hpp
storage/ndb/src/mgmsrv/ConfigManager.cpp
storage/ndb/src/mgmsrv/ConfigManager.hpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
storage/ndb/src/mgmsrv/Services.cpp
5048 Jonas Oreland 2012-12-05
fixes - commit for autotest - attempt 4
modified:
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/test/ndbapi/testDict.cpp
=== modified file 'storage/ndb/include/ndb_version.h.in'
--- a/storage/ndb/include/ndb_version.h.in 2012-08-24 11:46:00 +0000
+++ b/storage/ndb/include/ndb_version.h.in 2012-12-10 09:10:08 +0000
@@ -809,4 +809,31 @@ ndb_join_pushdown(Uint32 x)
return x >= NDBD_JOIN_PUSHDOWN;
}
+/**
+ * From this version, a ndb_mgm_get_config() does not
+ * include deprecated variables
+ */
+#define NDB_GET_CONFIG_EXCLUDES_DEPRECATED_70 NDB_MAKE_VERSION(7,0,37)
+#define NDB_GET_CONFIG_EXCLUDES_DEPRECATED_71 NDB_MAKE_VERSION(7,1,26)
+#define NDB_GET_CONFIG_EXCLUDES_DEPRECATED_72 NDB_MAKE_VERSION(7,2,10)
+
+static
+inline
+int
+ndb_get_config_excludes_deprecated(Uint32 x)
+{
+ const Uint32 major = (x >> 16) & 0xFF;
+ const Uint32 minor = (x >> 8) & 0xFF;
+
+ if (major == 7 && minor < 2)
+ {
+ if (minor == 0)
+ return x >= NDB_GET_CONFIG_EXCLUDES_DEPRECATED_70;
+ else if (minor == 1)
+ return x >= NDB_GET_CONFIG_EXCLUDES_DEPRECATED_71;
+ }
+ return x >= NDB_GET_CONFIG_EXCLUDES_DEPRECATED_72;
+}
+
+
#endif
=== modified file 'storage/ndb/include/util/ConfigValues.hpp'
--- a/storage/ndb/include/util/ConfigValues.hpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/include/util/ConfigValues.hpp 2012-12-10 09:10:08 +0000
@@ -119,11 +119,12 @@ public:
ConfigValues * m_cfg;
ConfigValues * getConfigValues();
- bool openSection(Uint32 key, Uint32 no);
+ bool openSection(Uint32 key, Uint32 no, bool create_if_not_exists = true);
bool put(const ConfigValues::Entry & );
bool put(Uint32 key, Uint32 value);
bool put64(Uint32 key, Uint64 value);
bool put(Uint32 key, const char * value);
+ bool get(Uint32 key, Uint32 * value);
bool closeSection();
void expand(Uint32 freeKeys, Uint32 freeData);
=== modified file 'storage/ndb/src/common/util/ConfigValues.cpp'
--- a/storage/ndb/src/common/util/ConfigValues.cpp 2011-10-21 08:59:23 +0000
+++ b/storage/ndb/src/common/util/ConfigValues.cpp 2012-12-10 09:10:08 +0000
@@ -365,7 +365,8 @@ ConfigValuesFactory::shrink(){
}
bool
-ConfigValuesFactory::openSection(Uint32 key, Uint32 no){
+ConfigValuesFactory::openSection(Uint32 key, Uint32 no,
+ bool create_if_not_exists){
ConfigValues::Entry tmp;
const Uint32 parent = m_currentSection;
@@ -373,6 +374,9 @@ ConfigValuesFactory::openSection(Uint32
iter.m_currentSection = m_currentSection;
if(!iter.get(key, &tmp)){
+ if (create_if_not_exists == false)
+ return false;
+
tmp.m_key = key;
tmp.m_type = ConfigValues::SectionType;
tmp.m_int = m_sectionCounter;
@@ -382,29 +386,68 @@ ConfigValuesFactory::openSection(Uint32
return false;
}
}
+ else
+ {
+ if (! (tmp.m_type == ConfigValues::SectionType))
+ {
+ return false;
+ }
+ }
- if(tmp.m_type != ConfigValues::SectionType){
- return false;
+ iter.m_currentSection = m_currentSection = tmp.m_int;
+
+ if (!iter.get(no, &tmp))
+ {
+ if (create_if_not_exists == false)
+ {
+ m_currentSection = parent;
+ return false;
+ }
+
+ tmp.m_key = no;
+ tmp.m_type = ConfigValues::IntType;
+ tmp.m_int = m_sectionCounter;
+ if (!put(tmp)){
+ m_currentSection = parent;
+ return false;
+ }
+ m_sectionCounter += (1 << KP_SECTION_SHIFT);
+ }
+ else
+ {
+ if (! (tmp.m_type == ConfigValues::IntType)) {
+ m_currentSection = parent;
+ return false;
+ }
}
- m_currentSection = tmp.m_int;
+ iter.m_currentSection = m_currentSection = tmp.m_int;
- tmp.m_key = no;
- tmp.m_type = ConfigValues::IntType;
- tmp.m_int = m_sectionCounter;
- if(!put(tmp)){
- m_currentSection = parent;
- return false;
+ if (!iter.get(CFV_KEY_PARENT, &tmp))
+ {
+ if (create_if_not_exists == false)
+ {
+ m_currentSection = parent;
+ return false;
+ }
+
+ tmp.m_type = ConfigValues::IntType;
+ tmp.m_key = CFV_KEY_PARENT;
+ tmp.m_int = parent;
+ if(!put(tmp))
+ {
+ m_currentSection = parent;
+ return false;
+ }
}
- m_sectionCounter += (1 << KP_SECTION_SHIFT);
-
- m_currentSection = tmp.m_int;
- tmp.m_type = ConfigValues::IntType;
- tmp.m_key = CFV_KEY_PARENT;
- tmp.m_int = parent;
- if(!put(tmp)){
- m_currentSection = parent;
- return false;
+ else
+ {
+ if (! (tmp.m_type == ConfigValues::IntType &&
+ tmp.m_int == parent))
+ {
+ m_currentSection = parent;
+ return false;
+ }
}
return true;
@@ -522,6 +565,14 @@ ConfigValuesFactory::put(const ConfigVal
return false;
}
+bool
+ConfigValuesFactory::get(Uint32 key, Uint32 * val) {
+
+ ConfigValues::ConstIterator iter(* m_cfg);
+ iter.m_currentSection = m_currentSection;
+ return iter.get(key, val);
+}
+
void
ConfigValuesFactory::put(const ConfigValues & cfg){
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2012-11-29 14:04:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2012-12-10 09:10:08 +0000
@@ -6128,8 +6128,8 @@ Dbdict::createTable_prepare(Signal* sign
createTabPtr.p->m_blockIndex = 0;
createTabPtr.p->m_block[0].init(DBLQH);
createTabPtr.p->m_block[1].init(DBDIH);
- createTabPtr.p->m_block[2].init(DBSPJ);
- createTabPtr.p->m_block[3].init(BACKUP);
+ createTabPtr.p->m_block[2].init(BACKUP);
+ createTabPtr.p->m_block[3].init(DBSPJ);
createTabPtr.p->m_block[4].init(SUMA);
createTabPtr.p->m_block[5].init(DBTC);
createTabPtr.p->m_block[6].init(RNIL); // eof
@@ -6388,26 +6388,33 @@ Dbdict::createTab_prepare_fromLocal(Sign
Uint32 pos = createTabPtr.p->m_blockIndex;
Uint32 blockNo = createTabPtr.p->m_block[pos].m_blockNo;
- if (blockNo == SUMA && createTabPtr.p->m_gsn == GSN_TAB_COMMITREQ)
- {
- jam();
- /**
- * Wait with commit SUMA/TC until createTable_commit
- */
- createTabPtr.p->m_gsn = RNIL;
- sendTransConf(signal, op_ptr);
- return;
- }
-
if (blockNo == RNIL)
{
jam();
- ndbrequire(createTabPtr.p->m_gsn == GSN_CREATE_TAB_REQ);
- /**
- * During prepare we also commit towards all blocks except SUMA/DBTC
- */
- createTabPtr.p->m_gsn = GSN_TAB_COMMITREQ;
- createTabPtr.p->m_blockIndex = 0;
+ if (createTabPtr.p->m_gsn == GSN_TAB_COMMITREQ)
+ {
+ jam();
+ /**
+ * Wait with commit DIH/SUMA/TC until createTable_commit
+ */
+ createTabPtr.p->m_gsn = RNIL;
+ sendTransConf(signal, op_ptr);
+ return;
+ }
+ else
+ {
+ jam();
+ ndbrequire(createTabPtr.p->m_gsn == GSN_CREATE_TAB_REQ);
+ /**
+ * During prepare we also commit towards all blocks except DIH/SUMA/TC
+ */
+ createTabPtr.p->m_gsn = GSN_TAB_COMMITREQ;
+ createTabPtr.p->m_blockIndex = 0;
+ createTabPtr.p->m_block[0].init(DBLQH);
+ createTabPtr.p->m_block[1].init(DBSPJ);
+ createTabPtr.p->m_block[2].init(BACKUP);
+ createTabPtr.p->m_block[3].init(RNIL); // eof
+ }
}
createTab_toLocal(signal, op_ptr);
@@ -6918,9 +6925,10 @@ Dbdict::createTable_commit(Signal* signa
createTabPtr.p->m_gsn = GSN_TAB_COMMITREQ;
createTabPtr.p->m_blockIndex = 0;
- createTabPtr.p->m_block[0].init(SUMA);
- createTabPtr.p->m_block[1].init(DBTC);
- createTabPtr.p->m_block[2].init(RNIL);
+ createTabPtr.p->m_block[0].init(DBDIH);
+ createTabPtr.p->m_block[1].init(SUMA);
+ createTabPtr.p->m_block[2].init(DBTC);
+ createTabPtr.p->m_block[3].init(RNIL);
createTab_toLocal(signal, op_ptr);
}
@@ -7008,6 +7016,13 @@ Dbdict::createTable_abortPrepare(Signal*
*
* Run abort on all of them...i.e set index on max position
*/
+ createTabPtr.p->m_block[0].init(DBLQH);
+ createTabPtr.p->m_block[1].init(DBSPJ);
+ createTabPtr.p->m_block[2].init(BACKUP);
+ createTabPtr.p->m_block[3].init(DBDIH);
+ createTabPtr.p->m_block[4].init(SUMA);
+ createTabPtr.p->m_block[5].init(DBTC);
+ createTabPtr.p->m_block[6].init(RNIL); // eof
createTabPtr.p->m_blockIndex = NDB_ARRAY_SIZE(createTabPtr.p->m_block);
}
else
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2012-12-05 13:33:36 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2012-12-10 09:10:08 +0000
@@ -9667,7 +9667,13 @@ void Dbdih::execDIH_SCAN_TAB_REQ(Signal*
if (tabPtr.p->tabStatus != TabRecord::TS_ACTIVE)
{
- if (! (tabPtr.p->tabStatus == TabRecord::TS_CREATING &&
+ if (! (tabPtr.p->tabStatus == TabRecord::TS_CREATING))
+ {
+ jam();
+ goto error;
+ }
+
+ if (! (refToMain(senderRef) == SUMA ||
tabPtr.p->schemaTransId == schemaTransId))
{
jam();
=== modified file 'storage/ndb/src/kernel/vm/FixedArray.hpp'
--- a/storage/ndb/src/kernel/vm/FixedArray.hpp 2012-11-22 13:24:38 +0000
+++ b/storage/ndb/src/kernel/vm/FixedArray.hpp 2012-12-10 09:10:08 +0000
@@ -89,7 +89,7 @@ public:
if (likely(m_head.m_cnt < MaxSize))
{
Uint32 pos = m_head.m_cnt / ChunkSize;
- Uint32 idx = m_head.m_cnt - pos;
+ Uint32 idx = m_head.m_cnt % ChunkSize;
Ptr<Chunk> chunkPtr;
chunkPtr.i = m_head.m_chunk_ptr[pos];
if (chunkPtr.i == RNIL)
@@ -140,7 +140,7 @@ public:
if (likely(i == m_head.m_cnt))
{
Uint32 pos = i / ChunkSize;
- Uint32 idx = i - pos;
+ Uint32 idx = i % ChunkSize;
if (idx == 0)
{
m_pool.release(m_head.m_chunk_ptr[pos]);
@@ -159,7 +159,7 @@ public:
if (likely(i < MaxSize))
{
Uint32 pos = i / ChunkSize;
- Uint32 idx = i - pos;
+ Uint32 idx = i % ChunkSize;
Chunk * chunkPtrP = m_pool.getPtr(m_head.m_chunk_ptr[pos]);
return chunkPtrP->m_chunk + idx;
}
=== modified file 'storage/ndb/src/kernel/vm/PreallocPool.hpp'
--- a/storage/ndb/src/kernel/vm/PreallocPool.hpp 2012-11-22 13:24:38 +0000
+++ b/storage/ndb/src/kernel/vm/PreallocPool.hpp 2012-12-10 09:10:08 +0000
@@ -131,7 +131,7 @@ public:
T* getPtr(Uint32 i)
{
- return m_free_list.getPtr(i);
+ return P::getPtr(i);
}
void getPtr(Ptr<T>& p, Uint32 i)
=== modified file 'storage/ndb/src/mgmsrv/Config.cpp'
--- a/storage/ndb/src/mgmsrv/Config.cpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/mgmsrv/Config.cpp 2012-12-10 09:10:08 +0000
@@ -84,7 +84,7 @@ Config::print(const char* section_filter
section,
section_type);
- const char* section_name= g_info.sectionName(section, section_type);
+ const char* section_name= g_info.getSectionName(section, section_type);
// Section name filter
if (section_filter && // Filter is on
@@ -422,7 +422,7 @@ diff_nodes(const Config* a, const Config
Uint32 nodeType;
require(itA.get(CFG_TYPE_OF_SECTION, &nodeType) == 0);
- BaseString name(g_info.sectionName(CFG_SECTION_NODE, nodeType));
+ BaseString name(g_info.getSectionName(CFG_SECTION_NODE, nodeType));
/* Get NodeId which is "primary key" */
Uint32 nodeId;
@@ -508,7 +508,8 @@ diff_connections(const Config* a, const
Uint32 connectionType;
require(itA.get(CFG_TYPE_OF_SECTION, &connectionType) == 0);
- BaseString name(g_info.sectionName(CFG_SECTION_CONNECTION, connectionType));
+ BaseString name(g_info.getSectionName(CFG_SECTION_CONNECTION,
+ connectionType));
/* Get NodeId1 and NodeId2 which is "primary key" */
Uint32 nodeId1_A, nodeId2_A;
@@ -833,3 +834,11 @@ Config::checksum(void) const {
return chk;
}
+void
+Config::populatedDeprecatedSettings()
+{
+ ConfigValuesFactory newcfg(&m_configValues->m_config);
+ g_info.populateDeprecatedDefaults(newcfg);
+ m_configValues = (struct ndb_mgm_configuration*)newcfg.getConfigValues();
+}
+
=== modified file 'storage/ndb/src/mgmsrv/Config.hpp'
--- a/storage/ndb/src/mgmsrv/Config.hpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/mgmsrv/Config.hpp 2012-12-10 09:10:08 +0000
@@ -136,6 +136,13 @@ public:
struct ndb_mgm_configuration * m_configValues;
struct ndb_mgm_configuration * values(void) const { return m_configValues; };
+
+ /**
+ * Populate this config with old deprecated settings so that
+ * older nodes can carry on...
+ */
+ void populatedDeprecatedSettings();
+
private:
bool setValue(Uint32 section, Uint32 section_no,
Uint32 id, Uint32 new_val);
=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2012-11-22 13:24:38 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2012-12-10 09:10:08 +0000
@@ -527,7 +527,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "1000",
"32",
STR_VALUE(MAX_INT_RNIL) },
@@ -539,7 +539,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "128",
"8",
STR_VALUE(NDB_MAX_TABLES) },
@@ -551,7 +551,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "128",
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -563,7 +563,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "64",
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -576,7 +576,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "128",
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -601,7 +601,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "768",
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -613,7 +613,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "4000",
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -818,7 +818,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ STR_VALUE(DEF_BATCH_SIZE),
"1",
STR_VALUE(MAX_PARALLEL_OP_PER_SCAN) },
@@ -842,7 +842,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "256",
"2",
"500" },
@@ -854,7 +854,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "1M",
"1K",
STR_VALUE(MAX_INT_RNIL) },
@@ -1601,7 +1601,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
ConfigInfo::CI_DEPRECATED,
false,
ConfigInfo::CI_INT,
- 0,
+ "25",
"0",
STR_VALUE(MAX_INT_RNIL) },
@@ -3707,7 +3707,10 @@ ConfigInfo::getAlias(const char * sectio
}
const char*
-ConfigInfo::sectionName(Uint32 section_type, Uint32 type) const {
+ConfigInfo::getSectionName(Uint32 section_type,
+ Uint32 type,
+ bool print) const
+{
switch (section_type){
case CFG_SECTION_SYSTEM:
@@ -3717,13 +3720,13 @@ ConfigInfo::sectionName(Uint32 section_t
case CFG_SECTION_NODE:
switch(type){
case NODE_TYPE_DB:
- return DB_TOKEN_PRINT;
+ return print ? DB_TOKEN_PRINT : DB_TOKEN;
break;
case NODE_TYPE_MGM:
- return MGM_TOKEN_PRINT;
+ return print ? MGM_TOKEN_PRINT : MGM_TOKEN;
break;
case NODE_TYPE_API:
- return API_TOKEN_PRINT;
+ return print ? API_TOKEN_PRINT : API_TOKEN;
break;
default:
assert(false);
@@ -3756,6 +3759,7 @@ ConfigInfo::sectionName(Uint32 section_t
return "<unknown section>";
}
+
const ConfigInfo::AliasPair
section2PrimaryKeys[]={
{API_TOKEN, "NodeId"},
@@ -4461,14 +4465,20 @@ transformComputer(InitConfigFileParser::
*/
void
applyDefaultValues(InitConfigFileParser::Context & ctx,
- const Properties * defaults)
+ const Properties * defaults,
+ bool skipDeprecated)
{
DBUG_ENTER("applyDefaultValues");
if(defaults != NULL){
Properties::Iterator it(defaults);
for(const char * name = it.first(); name != NULL; name = it.next()){
- (void) ctx.m_info->getStatus(ctx.m_currentInfo, name);
+ if (skipDeprecated)
+ {
+ Uint32 status = ctx.m_info->getStatus(ctx.m_currentInfo, name);
+ if (status == ConfigInfo::CI_DEPRECATED)
+ continue;
+ }
if(!ctx.m_currentSection->contains(name)){
switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
case ConfigInfo::CI_ENUM:
@@ -4538,9 +4548,9 @@ bool
applyDefaultValues(InitConfigFileParser::Context & ctx, const char * data){
if(strcmp(data, "user") == 0)
- applyDefaultValues(ctx, ctx.m_userDefaults);
+ applyDefaultValues(ctx, ctx.m_userDefaults, /* skip deprecated */ false);
else if (strcmp(data, "system") == 0)
- applyDefaultValues(ctx, ctx.m_systemDefaults);
+ applyDefaultValues(ctx, ctx.m_systemDefaults, /* skip deprecated */ true);
else
return false;
@@ -6026,6 +6036,98 @@ saveSectionsInConfigValues(Vector<Config
return true;
}
+void
+ConfigInfo::populateDeprecatedDefaults(ConfigValuesFactory & cfg) const
+{
+ /**
+ * Iterate through each section...
+ * check if the deprecated values are there...
+ * if not, put the default in
+ */
+ Uint32 sections[] = {
+ CFG_SECTION_CONNECTION,
+ CFG_SECTION_NODE,
+ CFG_SECTION_SYSTEM,
+ 0 // end
+ };
+
+ for (Uint32 s = 0; sections[s] != 0; s++)
+ {
+ for (Uint32 i = 0; ; i++)
+ {
+ const bool create_if_not_exists = false;
+ if (!cfg.openSection(sections[s], i, create_if_not_exists))
+ {
+ break;
+ }
+
+ Uint32 typeVal = 0;
+ require(cfg.get(CFG_TYPE_OF_SECTION, &typeVal));
+ const char * sectionname = getSectionName(sections[s], typeVal, false);
+
+ const Properties * p = getDefaults(sectionname);
+ const Properties * i = getInfo(sectionname);
+
+ Properties::Iterator it(p);
+ for (const char * name = it.first(); name != NULL; name = it.next())
+ {
+ PropertiesType type;
+ require(p->getTypeOf(name, &type));
+
+ const Properties * info;
+ require(i->get(name, &info));
+
+ Uint32 id = 0;
+ require(info->get("Id", &id));
+
+ Uint32 status = ConfigInfo::CI_DEPRECATED;
+ require(info->get("Status", &status));
+ if (status != ConfigInfo::CI_DEPRECATED)
+ continue;
+
+ bool res = false;
+ switch(type){
+ case PropertiesType_Uint32:{
+ Uint32 val;
+ require(p->get(name, &val));
+ res = cfg.put(id, val);
+ break;
+ }
+ case PropertiesType_char:{
+ const char * val;
+ require(p->get(name, &val));
+ res = cfg.put(id, val);
+ break;
+ }
+ case PropertiesType_Uint64:{
+ Uint64 val;
+ require(p->get(name, &val));
+ res = cfg.put64(id, val);
+ break;
+ }
+ case PropertiesType_Properties:
+ default:
+ require(false);
+ }
+
+ if (res)
+ {
+ /**
+ * The deprecated default was added...
+ */
+ }
+ else
+ {
+ /**
+ * The deprecated default was already present...
+ * i.e user had set a value...
+ */
+ }
+ }
+ cfg.closeSection();
+ }
+ }
+}
template class Vector<ConfigInfo::ConfigRuleSection>;
#endif /* NDB_MGMAPI */
=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.hpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.hpp 2012-12-10 09:10:08 +0000
@@ -219,7 +219,8 @@ public:
const Properties * getInfo(const char * section) const;
const Properties * getDefaults(const char * section) const;
- const char* sectionName(Uint32 section_type, Uint32 type) const;
+ const char* getSectionName(Uint32 section_type, Uint32 type,
+ bool print = true) const;
void print(const char* section= NULL) const;
void print_xml(const char* section= NULL) const;
@@ -245,6 +246,9 @@ public:
static const ConfigRule m_ConfigRules[];
static const int m_NoOfRules;
#endif /* NDB_MGMAPI */
+
+public:
+ void populateDeprecatedDefaults(class ConfigValuesFactory&) const;
};
#endif // ConfigInfo_H
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp 2012-03-21 15:14:51 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp 2012-12-10 09:10:08 +0000
@@ -2256,7 +2256,10 @@ ConfigManager::load_saved_config(const B
bool
ConfigManager::get_packed_config(ndb_mgm_node_type nodetype,
- BaseString* buf64, BaseString& error)
+ BaseString* buf64,
+ BaseString& error,
+ bool include_deprecated,
+ Uint32 version)
{
Guard g(m_config_mutex);
@@ -2304,7 +2307,34 @@ ConfigManager::get_packed_config(ndb_mgm
require(m_config != 0);
if (buf64)
{
- if (!m_packed_config.length())
+ if (include_deprecated ||
+ (version != 0 && !ndb_get_config_excludes_deprecated(version)))
+ {
+ /**
+ * An older client want to get config...
+ * make sure deprecated values are filled in...
+ * NOTE: don't cache this config (in m_packed_config)
+ */
+ Config config_copy(m_config);
+ if (!m_dynamic_ports.set_in_config(&config_copy))
+ {
+ error.assign("get_packed_config,failed to set dynamic ports in config");
+ return false;
+ }
+
+ /**
+ * Do the nasty thing...put in the deprecated values...
+ */
+ config_copy.populatedDeprecatedSettings();
+
+ if (!config_copy.pack64(* buf64))
+ {
+ error.assign("get_packed_config, failed to pack config_copy");
+ return false;
+ }
+ return true;
+ }
+ else if (!m_packed_config.length())
{
// No packed config exist, generate a new one
Config config_copy(m_config);
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.hpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.hpp 2012-12-10 09:10:08 +0000
@@ -250,7 +250,9 @@ public:
Retrieve the current configuration in base64 packed format
*/
bool get_packed_config(ndb_mgm_node_type nodetype,
- BaseString * buf64, BaseString& error);
+ BaseString * buf64, BaseString& error,
+ bool include_deprecated,
+ Uint32 version);
static Config* load_config(const char* config_filename, bool mycnf,
BaseString& msg);
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2012-06-26 13:03:52 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2012-12-10 09:10:08 +0000
@@ -773,9 +773,13 @@ MgmtSrvr::config_changed(NodeId node_id,
bool
MgmtSrvr::get_packed_config(ndb_mgm_node_type node_type,
- BaseString& buf64, BaseString& error)
+ BaseString& buf64,
+ bool include_deprecated,
+ Uint32 version,
+ BaseString& error)
{
- return m_config_manager->get_packed_config(node_type, &buf64, error);
+ return m_config_manager->get_packed_config(node_type, &buf64, error,
+ include_deprecated, version);
}
bool
@@ -3619,7 +3623,8 @@ MgmtSrvr::alloc_node_id_impl(NodeId& nod
{
Uint64 stop = NdbTick_CurrentMillisecond() + timeout_ms;
BaseString getconfig_message;
- while (!m_config_manager->get_packed_config(type, 0, getconfig_message))
+ while (!m_config_manager->get_packed_config(type, 0, getconfig_message,
+ false, 0))
{
if (NdbTick_CurrentMillisecond() > stop)
{
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2012-06-26 13:03:52 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2012-12-10 09:10:08 +0000
@@ -443,7 +443,10 @@ private:
public:
/* Get copy of configuration packed with base64 */
bool get_packed_config(ndb_mgm_node_type nodetype,
- BaseString& buf64, BaseString& error);
+ BaseString& buf64,
+ bool include_deprecated,
+ Uint32 version,
+ BaseString& error);
/* Get copy of configuration packed with base64 from node nodeid */
bool get_packed_config_from_node(NodeId nodeid,
=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp 2011-12-02 07:16:03 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp 2012-12-10 09:10:08 +0000
@@ -566,9 +566,13 @@ MgmApiSession::getConfig(Parser_t::Conte
{
Uint32 nodetype = NDB_MGM_NODE_TYPE_UNKNOWN;
Uint32 from_node = 0;
+ Uint32 version = 0;
+
+ // TODO make such argument...now only determined by looking at version
+ bool include_deprecated = false;
- // Ignoring mandatory parameter "version"
// Ignoring optional parameter "node"
+ args.get("version", &version);
args.get("nodetype", &nodetype);
args.get("from_node", &from_node);
@@ -583,7 +587,8 @@ MgmApiSession::getConfig(Parser_t::Conte
m_mgmsrv.get_packed_config_from_node(from_node,
pack64, error) :
m_mgmsrv.get_packed_config((ndb_mgm_node_type)nodetype,
- pack64, error);
+ pack64, include_deprecated,
+ version, error);
if (!success)
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:5048 to 5049) | Jonas Oreland | 10 Dec |