summaryrefslogtreecommitdiff
path: root/ndb/src/kernel
diff options
context:
space:
mode:
authordli@dev3-76.dev.cn.tlan <>2006-09-11 11:03:14 +0800
committerdli@dev3-76.dev.cn.tlan <>2006-09-11 11:03:14 +0800
commit30251ea3bc1056cef6e3f9d5b58a8646e10b1464 (patch)
tree188a10b9b3401c46bc18eca72eceedbf8fd220a0 /ndb/src/kernel
parentdbd808add58cded065a1bc923930934df59d17c3 (diff)
downloadmariadb-git-30251ea3bc1056cef6e3f9d5b58a8646e10b1464.tar.gz
Fix for Bug #20395 Cluster datanodes always assigned to nodegroup 0 during single user mode.
Data node is not allowed to get added in the cluster when it is in single user mode.
Diffstat (limited to 'ndb/src/kernel')
-rw-r--r--ndb/src/kernel/blocks/qmgr/QmgrMain.cpp51
-rw-r--r--ndb/src/kernel/error/ndbd_exit_codes.c3
2 files changed, 52 insertions, 2 deletions
diff --git a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index cc981f37987..51d06537dbb 100644
--- a/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -153,6 +153,7 @@ void Qmgr::execCONTINUEB(Signal* signal)
return;
}
Uint64 now = NdbTick_CurrentMillisecond();
+
if (now > (c_start_election_time + c_restartFailureTimeout))
{
jam();
@@ -698,7 +699,40 @@ void Qmgr::execCM_REGREQ(Signal* signal)
sendCmRegrefLab(signal, Tblockref, CmRegRef::ZNOT_IN_CFG);
return;
}
-
+
+ if (getNodeState().getSingleUserMode())
+ {
+ /**
+ * The cluster is in single user mode.
+ * Data node is not allowed to get added in the cluster
+ * while in single user mode.
+ */
+ // handle rolling upgrade
+ {
+ unsigned int get_major = getMajor(startingVersion);
+ unsigned int get_minor = getMinor(startingVersion);
+ unsigned int get_build = getBuild(startingVersion);
+
+ if (startingVersion < NDBD_QMGR_SINGLEUSER_VERSION_5) {
+ jam();
+
+ infoEvent("QMGR: detect upgrade: new node %u old version %u.%u.%u",
+ (unsigned int)addNodePtr.i, get_major, get_minor, get_build);
+ /**
+ * The new node is old version, send ZINCOMPATIBLE_VERSION instead
+ * of ZSINGLE_USER_MODE.
+ */
+ sendCmRegrefLab(signal, Tblockref, CmRegRef::ZINCOMPATIBLE_VERSION);
+ } else {
+ jam();
+
+ sendCmRegrefLab(signal, Tblockref, CmRegRef::ZSINGLE_USER_MODE);
+ }//if
+ }
+
+ return;
+ }//if
+
ptrCheckGuard(addNodePtr, MAX_NDB_NODES, nodeRec);
Phase phase = addNodePtr.p->phase;
if (phase != ZINIT)
@@ -1093,6 +1127,19 @@ void Qmgr::execCM_REGREF(Signal* signal)
jam();
progError(__LINE__, NDBD_EXIT_NODE_NOT_DEAD);
break;
+ case CmRegRef::ZSINGLE_USER_MODE:
+ jam();
+ progError(__LINE__, NDBD_EXIT_SINGLE_USER_MODE);
+ break;
+ /**
+ * For generic refuse error.
+ * e.g. in online upgrade, we can use this error code instead
+ * of the incompatible error code.
+ */
+ case CmRegRef::ZGENERIC:
+ jam();
+ progError(__LINE__, NDBD_EXIT_GENERIC);
+ break;
case CmRegRef::ZELECTION:
jam();
if (candidate_gci > c_start.m_president_candidate_gci ||
@@ -2025,7 +2072,7 @@ void Qmgr::initData(Signal* signal)
&c_restartPartionedTimeout);
ndb_mgm_get_int_parameter(p, CFG_DB_START_FAILURE_TIMEOUT,
&c_restartFailureTimeout);
-
+
if(c_restartPartialTimeout == 0)
{
c_restartPartialTimeout = ~0;
diff --git a/ndb/src/kernel/error/ndbd_exit_codes.c b/ndb/src/kernel/error/ndbd_exit_codes.c
index cb3272b38a9..1853130f93c 100644
--- a/ndb/src/kernel/error/ndbd_exit_codes.c
+++ b/ndb/src/kernel/error/ndbd_exit_codes.c
@@ -45,6 +45,7 @@ typedef struct ErrStruct {
static const ErrStruct errArray[] =
{
+ {NDBD_EXIT_GENERIC, XRE, "Generic error"},
{NDBD_EXIT_PRGERR, XIE, "Assertion"},
{NDBD_EXIT_NODE_NOT_IN_CONFIG, XCE,
"node id in the configuration has the wrong type, (i.e. not an NDB node)"},
@@ -68,6 +69,8 @@ static const ErrStruct errArray[] =
"No more free UNDO log, increase UndoIndexBuffer"},
{NDBD_EXIT_SR_UNDOLOG, XFI,
"Error while reading the datapages and UNDO log"},
+ {NDBD_EXIT_SINGLE_USER_MODE, XRE, "Data node is not allowed to get added "
+ "to the cluster while it is in single user mode"},
{NDBD_EXIT_MEMALLOC, XCE, "Memory allocation failure, "
"please decrease some configuration parameters"},
{NDBD_EXIT_BLOCK_JBUFCONGESTION, XIE, "Job buffer congestion"},