Commit 0f5b2c52 authored by unknown's avatar unknown

Fix uninit variable bug "surfaced" by removing mem init in SimulatedBlock


ndb/include/kernel/signaldata/StartInfo.hpp:
  Fix signal len
ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
  Put init in constructor
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Send corrent start_inforef
  Init NodeRecord::allowNodeStart
ndb/src/kernel/vm/SimulatedBlock.cpp:
  Remove all mem-inits so that debug/release don't differ
parent 0038f4a6
...@@ -78,7 +78,7 @@ class StartInfoRef { ...@@ -78,7 +78,7 @@ class StartInfoRef {
Uint32 errorCode; Uint32 errorCode;
public: public:
STATIC_CONST( SignalLength = 2 ); STATIC_CONST( SignalLength = 3 );
}; };
#endif #endif
...@@ -269,7 +269,7 @@ public: ...@@ -269,7 +269,7 @@ public:
}; };
struct NodeRecord { struct NodeRecord {
NodeRecord() { m_nodefailSteps.clear();} NodeRecord();
enum NodeStatus { enum NodeStatus {
NOT_IN_CLUSTER = 0, NOT_IN_CLUSTER = 0,
...@@ -1127,7 +1127,6 @@ private: ...@@ -1127,7 +1127,6 @@ private:
void setAllowNodeStart(Uint32 nodeId, bool newState); void setAllowNodeStart(Uint32 nodeId, bool newState);
bool getNodeCopyCompleted(Uint32 nodeId); bool getNodeCopyCompleted(Uint32 nodeId);
void setNodeCopyCompleted(Uint32 nodeId, bool newState); void setNodeCopyCompleted(Uint32 nodeId, bool newState);
void initNodeState(NodeRecordPtr regNodePtr);
bool checkNodeAlive(Uint32 nodeId); bool checkNodeAlive(Uint32 nodeId);
// Initialisation // Initialisation
......
...@@ -1982,9 +1982,11 @@ void Dbdih::execSTART_INFOREQ(Signal* signal) ...@@ -1982,9 +1982,11 @@ void Dbdih::execSTART_INFOREQ(Signal* signal)
(ERROR_INSERTED(7124))) { (ERROR_INSERTED(7124))) {
jam(); jam();
StartInfoRef *const ref =(StartInfoRef*)&signal->theData[0]; StartInfoRef *const ref =(StartInfoRef*)&signal->theData[0];
ref->startingNodeId = startNode;
ref->sendingNodeId = cownNodeId; ref->sendingNodeId = cownNodeId;
ref->errorCode = ZNODE_START_DISALLOWED_ERROR; ref->errorCode = ZNODE_START_DISALLOWED_ERROR;
sendSignal(cmasterdihref, GSN_START_INFOREF, signal, 2, JBB); sendSignal(cmasterdihref, GSN_START_INFOREF, signal,
StartInfoRef::SignalLength, JBB);
return; return;
}//if }//if
setNodeStatus(startNode, NodeRecord::STARTING); setNodeStatus(startNode, NodeRecord::STARTING);
...@@ -2054,7 +2056,7 @@ void Dbdih::execINCL_NODEREQ(Signal* signal) ...@@ -2054,7 +2056,7 @@ void Dbdih::execINCL_NODEREQ(Signal* signal)
Sysfile::ActiveStatus TsaveState = nodePtr.p->activeStatus; Sysfile::ActiveStatus TsaveState = nodePtr.p->activeStatus;
Uint32 TnodeGroup = nodePtr.p->nodeGroup; Uint32 TnodeGroup = nodePtr.p->nodeGroup;
initNodeState(nodePtr); new (nodePtr.p) NodeRecord();
nodePtr.p->nodeGroup = TnodeGroup; nodePtr.p->nodeGroup = TnodeGroup;
nodePtr.p->activeStatus = TsaveState; nodePtr.p->activeStatus = TsaveState;
nodePtr.p->nodeStatus = NodeRecord::ALIVE; nodePtr.p->nodeStatus = NodeRecord::ALIVE;
...@@ -10906,27 +10908,6 @@ void Dbdih::initFragstore(FragmentstorePtr fragPtr) ...@@ -10906,27 +10908,6 @@ void Dbdih::initFragstore(FragmentstorePtr fragPtr)
fragPtr.p->distributionKey = 0; fragPtr.p->distributionKey = 0;
}//Dbdih::initFragstore() }//Dbdih::initFragstore()
void Dbdih::initNodeState(NodeRecordPtr nodePtr)
{
nodePtr.p->gcpstate = NodeRecord::READY;
nodePtr.p->activeStatus = Sysfile::NS_NotDefined;
nodePtr.p->recNODE_FAILREP = ZFALSE;
nodePtr.p->nodeGroup = ZNIL;
nodePtr.p->dbtcFailCompleted = ZTRUE;
nodePtr.p->dbdictFailCompleted = ZTRUE;
nodePtr.p->dbdihFailCompleted = ZTRUE;
nodePtr.p->dblqhFailCompleted = ZTRUE;
nodePtr.p->noOfStartedChkpt = 0;
nodePtr.p->noOfQueuedChkpt = 0;
nodePtr.p->lcpStateAtTakeOver = (MasterLCPConf::State)255;
nodePtr.p->activeTabptr = RNIL;
nodePtr.p->nodeStatus = NodeRecord::NOT_IN_CLUSTER;
nodePtr.p->useInTransactions = false;
nodePtr.p->copyCompleted = false;
}//Dbdih::initNodeState()
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* MODULE: INIT_RESTART_INFO */ /* MODULE: INIT_RESTART_INFO */
...@@ -11175,7 +11156,7 @@ void Dbdih::initialiseRecordsLab(Signal* signal, ...@@ -11175,7 +11156,7 @@ void Dbdih::initialiseRecordsLab(Signal* signal,
NodeRecordPtr nodePtr; NodeRecordPtr nodePtr;
for (nodePtr.i = 0; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) { for (nodePtr.i = 0; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) {
ptrAss(nodePtr, nodeRecord); ptrAss(nodePtr, nodeRecord);
initNodeState(nodePtr); new (nodePtr.p) NodeRecord();
}//for }//for
break; break;
} }
...@@ -11535,7 +11516,7 @@ void Dbdih::makePrnList(ReadNodesConf * readNodes, Uint32 nodeArray[]) ...@@ -11535,7 +11516,7 @@ void Dbdih::makePrnList(ReadNodesConf * readNodes, Uint32 nodeArray[])
jam(); jam();
nodePtr.i = nodeArray[i]; nodePtr.i = nodeArray[i];
ptrCheckGuard(nodePtr, MAX_NDB_NODES, nodeRecord); ptrCheckGuard(nodePtr, MAX_NDB_NODES, nodeRecord);
initNodeState(nodePtr); new (nodePtr.p) NodeRecord();
if (NodeBitmask::get(readNodes->inactiveNodes, nodePtr.i) == false){ if (NodeBitmask::get(readNodes->inactiveNodes, nodePtr.i) == false){
jam(); jam();
nodePtr.p->nodeStatus = NodeRecord::ALIVE; nodePtr.p->nodeStatus = NodeRecord::ALIVE;
...@@ -14173,3 +14154,25 @@ bool Dbdih::isActiveMaster() ...@@ -14173,3 +14154,25 @@ bool Dbdih::isActiveMaster()
{ {
return ((reference() == cmasterdihref) && (cmasterState == MASTER_ACTIVE)); return ((reference() == cmasterdihref) && (cmasterState == MASTER_ACTIVE));
}//Dbdih::isActiveMaster() }//Dbdih::isActiveMaster()
Dbdih::NodeRecord::NodeRecord(){
m_nodefailSteps.clear();
gcpstate = NodeRecord::READY;
activeStatus = Sysfile::NS_NotDefined;
recNODE_FAILREP = ZFALSE;
nodeGroup = ZNIL;
dbtcFailCompleted = ZTRUE;
dbdictFailCompleted = ZTRUE;
dbdihFailCompleted = ZTRUE;
dblqhFailCompleted = ZTRUE;
noOfStartedChkpt = 0;
noOfQueuedChkpt = 0;
lcpStateAtTakeOver = (MasterLCPConf::State)255;
activeTabptr = RNIL;
nodeStatus = NodeRecord::NOT_IN_CLUSTER;
useInTransactions = false;
copyCompleted = false;
allowNodeStart = true;
}
...@@ -660,33 +660,6 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n) ...@@ -660,33 +660,6 @@ SimulatedBlock::allocRecord(const char * type, size_t s, size_t n)
snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", (Uint32)s, (Uint32)n, (Uint32)size); snprintf(buf2, sizeof(buf2), "Requested: %ux%u = %u bytes", (Uint32)s, (Uint32)n, (Uint32)size);
ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2); ERROR_SET(fatal, ERR_MEMALLOC, buf1, buf2);
} }
#ifdef NDB_DEBUG_FULL
// Set the allocated memory to zero
#ifndef NDB_PURIFY
#if defined NDB_OSE
int pages = (size / 4096);
if ((size % 4096)!=0)
pages++;
char* p2 =(char*) p;
for (int i = 0; i < pages; i++){
memset(p2, 0, 4096);
p2 = p2 + 4096;
}
#elif 1
/**
* This code should be enabled in order to find logical errors and not
* initalised errors in the kernel.
*
* NOTE! It's not just "uninitialised errors" that are found by doing this
* it will also find logical errors that have been hidden by all the zeros.
*/
memset(p, 0xF1, size);
#endif
#endif
#endif
}
return p; return p;
} }
......
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