Commit db007003 authored by unknown's avatar unknown

ndb - recommit extra version info to real-51


storage/ndb/include/kernel/GlobalSignalNumbers.h:
  add extra version info to main clone
storage/ndb/include/kernel/NodeInfo.hpp:
  add extra version info to main clone
storage/ndb/include/kernel/signaldata/ApiRegSignalData.hpp:
  add extra version info to main clone
storage/ndb/include/ndb_version.h.in:
  add extra version info to main clone
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp:
  add extra version info to main clone
storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp:
  add extra version info to main clone
storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp:
  add extra version info to main clone
storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp:
  add extra version info to main clone
storage/ndb/src/kernel/vm/GlobalData.hpp:
  add extra version info to main clone
storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
  add extra version info to main clone
parent 3f8ab08b
...@@ -183,7 +183,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES; ...@@ -183,7 +183,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_CNTR_START_REP 119 #define GSN_CNTR_START_REP 119
/* 120 not unused */ /* 120 not unused */
#define GSN_ROUTE_ORD 121 #define GSN_ROUTE_ORD 121
/* 122 unused */ #define GSN_NODE_VERSION_REP 122
/* 123 unused */ /* 123 unused */
/* 124 unused */ /* 124 unused */
#define GSN_CHECK_LCP_STOP 125 #define GSN_CHECK_LCP_STOP 125
......
...@@ -90,4 +90,14 @@ operator<<(NdbOut& ndbout, const NodeInfo & info){ ...@@ -90,4 +90,14 @@ operator<<(NdbOut& ndbout, const NodeInfo & info){
return ndbout; return ndbout;
} }
struct NodeVersionInfo
{
STATIC_CONST( DataLength = 6 );
struct
{
Uint32 m_min_version;
Uint32 m_max_version;
} m_type [3]; // Indexed as NodeInfo::Type
};
#endif #endif
...@@ -80,12 +80,13 @@ class ApiRegConf { ...@@ -80,12 +80,13 @@ class ApiRegConf {
friend class ClusterMgr; friend class ClusterMgr;
public: public:
STATIC_CONST( SignalLength = 3 + NodeState::DataLength ); STATIC_CONST( SignalLength = 4 + NodeState::DataLength );
private: private:
Uint32 qmgrRef; Uint32 qmgrRef;
Uint32 version; // Version of NDB node Uint32 version; // Version of NDB node
Uint32 apiHeartbeatFrequency; Uint32 apiHeartbeatFrequency;
Uint32 minDbVersion;
NodeState nodeState; NodeState nodeState;
}; };
......
...@@ -72,5 +72,7 @@ char ndb_version_string_buf[NDB_VERSION_STRING_BUF_SZ]; ...@@ -72,5 +72,7 @@ char ndb_version_string_buf[NDB_VERSION_STRING_BUF_SZ];
#define NDBD_QMGR_SINGLEUSER_VERSION_5 MAKE_VERSION(5,0,25) #define NDBD_QMGR_SINGLEUSER_VERSION_5 MAKE_VERSION(5,0,25)
#define NDBD_NODE_VERSION_REP MAKE_VERSION(6,1,1)
#endif #endif
...@@ -637,5 +637,6 @@ const GsnName SignalNames [] = { ...@@ -637,5 +637,6 @@ const GsnName SignalNames [] = {
,{ GSN_DICT_COMMIT_REQ, "DICT_COMMIT_REQ"} ,{ GSN_DICT_COMMIT_REQ, "DICT_COMMIT_REQ"}
,{ GSN_ROUTE_ORD, "ROUTE_ORD" } ,{ GSN_ROUTE_ORD, "ROUTE_ORD" }
,{ GSN_NODE_VERSION_REP, "NODE_VERSION_REP" }
}; };
const unsigned short NO_OF_SIGNAL_NAMES = sizeof(SignalNames)/sizeof(GsnName); const unsigned short NO_OF_SIGNAL_NAMES = sizeof(SignalNames)/sizeof(GsnName);
...@@ -450,6 +450,11 @@ private: ...@@ -450,6 +450,11 @@ private:
#ifdef ERROR_INSERT #ifdef ERROR_INSERT
Uint32 c_error_insert_extra; Uint32 c_error_insert_extra;
#endif #endif
void recompute_version_info(Uint32 type);
void recompute_version_info(Uint32 type, Uint32 version);
void execNODE_VERSION_REP(Signal* signal);
void sendApiVersionRep(Signal* signal, NodeRecPtr nodePtr);
}; };
#endif #endif
...@@ -37,6 +37,13 @@ void Qmgr::initData() ...@@ -37,6 +37,13 @@ void Qmgr::initData()
setHbApiDelay(hbDBAPI); setHbApiDelay(hbDBAPI);
c_connectedNodes.set(getOwnNodeId()); c_connectedNodes.set(getOwnNodeId());
c_stopReq.senderRef = 0; c_stopReq.senderRef = 0;
/**
* Check sanity for NodeVersion
*/
ndbrequire((Uint32)NodeInfo::DB == 0);
ndbrequire((Uint32)NodeInfo::API == 1);
ndbrequire((Uint32)NodeInfo::MGM == 2);
}//Qmgr::initData() }//Qmgr::initData()
void Qmgr::initRecords() void Qmgr::initRecords()
...@@ -107,6 +114,7 @@ Qmgr::Qmgr(Block_context& ctx) ...@@ -107,6 +114,7 @@ Qmgr::Qmgr(Block_context& ctx)
addRecSignal(GSN_DIH_RESTARTREF, &Qmgr::execDIH_RESTARTREF); addRecSignal(GSN_DIH_RESTARTREF, &Qmgr::execDIH_RESTARTREF);
addRecSignal(GSN_DIH_RESTARTCONF, &Qmgr::execDIH_RESTARTCONF); addRecSignal(GSN_DIH_RESTARTCONF, &Qmgr::execDIH_RESTARTCONF);
addRecSignal(GSN_NODE_VERSION_REP, &Qmgr::execNODE_VERSION_REP);
initData(); initData();
}//Qmgr::Qmgr() }//Qmgr::Qmgr()
......
...@@ -260,6 +260,9 @@ void Qmgr::execSTTOR(Signal* signal) ...@@ -260,6 +260,9 @@ void Qmgr::execSTTOR(Signal* signal)
case 1: case 1:
initData(signal); initData(signal);
startphase1(signal); startphase1(signal);
recompute_version_info(NodeInfo::DB);
recompute_version_info(NodeInfo::API);
recompute_version_info(NodeInfo::MGM);
return; return;
case 7: case 7:
cactivateApiCheck = 1; cactivateApiCheck = 1;
...@@ -765,6 +768,7 @@ void Qmgr::execCM_REGREQ(Signal* signal) ...@@ -765,6 +768,7 @@ void Qmgr::execCM_REGREQ(Signal* signal)
*/ */
UintR TdynId = ++c_maxDynamicId; UintR TdynId = ++c_maxDynamicId;
setNodeInfo(addNodePtr.i).m_version = startingVersion; setNodeInfo(addNodePtr.i).m_version = startingVersion;
recompute_version_info(NodeInfo::DB, startingVersion);
addNodePtr.p->ndynamicId = TdynId; addNodePtr.p->ndynamicId = TdynId;
/** /**
...@@ -1503,6 +1507,7 @@ void Qmgr::execCM_NODEINFOCONF(Signal* signal) ...@@ -1503,6 +1507,7 @@ void Qmgr::execCM_NODEINFOCONF(Signal* signal)
replyNodePtr.p->ndynamicId = dynamicId; replyNodePtr.p->ndynamicId = dynamicId;
replyNodePtr.p->blockRef = signal->getSendersBlockRef(); replyNodePtr.p->blockRef = signal->getSendersBlockRef();
setNodeInfo(replyNodePtr.i).m_version = version; setNodeInfo(replyNodePtr.i).m_version = version;
recompute_version_info(NodeInfo::DB, version);
if(!c_start.m_nodes.done()){ if(!c_start.m_nodes.done()){
jam(); jam();
...@@ -1602,6 +1607,7 @@ Qmgr::cmAddPrepare(Signal* signal, NodeRecPtr nodePtr, const NodeRec * self){ ...@@ -1602,6 +1607,7 @@ Qmgr::cmAddPrepare(Signal* signal, NodeRecPtr nodePtr, const NodeRec * self){
} }
sendCmAckAdd(signal, nodePtr.i, CmAdd::Prepare); sendCmAckAdd(signal, nodePtr.i, CmAdd::Prepare);
sendApiVersionRep(signal, nodePtr);
/* President have prepared us */ /* President have prepared us */
CmNodeInfoConf * conf = (CmNodeInfoConf*)signal->getDataPtrSend(); CmNodeInfoConf * conf = (CmNodeInfoConf*)signal->getDataPtrSend();
...@@ -1613,6 +1619,29 @@ Qmgr::cmAddPrepare(Signal* signal, NodeRecPtr nodePtr, const NodeRec * self){ ...@@ -1613,6 +1619,29 @@ Qmgr::cmAddPrepare(Signal* signal, NodeRecPtr nodePtr, const NodeRec * self){
DEBUG_START(GSN_CM_NODEINFOCONF, refToNode(nodePtr.p->blockRef), ""); DEBUG_START(GSN_CM_NODEINFOCONF, refToNode(nodePtr.p->blockRef), "");
} }
void
Qmgr::sendApiVersionRep(Signal* signal, NodeRecPtr nodePtr)
{
if (getNodeInfo(nodePtr.i).m_version >= NDBD_NODE_VERSION_REP)
{
jam();
Uint32 ref = calcQmgrBlockRef(nodePtr.i);
for(Uint32 i = 1; i<MAX_NODES; i++)
{
jam();
Uint32 version = getNodeInfo(i).m_version;
Uint32 type = getNodeInfo(i).m_type;
if (type != NodeInfo::DB && version)
{
jam();
signal->theData[0] = i;
signal->theData[1] = version;
sendSignal(ref, GSN_NODE_VERSION_REP, signal, 2, JBB);
}
}
}
}
void void
Qmgr::sendCmAckAdd(Signal * signal, Uint32 nodeId, CmAdd::RequestType type){ Qmgr::sendCmAckAdd(Signal * signal, Uint32 nodeId, CmAdd::RequestType type){
...@@ -2401,6 +2430,8 @@ void Qmgr::sendApiFailReq(Signal* signal, Uint16 failedNodeNo) ...@@ -2401,6 +2430,8 @@ void Qmgr::sendApiFailReq(Signal* signal, Uint16 failedNodeNo)
* SECONDS. * SECONDS.
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
setNodeInfo(failedNodePtr.i).m_heartbeat_cnt= 0; setNodeInfo(failedNodePtr.i).m_heartbeat_cnt= 0;
setNodeInfo(failedNodePtr.i).m_version = 0;
recompute_version_info(getNodeInfo(failedNodePtr.i).m_type);
CloseComReqConf * const closeCom = (CloseComReqConf *)&signal->theData[0]; CloseComReqConf * const closeCom = (CloseComReqConf *)&signal->theData[0];
...@@ -2707,7 +2738,6 @@ void Qmgr::execAPI_REGREQ(Signal* signal) ...@@ -2707,7 +2738,6 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
} }
setNodeInfo(apiNodePtr.i).m_version = version; setNodeInfo(apiNodePtr.i).m_version = version;
setNodeInfo(apiNodePtr.i).m_heartbeat_cnt= 0; setNodeInfo(apiNodePtr.i).m_heartbeat_cnt= 0;
ApiRegConf * const apiRegConf = (ApiRegConf *)&signal->theData[0]; ApiRegConf * const apiRegConf = (ApiRegConf *)&signal->theData[0];
...@@ -2728,8 +2758,9 @@ void Qmgr::execAPI_REGREQ(Signal* signal) ...@@ -2728,8 +2758,9 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
apiRegConf->nodeState.dynamicId = -dynamicId; apiRegConf->nodeState.dynamicId = -dynamicId;
} }
} }
NodeVersionInfo info = getNodeVersionInfo();
apiRegConf->minDbVersion = info.m_type[NodeInfo::DB].m_min_version;
apiRegConf->nodeState.m_connected_nodes.assign(c_connectedNodes); apiRegConf->nodeState.m_connected_nodes.assign(c_connectedNodes);
sendSignal(ref, GSN_API_REGCONF, signal, ApiRegConf::SignalLength, JBB); sendSignal(ref, GSN_API_REGCONF, signal, ApiRegConf::SignalLength, JBB);
if (apiNodePtr.p->phase == ZAPI_INACTIVE && if (apiNodePtr.p->phase == ZAPI_INACTIVE &&
...@@ -2748,6 +2779,33 @@ void Qmgr::execAPI_REGREQ(Signal* signal) ...@@ -2748,6 +2779,33 @@ void Qmgr::execAPI_REGREQ(Signal* signal)
signal->theData[0] = apiNodePtr.i; signal->theData[0] = apiNodePtr.i;
sendSignal(CMVMI_REF, GSN_ENABLE_COMORD, signal, 1, JBA); sendSignal(CMVMI_REF, GSN_ENABLE_COMORD, signal, 1, JBA);
recompute_version_info(type, version);
if (info.m_type[NodeInfo::DB].m_min_version >= NDBD_NODE_VERSION_REP)
{
jam();
NodeReceiverGroup rg(QMGR, c_clusterNodes);
rg.m_nodes.clear(getOwnNodeId());
signal->theData[0] = apiNodePtr.i;
signal->theData[1] = version;
sendSignal(rg, GSN_NODE_VERSION_REP, signal, 2, JBB);
}
else
{
Uint32 i = 0;
while((i = c_clusterNodes.find(i + 1)) != NdbNodeBitmask::NotFound)
{
jam();
if (i == getOwnNodeId())
continue;
if (getNodeInfo(i).m_version >= NDBD_NODE_VERSION_REP)
{
jam();
sendSignal(calcQmgrBlockRef(i), GSN_NODE_VERSION_REP, signal, 2,JBB);
}
}
}
signal->theData[0] = apiNodePtr.i; signal->theData[0] = apiNodePtr.i;
EXECUTE_DIRECT(NDBCNTR, GSN_API_START_REP, signal, 1); EXECUTE_DIRECT(NDBCNTR, GSN_API_START_REP, signal, 1);
} }
...@@ -2783,6 +2841,76 @@ Qmgr::execAPI_VERSION_REQ(Signal * signal) { ...@@ -2783,6 +2841,76 @@ Qmgr::execAPI_VERSION_REQ(Signal * signal) {
ApiVersionConf::SignalLength, JBB); ApiVersionConf::SignalLength, JBB);
} }
void
Qmgr::execNODE_VERSION_REP(Signal* signal)
{
jamEntry();
Uint32 nodeId = signal->theData[0];
Uint32 version = signal->theData[1];
if (nodeId < MAX_NODES)
{
jam();
Uint32 type = getNodeInfo(nodeId).m_type;
setNodeInfo(nodeId).m_version = version;
recompute_version_info(type, version);
}
}
void
Qmgr::recompute_version_info(Uint32 type, Uint32 version)
{
NodeVersionInfo& info = setNodeVersionInfo();
switch(type){
case NodeInfo::DB:
case NodeInfo::API:
case NodeInfo::MGM:
break;
default:
return;
}
if (info.m_type[type].m_min_version == 0 ||
version < info.m_type[type].m_min_version)
info.m_type[type].m_min_version = version;
if (version > info.m_type[type].m_max_version)
info.m_type[type].m_max_version = version;
}
void
Qmgr::recompute_version_info(Uint32 type)
{
switch(type){
case NodeInfo::DB:
case NodeInfo::API:
case NodeInfo::MGM:
break;
default:
return;
}
Uint32 min = ~0, max = 0;
Uint32 cnt = type == NodeInfo::DB ? MAX_NDB_NODES : MAX_NODES;
for (Uint32 i = 1; i<cnt; i++)
{
if (getNodeInfo(i).m_type == type)
{
Uint32 version = getNodeInfo(i).m_version;
if (version)
{
if (version < min)
min = version;
if (version > max)
max = version;
}
}
}
NodeVersionInfo& info = setNodeVersionInfo();
info.m_type[type].m_min_version = min == ~(Uint32)0 ? 0 : min;
info.m_type[type].m_max_version = max;
}
#if 0 #if 0
bool bool
......
...@@ -36,6 +36,7 @@ enum restartStates {initial_state, ...@@ -36,6 +36,7 @@ enum restartStates {initial_state,
struct GlobalData { struct GlobalData {
Uint32 m_restart_seq; // Uint32 m_restart_seq; //
NodeVersionInfo m_versionInfo;
NodeInfo m_nodeInfo[MAX_NODES]; NodeInfo m_nodeInfo[MAX_NODES];
Signal VMSignals[1]; // Owned by FastScheduler:: Signal VMSignals[1]; // Owned by FastScheduler::
......
...@@ -403,6 +403,9 @@ protected: ...@@ -403,6 +403,9 @@ protected:
const NodeInfo & getNodeInfo(NodeId nodeId) const; const NodeInfo & getNodeInfo(NodeId nodeId) const;
NodeInfo & setNodeInfo(NodeId); NodeInfo & setNodeInfo(NodeId);
const NodeVersionInfo& getNodeVersionInfo() const;
NodeVersionInfo& setNodeVersionInfo();
/********************** /**********************
* Xfrm stuff * Xfrm stuff
*/ */
...@@ -709,6 +712,18 @@ SimulatedBlock::getNodeInfo(NodeId nodeId) const { ...@@ -709,6 +712,18 @@ SimulatedBlock::getNodeInfo(NodeId nodeId) const {
return globalData.m_nodeInfo[nodeId]; return globalData.m_nodeInfo[nodeId];
} }
inline
const NodeVersionInfo &
SimulatedBlock::getNodeVersionInfo() const {
return globalData.m_versionInfo;
}
inline
NodeVersionInfo &
SimulatedBlock::setNodeVersionInfo() {
return globalData.m_versionInfo;
}
inline inline
void void
SimulatedBlock::EXECUTE_DIRECT(Uint32 block, SimulatedBlock::EXECUTE_DIRECT(Uint32 block,
......
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