ndb - bug#25329

  Fix most obvious error in dict/suma error handling of events
parent c73b27f5
......@@ -10151,6 +10151,7 @@ void Dbdict::execSUB_START_REF(Signal* signal)
SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend();
ref->senderRef = reference();
ref->senderData = subbPtr.p->m_senderData;
ref->errorCode = err;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF,
signal, SubStartRef::SignalLength2, JBB);
c_opSubEvent.release(subbPtr);
......@@ -10213,6 +10214,7 @@ void Dbdict::execSUB_START_CONF(Signal* signal)
#ifdef EVENT_PH3_DEBUG
ndbout_c("DBDICT(Coordinator) got GSN_SUB_START_CONF = (%d)", subbPtr.i);
#endif
subbPtr.p->m_sub_start_conf = *conf;
subbPtr.p->m_reqTracker.reportConf(c_counterMgr, refToNode(senderRef));
completeSubStartReq(signal,subbPtr.i,0);
}
......@@ -10252,6 +10254,9 @@ void Dbdict::completeSubStartReq(Signal* signal,
#ifdef EVENT_DEBUG
ndbout_c("SUB_START_CONF");
#endif
SubStartConf* conf = (SubStartConf*)signal->getDataPtrSend();
* conf = subbPtr.p->m_sub_start_conf;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_CONF,
signal, SubStartConf::SignalLength, JBB);
c_opSubEvent.release(subbPtr);
......@@ -10373,6 +10378,7 @@ void Dbdict::execSUB_STOP_REF(Signal* signal)
SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend();
ref->senderRef = reference();
ref->senderData = subbPtr.p->m_senderData;
ref->errorCode = err;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
signal, SubStopRef::SignalLength, JBB);
c_opSubEvent.release(subbPtr);
......@@ -10425,6 +10431,7 @@ void Dbdict::execSUB_STOP_CONF(Signal* signal)
* Coordinator
*/
ndbrequire(refToBlock(senderRef) == DBDICT);
subbPtr.p->m_sub_stop_conf = *conf;
subbPtr.p->m_reqTracker.reportConf(c_counterMgr, refToNode(senderRef));
completeSubStopReq(signal,subbPtr.i,0);
}
......@@ -10465,6 +10472,8 @@ void Dbdict::completeSubStopReq(Signal* signal,
#ifdef EVENT_DEBUG
ndbout_c("SUB_STOP_CONF");
#endif
SubStopConf* conf = (SubStopConf*)signal->getDataPtrSend();
* conf = subbPtr.p->m_sub_stop_conf;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_CONF,
signal, SubStopConf::SignalLength, JBB);
c_opSubEvent.release(subbPtr);
......@@ -10713,6 +10722,7 @@ Dbdict::execSUB_REMOVE_REF(Signal* signal)
SubRemoveRef* ref = (SubRemoveRef*) signal->getDataPtrSend();
ref->senderRef = reference();
ref->senderData = subbPtr.p->m_senderData;
ref->errorCode = err;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_REMOVE_REF,
signal, SubRemoveRef::SignalLength, JBB);
}
......
......@@ -52,6 +52,7 @@
#include <signaldata/DropTrig.hpp>
#include <signaldata/AlterTrig.hpp>
#include <signaldata/DictLock.hpp>
#include <signaldata/SumaImpl.hpp>
#include "SchemaFile.hpp"
#include <blocks/mutexes.hpp>
#include <SafeCounter.hpp>
......@@ -1632,6 +1633,10 @@ private:
Uint32 m_senderRef;
Uint32 m_senderData;
Uint32 m_errorCode;
union {
SubStartConf m_sub_start_conf;
SubStopConf m_sub_stop_conf;
};
RequestTracker m_reqTracker;
};
typedef Ptr<OpSubEvent> OpSubEventPtr;
......
......@@ -230,7 +230,6 @@ Suma::execREAD_CONFIG_REQ(Signal* signal)
c_startup.m_wait_handover= false;
c_failedApiNodes.clear();
c_startup.m_restart_server_node_id = 0; // Server for my NR
ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
conf->senderRef = reference();
......@@ -261,6 +260,14 @@ Suma::execSTTOR(Signal* signal) {
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);
if (typeOfStart == NodeState::ST_NODE_RESTART ||
typeOfStart == NodeState::ST_INITIAL_NODE_RESTART)
......@@ -373,6 +380,8 @@ Suma::execSUMA_START_ME_REF(Signal* signal)
infoEvent("Suma: node %d refused %d",
c_startup.m_restart_server_node_id, ref->errorCode);
c_startup.m_restart_server_node_id++;
send_start_me_req(signal);
}
......@@ -887,6 +896,22 @@ Suma::execDUMP_STATE_ORD(Signal* signal){
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)
}
} else {
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
* for restart purposes
*/
jam();
sendSubStartRef(signal, 1405);
sendSubCreateRef(signal, 1415);
DBUG_VOID_RETURN;
}
// Check that id/key is unique
......@@ -2232,14 +2257,17 @@ Suma::execSUB_START_REQ(Signal* signal){
key.m_subscriptionKey = req->subscriptionKey;
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
* for restart purposes
*/
jam();
sendSubStartRef(signal, 1405);
Uint32 err = c_startup.m_restart_server_node_id != RNIL ? 1405 :
SubStartRef::NF_FakeErrorREF;
sendSubStartRef(signal, err);
DBUG_VOID_RETURN;
}
......@@ -2454,25 +2482,28 @@ Suma::execSUB_STOP_REQ(Signal* signal){
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 &&
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
* for restart purposes
*/
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;
}
if (subPtr.p->m_state == Subscription::LOCKED) {
jam();
DBUG_PRINT("error", ("locked"));
......
......@@ -122,6 +122,8 @@ Suma::Suma(Block_context& ctx) :
addRecSignal(GSN_SUB_GCP_COMPLETE_REP,
&Suma::execSUB_GCP_COMPLETE_REP);
c_startup.m_restart_server_node_id = RNIL; // Server for my NR
}
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