Commit 3f8ab08b authored by unknown's avatar unknown

ndb - bug#25329

  Fix most obvious error in dict/suma error handling of events


storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Fix most obvious error in dict/suma error handling of events
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  Fix most obvious error in dict/suma error handling of events
storage/ndb/src/kernel/blocks/suma/Suma.cpp:
  Fix most obvious error in dict/suma error handling of events
storage/ndb/src/kernel/blocks/suma/SumaInit.cpp:
  Fix most obvious error in dict/suma error handling of events
parent 61fd9c3b
...@@ -10151,6 +10151,7 @@ void Dbdict::execSUB_START_REF(Signal* signal) ...@@ -10151,6 +10151,7 @@ void Dbdict::execSUB_START_REF(Signal* signal)
SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend(); SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend();
ref->senderRef = reference(); ref->senderRef = reference();
ref->senderData = subbPtr.p->m_senderData; ref->senderData = subbPtr.p->m_senderData;
ref->errorCode = err;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF, sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF,
signal, SubStartRef::SignalLength2, JBB); signal, SubStartRef::SignalLength2, JBB);
c_opSubEvent.release(subbPtr); c_opSubEvent.release(subbPtr);
...@@ -10213,6 +10214,7 @@ void Dbdict::execSUB_START_CONF(Signal* signal) ...@@ -10213,6 +10214,7 @@ void Dbdict::execSUB_START_CONF(Signal* signal)
#ifdef EVENT_PH3_DEBUG #ifdef EVENT_PH3_DEBUG
ndbout_c("DBDICT(Coordinator) got GSN_SUB_START_CONF = (%d)", subbPtr.i); ndbout_c("DBDICT(Coordinator) got GSN_SUB_START_CONF = (%d)", subbPtr.i);
#endif #endif
subbPtr.p->m_sub_start_conf = *conf;
subbPtr.p->m_reqTracker.reportConf(c_counterMgr, refToNode(senderRef)); subbPtr.p->m_reqTracker.reportConf(c_counterMgr, refToNode(senderRef));
completeSubStartReq(signal,subbPtr.i,0); completeSubStartReq(signal,subbPtr.i,0);
} }
...@@ -10252,6 +10254,9 @@ void Dbdict::completeSubStartReq(Signal* signal, ...@@ -10252,6 +10254,9 @@ void Dbdict::completeSubStartReq(Signal* signal,
#ifdef EVENT_DEBUG #ifdef EVENT_DEBUG
ndbout_c("SUB_START_CONF"); ndbout_c("SUB_START_CONF");
#endif #endif
SubStartConf* conf = (SubStartConf*)signal->getDataPtrSend();
* conf = subbPtr.p->m_sub_start_conf;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_CONF, sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_CONF,
signal, SubStartConf::SignalLength, JBB); signal, SubStartConf::SignalLength, JBB);
c_opSubEvent.release(subbPtr); c_opSubEvent.release(subbPtr);
...@@ -10373,6 +10378,7 @@ void Dbdict::execSUB_STOP_REF(Signal* signal) ...@@ -10373,6 +10378,7 @@ void Dbdict::execSUB_STOP_REF(Signal* signal)
SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend(); SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend();
ref->senderRef = reference(); ref->senderRef = reference();
ref->senderData = subbPtr.p->m_senderData; ref->senderData = subbPtr.p->m_senderData;
ref->errorCode = err;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF, sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
signal, SubStopRef::SignalLength, JBB); signal, SubStopRef::SignalLength, JBB);
c_opSubEvent.release(subbPtr); c_opSubEvent.release(subbPtr);
...@@ -10425,6 +10431,7 @@ void Dbdict::execSUB_STOP_CONF(Signal* signal) ...@@ -10425,6 +10431,7 @@ void Dbdict::execSUB_STOP_CONF(Signal* signal)
* Coordinator * Coordinator
*/ */
ndbrequire(refToBlock(senderRef) == DBDICT); ndbrequire(refToBlock(senderRef) == DBDICT);
subbPtr.p->m_sub_stop_conf = *conf;
subbPtr.p->m_reqTracker.reportConf(c_counterMgr, refToNode(senderRef)); subbPtr.p->m_reqTracker.reportConf(c_counterMgr, refToNode(senderRef));
completeSubStopReq(signal,subbPtr.i,0); completeSubStopReq(signal,subbPtr.i,0);
} }
...@@ -10465,6 +10472,8 @@ void Dbdict::completeSubStopReq(Signal* signal, ...@@ -10465,6 +10472,8 @@ void Dbdict::completeSubStopReq(Signal* signal,
#ifdef EVENT_DEBUG #ifdef EVENT_DEBUG
ndbout_c("SUB_STOP_CONF"); ndbout_c("SUB_STOP_CONF");
#endif #endif
SubStopConf* conf = (SubStopConf*)signal->getDataPtrSend();
* conf = subbPtr.p->m_sub_stop_conf;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_CONF, sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_CONF,
signal, SubStopConf::SignalLength, JBB); signal, SubStopConf::SignalLength, JBB);
c_opSubEvent.release(subbPtr); c_opSubEvent.release(subbPtr);
...@@ -10713,6 +10722,7 @@ Dbdict::execSUB_REMOVE_REF(Signal* signal) ...@@ -10713,6 +10722,7 @@ Dbdict::execSUB_REMOVE_REF(Signal* signal)
SubRemoveRef* ref = (SubRemoveRef*) signal->getDataPtrSend(); SubRemoveRef* ref = (SubRemoveRef*) signal->getDataPtrSend();
ref->senderRef = reference(); ref->senderRef = reference();
ref->senderData = subbPtr.p->m_senderData; ref->senderData = subbPtr.p->m_senderData;
ref->errorCode = err;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_REMOVE_REF, sendSignal(subbPtr.p->m_senderRef, GSN_SUB_REMOVE_REF,
signal, SubRemoveRef::SignalLength, JBB); signal, SubRemoveRef::SignalLength, JBB);
} }
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <signaldata/DropTrig.hpp> #include <signaldata/DropTrig.hpp>
#include <signaldata/AlterTrig.hpp> #include <signaldata/AlterTrig.hpp>
#include <signaldata/DictLock.hpp> #include <signaldata/DictLock.hpp>
#include <signaldata/SumaImpl.hpp>
#include "SchemaFile.hpp" #include "SchemaFile.hpp"
#include <blocks/mutexes.hpp> #include <blocks/mutexes.hpp>
#include <SafeCounter.hpp> #include <SafeCounter.hpp>
...@@ -1632,6 +1633,10 @@ private: ...@@ -1632,6 +1633,10 @@ private:
Uint32 m_senderRef; Uint32 m_senderRef;
Uint32 m_senderData; Uint32 m_senderData;
Uint32 m_errorCode; Uint32 m_errorCode;
union {
SubStartConf m_sub_start_conf;
SubStopConf m_sub_stop_conf;
};
RequestTracker m_reqTracker; RequestTracker m_reqTracker;
}; };
typedef Ptr<OpSubEvent> OpSubEventPtr; typedef Ptr<OpSubEvent> OpSubEventPtr;
......
...@@ -230,7 +230,6 @@ Suma::execREAD_CONFIG_REQ(Signal* signal) ...@@ -230,7 +230,6 @@ Suma::execREAD_CONFIG_REQ(Signal* signal)
c_startup.m_wait_handover= false; c_startup.m_wait_handover= false;
c_failedApiNodes.clear(); c_failedApiNodes.clear();
c_startup.m_restart_server_node_id = 0; // Server for my NR
ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend(); ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
conf->senderRef = reference(); conf->senderRef = reference();
...@@ -261,6 +260,14 @@ Suma::execSTTOR(Signal* signal) { ...@@ -261,6 +260,14 @@ Suma::execSTTOR(Signal* signal) {
if(startphase == 5) if(startphase == 5)
{ {
if (ERROR_INSERTED(13029)) /* Hold startphase 5 */
{
sendSignalWithDelay(SUMA_REF, GSN_STTOR, signal,
30, signal->getLength());
DBUG_VOID_RETURN;
}
c_startup.m_restart_server_node_id = 0;
getNodeGroupMembers(signal); getNodeGroupMembers(signal);
if (typeOfStart == NodeState::ST_NODE_RESTART || if (typeOfStart == NodeState::ST_NODE_RESTART ||
typeOfStart == NodeState::ST_INITIAL_NODE_RESTART) typeOfStart == NodeState::ST_INITIAL_NODE_RESTART)
...@@ -373,6 +380,8 @@ Suma::execSUMA_START_ME_REF(Signal* signal) ...@@ -373,6 +380,8 @@ Suma::execSUMA_START_ME_REF(Signal* signal)
infoEvent("Suma: node %d refused %d", infoEvent("Suma: node %d refused %d",
c_startup.m_restart_server_node_id, ref->errorCode); c_startup.m_restart_server_node_id, ref->errorCode);
c_startup.m_restart_server_node_id++;
send_start_me_req(signal); send_start_me_req(signal);
} }
...@@ -887,6 +896,22 @@ Suma::execDUMP_STATE_ORD(Signal* signal){ ...@@ -887,6 +896,22 @@ Suma::execDUMP_STATE_ORD(Signal* signal){
ptr->m_buffer_head.m_page_id); ptr->m_buffer_head.m_page_id);
} }
} }
if (tCase == 8006)
{
SET_ERROR_INSERT_VALUE(13029);
}
if (tCase == 8007)
{
c_startup.m_restart_server_node_id = MAX_NDB_NODES + 1;
SET_ERROR_INSERT_VALUE(13029);
}
if (tCase == 8008)
{
CLEAR_ERROR_INSERT_VALUE;
}
} }
/************************************************************* /*************************************************************
...@@ -1092,14 +1117,14 @@ Suma::execSUB_CREATE_REQ(Signal* signal) ...@@ -1092,14 +1117,14 @@ Suma::execSUB_CREATE_REQ(Signal* signal)
} }
} else { } else {
if (c_startup.m_restart_server_node_id && if (c_startup.m_restart_server_node_id &&
refToNode(subRef) != c_startup.m_restart_server_node_id) subRef != calcSumaBlockRef(c_startup.m_restart_server_node_id))
{ {
/** /**
* only allow "restart_server" Suma's to come through * only allow "restart_server" Suma's to come through
* for restart purposes * for restart purposes
*/ */
jam(); jam();
sendSubStartRef(signal, 1405); sendSubCreateRef(signal, 1415);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
// Check that id/key is unique // Check that id/key is unique
...@@ -2232,14 +2257,17 @@ Suma::execSUB_START_REQ(Signal* signal){ ...@@ -2232,14 +2257,17 @@ Suma::execSUB_START_REQ(Signal* signal){
key.m_subscriptionKey = req->subscriptionKey; key.m_subscriptionKey = req->subscriptionKey;
if (c_startup.m_restart_server_node_id && if (c_startup.m_restart_server_node_id &&
refToNode(senderRef) != c_startup.m_restart_server_node_id) senderRef != calcSumaBlockRef(c_startup.m_restart_server_node_id))
{ {
/** /**
* only allow "restart_server" Suma's to come through * only allow "restart_server" Suma's to come through
* for restart purposes * for restart purposes
*/ */
jam(); jam();
sendSubStartRef(signal, 1405); Uint32 err = c_startup.m_restart_server_node_id != RNIL ? 1405 :
SubStartRef::NF_FakeErrorREF;
sendSubStartRef(signal, err);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -2454,22 +2482,25 @@ Suma::execSUB_STOP_REQ(Signal* signal){ ...@@ -2454,22 +2482,25 @@ Suma::execSUB_STOP_REQ(Signal* signal){
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if(!c_subscriptions.find(subPtr, key)){
jam();
DBUG_PRINT("error", ("not found"));
sendSubStopRef(signal, 1407);
DBUG_VOID_RETURN;
}
if (c_startup.m_restart_server_node_id && if (c_startup.m_restart_server_node_id &&
refToNode(senderRef) != c_startup.m_restart_server_node_id) senderRef != calcSumaBlockRef(c_startup.m_restart_server_node_id))
{ {
/** /**
* only allow "restart_server" Suma's to come through * only allow "restart_server" Suma's to come through
* for restart purposes * for restart purposes
*/ */
jam(); jam();
sendSubStopRef(signal, 1405); Uint32 err = c_startup.m_restart_server_node_id != RNIL ? 1405 :
SubStopRef::NF_FakeErrorREF;
sendSubStopRef(signal, err);
DBUG_VOID_RETURN;
}
if(!c_subscriptions.find(subPtr, key)){
jam();
DBUG_PRINT("error", ("not found"));
sendSubStopRef(signal, 1407);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -122,6 +122,8 @@ Suma::Suma(Block_context& ctx) : ...@@ -122,6 +122,8 @@ Suma::Suma(Block_context& ctx) :
addRecSignal(GSN_SUB_GCP_COMPLETE_REP, addRecSignal(GSN_SUB_GCP_COMPLETE_REP,
&Suma::execSUB_GCP_COMPLETE_REP); &Suma::execSUB_GCP_COMPLETE_REP);
c_startup.m_restart_server_node_id = RNIL; // Server for my NR
} }
Suma::~Suma() Suma::~Suma()
......
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