#At file:///home/jonas/src/telco-6.4/ based on revid:jonas@stripped
2905 Jonas Oreland 2009-04-16 [merge]
merge with 64-upgrade clone
M storage/ndb/src/common/util/version.c
M storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
M storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
M storage/ndb/src/mgmsrv/ConfigManager.cpp
M storage/ndb/src/mgmsrv/ConfigManager.hpp
2903.1.5 Jonas Oreland 2009-04-15
ndb - bug#44294 - part V
instantiate enum with explit numbers as they are sent over the wire
and needs to be stable
M storage/ndb/src/mgmsrv/ConfigManager.hpp
2903.1.4 Jonas Oreland 2009-04-15
ndb - bug#44294 - part IV
Fix sending of ConfigCheckConf to use correct length
M storage/ndb/src/mgmsrv/ConfigManager.cpp
2903.1.3 Jonas Oreland 2009-04-15
ndb - bug#44294 - part III
Fix sending of ConfigCheckRef to use correct length
M storage/ndb/src/mgmsrv/ConfigManager.cpp
2903.1.2 Jonas Oreland 2009-04-15
ndb - bug#44294 - part II
1) Change getFreeObjId to check that objid is free in *both* old/new schema file
2) don't init() entries which happens to be SchemaTransaction that we're running our selves
3) Allow mixed version in schema-trans if it's local (i.e only own node)
4) Handle various random signal changes that pekka did in 6.4 (relative to 6.3)
M storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
M storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
2903.1.1 Jonas Oreland 2009-04-15
ndb - bug#44294 - part I - enable upgrade in version.c (broke when changing from 6.4 to 7.0
M storage/ndb/src/common/util/version.c
=== modified file 'storage/ndb/src/common/util/version.c'
--- a/storage/ndb/src/common/util/version.c 2008-08-26 14:05:01 +0000
+++ b/storage/ndb/src/common/util/version.c 2009-04-15 13:55:56 +0000
@@ -110,10 +110,12 @@ void ndbSetOwnVersion() {}
#ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
+ { MAKE_VERSION(7,0,NDB_VERSION_BUILD), MAKE_VERSION(7,0,0), UG_Range },
+ { MAKE_VERSION(7,0,NDB_VERSION_BUILD), MAKE_VERSION(6,4,0), UG_Range },
/* Can only upgrade to 6.4.X from versions >= 6.3.17 due to change
* in Transporter maximum sent message size
*/
- { MAKE_VERSION(6,4,NDB_VERSION_BUILD), NDBD_MAX_RECVBYTESIZE_32K, UG_Range },
+ { MAKE_VERSION(7,0,NDB_VERSION_BUILD), NDBD_MAX_RECVBYTESIZE_32K, UG_Range },
{ MAKE_VERSION(6,3,NDB_VERSION_BUILD), MAKE_VERSION(6,2,1), UG_Range },
{ MAKE_VERSION(6,2,NDB_VERSION_BUILD), MAKE_VERSION(6,2,1), UG_Range },
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2009-03-24 08:42:42 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2009-04-15 14:08:26 +0000
@@ -139,6 +139,14 @@ create_obj_inc_schema_version(Uint32 old
return (old + 0x00000001) & 0x00FFFFFF;
}
+static
+void
+do_swap(Uint32 & v0, Uint32 & v1)
+{
+ Uint32 save = v0;
+ v0 = v1;
+ v1 = save;
+}
/* **************************************************************** */
/* ---------------------------------------------------------------- */
@@ -2230,21 +2238,20 @@ Uint32 Dbdict::getFsConnRecord()
*/
Uint32 Dbdict::getFreeObjId(Uint32 minId)
{
- const XSchemaFile * xsf = &c_schemaFile[SchemaRecord::NEW_SCHEMA_FILE];
- Uint32 noOfPages = xsf->noOfPages;
- Uint32 n, i;
- for (n = 0; n < noOfPages; n++) {
- jam();
- const SchemaFile * sf = &xsf->schemaPage[n];
- for (i = 0; i < NDB_SF_PAGE_ENTRIES; i++) {
- const SchemaFile::TableEntry& te = sf->TableEntries[i];
- if (te.m_tableState == (Uint32)SchemaFile::SF_UNUSED)
+ const XSchemaFile * newxsf = &c_schemaFile[SchemaRecord::NEW_SCHEMA_FILE];
+ const XSchemaFile * oldxsf = &c_schemaFile[SchemaRecord::OLD_SCHEMA_FILE];
+ const Uint32 noOfEntries = newxsf->noOfPages * NDB_SF_PAGE_ENTRIES;
+ for (Uint32 i = 0; i<noOfEntries; i++)
+ {
+ const SchemaFile::TableEntry * oldentry = getTableEntry(oldxsf, i);
+ const SchemaFile::TableEntry * newentry = getTableEntry(newxsf, i);
+ if (newentry->m_tableState == (Uint32)SchemaFile::SF_UNUSED)
+ {
+ jam();
+ if (oldentry->m_tableState == (Uint32)SchemaFile::SF_UNUSED)
{
- // minId is obsolete anyway
- if (minId <= n * NDB_SF_PAGE_ENTRIES + i)
- {
- return n * NDB_SF_PAGE_ENTRIES + i;
- }
+ jam();
+ return i;
}
}
}
@@ -3480,9 +3487,14 @@ void Dbdict::checkSchemaStatus(Signal* s
if (masterState != SchemaFile::SF_IN_USE)
{
- ownEntry->init();
+ if (ownEntry->m_tableType != DictTabInfo::SchemaTransaction)
+ {
+ jam();
+ ownEntry->init();
+ }
continue;
}
+
/**
* handle table(index) special as DIH has already copied
* table (using COPY_TABREQ)
@@ -4982,6 +4994,17 @@ Dbdict::execCREATE_TABLE_REQ(Signal* sig
}
SectionHandle handle(this, signal);
+ if (check_sender_version(signal, MAKE_VERSION(6,4,0)) < 0)
+ {
+ jam();
+ /**
+ * Pekka has for some obscure reason switched places of
+ * senderRef/senderData
+ */
+ CreateTableReq* tmp = (CreateTableReq*)signal->getDataPtr();
+ do_swap(tmp->senderRef, tmp->senderData);
+ }
+
const CreateTableReq req_copy =
*(const CreateTableReq*)signal->getDataPtr();
const CreateTableReq* req = &req_copy;
@@ -6465,6 +6488,17 @@ Dbdict::execDROP_TABLE_REQ(Signal* signa
}
SectionHandle handle(this, signal);
+ if (check_sender_version(signal, MAKE_VERSION(6,4,0)) < 0)
+ {
+ jam();
+ /**
+ * Pekka has for some obscure reason switched places of
+ * senderRef/senderData
+ */
+ DropTableReq * tmp = (DropTableReq*)signal->getDataPtr();
+ do_swap(tmp->senderRef, tmp->senderData);
+ }
+
const DropTableReq req_copy =
*(const DropTableReq*)signal->getDataPtr();
const DropTableReq* req = &req_copy;
@@ -7137,6 +7171,17 @@ Dbdict::check_ndb_versions() const
return true;
}
+int
+Dbdict::check_sender_version(const Signal* signal, Uint32 version) const
+{
+ Uint32 ver = getNodeInfo(refToNode(signal->getSendersBlockRef())).m_version;
+ if (ver < version)
+ return -1;
+ else if (ver > version)
+ return 1;
+ return 0;
+}
+
void
Dbdict::execALTER_TABLE_REQ(Signal* signal)
{
@@ -7147,6 +7192,18 @@ Dbdict::execALTER_TABLE_REQ(Signal* sign
return;
}
SectionHandle handle(this, signal);
+
+ if (check_sender_version(signal, MAKE_VERSION(6,4,0)) < 0)
+ {
+ jam();
+ /**
+ * Pekka has for some obscure reason switched places of
+ * senderRef/senderData
+ */
+ AlterTableReq * tmp = (AlterTableReq*)signal->getDataPtr();
+ do_swap(tmp->clientRef, tmp->clientData);
+ }
+
const AlterTableReq req_copy =
*(const AlterTableReq*)signal->getDataPtr();
const AlterTableReq* req = &req_copy;
@@ -9835,6 +9892,17 @@ Dbdict::execCREATE_INDX_REQ(Signal* sign
}
SectionHandle handle(this, signal);
+ if (check_sender_version(signal, MAKE_VERSION(6,4,0)) < 0)
+ {
+ jam();
+ /**
+ * Pekka has for some obscure reason switched places of
+ * senderRef/senderData
+ */
+ CreateIndxReq * tmp = (CreateIndxReq*)signal->getDataPtr();
+ do_swap(tmp->clientRef, tmp->clientData);
+ }
+
const CreateIndxReq req_copy =
*(const CreateIndxReq*)signal->getDataPtr();
const CreateIndxReq* req = &req_copy;
@@ -10544,6 +10612,17 @@ Dbdict::execDROP_INDX_REQ(Signal* signal
}
SectionHandle handle(this, signal);
+ if (check_sender_version(signal, MAKE_VERSION(6,4,0)) < 0)
+ {
+ jam();
+ /**
+ * Pekka has for some obscure reason switched places of
+ * senderRef/senderData
+ */
+ DropIndxReq * tmp = (DropIndxReq*)signal->getDataPtr();
+ do_swap(tmp->clientRef, tmp->clientData);
+ }
+
const DropIndxReq req_copy =
*(const DropIndxReq*)signal->getDataPtr();
const DropIndxReq* req = &req_copy;
@@ -18377,6 +18456,17 @@ Dbdict::getTableEntry(XSchemaFile * xsf,
return &sf->TableEntries[i];
}
+const SchemaFile::TableEntry *
+Dbdict::getTableEntry(const XSchemaFile * xsf, Uint32 tableId)
+{
+ Uint32 n = tableId / NDB_SF_PAGE_ENTRIES;
+ Uint32 i = tableId % NDB_SF_PAGE_ENTRIES;
+ ndbrequire(n < xsf->noOfPages);
+
+ SchemaFile * sf = &xsf->schemaPage[n];
+ return &sf->TableEntries[i];
+}
+
//******************************************
// MODULE: CreateFile
@@ -22247,7 +22337,7 @@ Dbdict::execSCHEMA_TRANS_BEGIN_REQ(Signa
break;
}
- if (!check_ndb_versions())
+ if (!check_ndb_versions() && !localTrans)
{
jam();
setError(error, SchemaTransBeginRef::IncompatibleVersions, __LINE__);
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2008-12-12 14:30:54 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2009-04-15 14:08:26 +0000
@@ -852,6 +852,8 @@ private:
void execALTER_TABLE_REF(Signal* signal);
void execALTER_TABLE_CONF(Signal* signal);
bool check_ndb_versions() const;
+ int check_sender_version(const Signal* signal, Uint32 version) const;
+
void execCREATE_FILE_REQ(Signal* signal);
void execCREATE_FILEGROUP_REQ(Signal* signal);
@@ -1110,6 +1112,7 @@ private:
bool validateChecksum(const XSchemaFile *);
SchemaFile::TableEntry * getTableEntry(Uint32 tableId);
SchemaFile::TableEntry * getTableEntry(XSchemaFile *, Uint32 tableId);
+ const SchemaFile::TableEntry * getTableEntry(const XSchemaFile*, Uint32);
Uint32 computeChecksum(const Uint32 * src, Uint32 len);
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp 2009-03-26 09:15:15 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp 2009-04-15 14:38:12 +0000
@@ -1445,7 +1445,7 @@ ConfigManager::sendConfigCheckRef(Signal
error, nodeId);
ss.sendSignal(nodeId, ssig, MGM_CONFIG_MAN,
- GSN_CONFIG_CHECK_REF, ConfigCheckReq::SignalLength);
+ GSN_CONFIG_CHECK_REF, ConfigCheckRef::SignalLength);
}
@@ -1462,7 +1462,7 @@ ConfigManager::sendConfigCheckConf(Signa
g_eventLogger->debug("Send CONFIG_CHECK_CONF to node: %d", nodeId);
ss.sendSignal(nodeId, ssig, MGM_CONFIG_MAN,
- GSN_CONFIG_CHECK_CONF, ConfigCheckReq::SignalLength);
+ GSN_CONFIG_CHECK_CONF, ConfigCheckConf::SignalLength);
}
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.hpp 2009-03-26 09:11:40 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.hpp 2009-04-15 14:45:05 +0000
@@ -41,11 +41,11 @@ class ConfigManager : public MgmtThread
struct ConfigChangeState {
enum States {
- IDLE,
- PREPARING,
- COMITTING,
- ABORT,
- ABORTING
+ IDLE = 0,
+ PREPARING = 1,
+ COMITTING = 2,
+ ABORT = 3,
+ ABORTING = 4
} m_current_state;
ConfigChangeState() :
@@ -57,12 +57,12 @@ class ConfigManager : public MgmtThread
void set_config_change_state(ConfigChangeState::States state);
enum ConfigState {
- CS_UNINITIALIZED,
+ CS_UNINITIALIZED = 0,
- CS_INITIAL, // Initial config.ini, ie. no config.bin.X found
+ CS_INITIAL = 1, // Initial config.ini, ie. no config.bin.X found
- CS_CONFIRMED, // Started and all agreed
- CS_FORCED // Forced start
+ CS_CONFIRMED = 2, // Started and all agreed
+ CS_FORCED = 3 // Forced start
};
ConfigState m_config_state;
Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20090416074933-p9dlkjxygd63gd7y.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (jonas:2905) | Jonas Oreland | 16 Apr |