Commit 352965b3 authored by unknown's avatar unknown

Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1

into deer.(none):/home/hf/work/mysql-4.1.5066

parents d96933b4 28ae9fcb
...@@ -1401,6 +1401,7 @@ void Dbdih::ndbStartReqLab(Signal* signal, BlockReference ref) ...@@ -1401,6 +1401,7 @@ void Dbdih::ndbStartReqLab(Signal* signal, BlockReference ref)
void Dbdih::execREAD_NODESCONF(Signal* signal) void Dbdih::execREAD_NODESCONF(Signal* signal)
{ {
unsigned i;
ReadNodesConf * const readNodes = (ReadNodesConf *)&signal->theData[0]; ReadNodesConf * const readNodes = (ReadNodesConf *)&signal->theData[0];
jamEntry(); jamEntry();
Uint32 nodeArray[MAX_NDB_NODES]; Uint32 nodeArray[MAX_NDB_NODES];
...@@ -1408,9 +1409,10 @@ void Dbdih::execREAD_NODESCONF(Signal* signal) ...@@ -1408,9 +1409,10 @@ void Dbdih::execREAD_NODESCONF(Signal* signal)
csystemnodes = readNodes->noOfNodes; csystemnodes = readNodes->noOfNodes;
cmasterNodeId = readNodes->masterNodeId; cmasterNodeId = readNodes->masterNodeId;
int index = 0; int index = 0;
for (unsigned i = 1; i < MAX_NDB_NODES; i++){ NdbNodeBitmask tmp; tmp.assign(2, readNodes->allNodes);
for (i = 1; i < MAX_NDB_NODES; i++){
jam(); jam();
if(NodeBitmask::get(readNodes->allNodes, i)){ if(tmp.get(i)){
jam(); jam();
nodeArray[index] = i; nodeArray[index] = i;
if(NodeBitmask::get(readNodes->inactiveNodes, i) == false){ if(NodeBitmask::get(readNodes->inactiveNodes, i) == false){
...@@ -1420,6 +1422,32 @@ void Dbdih::execREAD_NODESCONF(Signal* signal) ...@@ -1420,6 +1422,32 @@ void Dbdih::execREAD_NODESCONF(Signal* signal)
index++; index++;
}//if }//if
}//for }//for
if(cstarttype == NodeState::ST_SYSTEM_RESTART ||
cstarttype == NodeState::ST_NODE_RESTART){
for(i = 1; i<MAX_NDB_NODES; i++){
const Uint32 stat = Sysfile::getNodeStatus(i, SYSFILE->nodeStatus);
if(stat == Sysfile::NS_NotDefined && !tmp.get(i)){
jam();
continue;
}
if(tmp.get(i) && stat != Sysfile::NS_NotDefined){
jam();
continue;
}
char buf[255];
snprintf(buf, sizeof(buf),
"Illegal configuration change."
" Initial start needs to be performed "
" when changing no of storage nodes (node %d)", i);
progError(__LINE__,
ERR_INVALID_CONFIG,
buf);
}
}
ndbrequire(csystemnodes >= 1 && csystemnodes < MAX_NDB_NODES); ndbrequire(csystemnodes >= 1 && csystemnodes < MAX_NDB_NODES);
if (cstarttype == NodeState::ST_INITIAL_START) { if (cstarttype == NodeState::ST_INITIAL_START) {
jam(); jam();
...@@ -3451,10 +3479,37 @@ void Dbdih::selectMasterCandidateAndSend(Signal* signal) ...@@ -3451,10 +3479,37 @@ void Dbdih::selectMasterCandidateAndSend(Signal* signal)
}//if }//if
}//for }//for
ndbrequire(masterCandidateId != 0); ndbrequire(masterCandidateId != 0);
setNodeGroups();
signal->theData[0] = masterCandidateId; signal->theData[0] = masterCandidateId;
signal->theData[1] = gci; signal->theData[1] = gci;
sendSignal(cntrlblockref, GSN_DIH_RESTARTCONF, signal, 2, JBB); sendSignal(cntrlblockref, GSN_DIH_RESTARTCONF, signal, 2, JBB);
setNodeGroups();
Uint32 node_groups[MAX_NDB_NODES];
memset(node_groups, 0, sizeof(node_groups));
for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) {
jam();
const Uint32 ng = Sysfile::getNodeGroup(nodePtr.i, SYSFILE->nodeGroups);
if(ng != NO_NODE_GROUP_ID){
ndbrequire(ng < MAX_NDB_NODES);
node_groups[ng]++;
}
}
for (nodePtr.i = 0; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) {
jam();
Uint32 count = node_groups[nodePtr.i];
if(count != 0 && count != cnoReplicas){
char buf[255];
snprintf(buf, sizeof(buf),
"Illegal configuration change."
" Initial start needs to be performed "
" when changing no of replicas (%d != %d)",
node_groups[nodePtr.i], cnoReplicas);
progError(__LINE__,
ERR_INVALID_CONFIG,
buf);
}
}
}//Dbdih::selectMasterCandidate() }//Dbdih::selectMasterCandidate()
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <my_time.h> #include <my_time.h>
#include <m_string.h> #include <m_string.h>
#include <m_ctype.h> #include <m_ctype.h>
/* Windows version of localtime_r() is declared in my_ptrhead.h */
#include <my_pthread.h>
ulonglong log_10_int[20]= ulonglong log_10_int[20]=
{ {
......
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