mirror of
https://github.com/MariaDB/server.git
synced 2026-04-30 20:25:32 +02:00
reengineered ndb_mgmd to use SignalSender and remove some multi user issues
This commit is contained in:
parent
acf8d0f4d0
commit
c1c2a8920c
11 changed files with 595 additions and 1705 deletions
|
|
@ -553,7 +553,6 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
|
|||
#define GSN_STATISTICS_CONF 454
|
||||
|
||||
#define GSN_START_ORD 455
|
||||
/* 456 unused */
|
||||
/* 457 unused */
|
||||
|
||||
#define GSN_EVENT_SUBSCRIBE_REQ 458
|
||||
|
|
@ -900,6 +899,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
|
|||
#define GSN_RESUME_REQ 682
|
||||
#define GSN_STOP_REQ 443
|
||||
#define GSN_STOP_REF 444
|
||||
#define GSN_STOP_CONF 456
|
||||
#define GSN_API_VERSION_REQ 697
|
||||
#define GSN_API_VERSION_CONF 698
|
||||
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ public:
|
|||
CreateLogBytes = 48,
|
||||
InfoEvent = 49,
|
||||
|
||||
//GREP
|
||||
GrepSubscriptionInfo = 52,
|
||||
GrepSubscriptionAlert = 53,
|
||||
// SINGLE USER
|
||||
SingleUser = 52,
|
||||
/* unused 53 */
|
||||
|
||||
//BACKUP
|
||||
BackupStarted = 54,
|
||||
|
|
|
|||
|
|
@ -67,6 +67,13 @@ public:
|
|||
static bool getStopAbort(const Uint32 & requestInfo);
|
||||
};
|
||||
|
||||
struct StopConf
|
||||
{
|
||||
STATIC_CONST( SignalLength = 2 );
|
||||
Uint32 senderData;
|
||||
Uint32 nodeState;
|
||||
};
|
||||
|
||||
class StopRef
|
||||
{
|
||||
/**
|
||||
|
|
@ -86,7 +93,8 @@ public:
|
|||
OK = 0,
|
||||
NodeShutdownInProgress = 1,
|
||||
SystemShutdownInProgress = 2,
|
||||
NodeShutdownWouldCauseSystemCrash = 3
|
||||
NodeShutdownWouldCauseSystemCrash = 3,
|
||||
TransactionAbortFailed = 4
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -105,9 +105,8 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
|
|||
{ EventReport::CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO },
|
||||
{ EventReport::InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO },
|
||||
|
||||
//Global replication
|
||||
{ EventReport::GrepSubscriptionInfo, LogLevel::llGrep, 7, Logger::LL_INFO},
|
||||
{ EventReport::GrepSubscriptionAlert, LogLevel::llGrep, 7, Logger::LL_ALERT},
|
||||
//Single User
|
||||
{ EventReport::SingleUser, LogLevel::llInfo, 7, Logger::LL_INFO},
|
||||
|
||||
// Backup
|
||||
{ EventReport::BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO },
|
||||
|
|
@ -800,473 +799,29 @@ EventLogger::getText(char * m_text, size_t m_text_len,
|
|||
);
|
||||
break;
|
||||
}
|
||||
case EventReport::GrepSubscriptionInfo :
|
||||
case EventReport::SingleUser :
|
||||
{
|
||||
GrepEvent::Subscription event = (GrepEvent::Subscription)theData[1];
|
||||
switch(event) {
|
||||
case GrepEvent::GrepSS_CreateSubIdConf:
|
||||
switch (theData[1])
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
case 0:
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Created subscription id"
|
||||
" (subId=%d,SubKey=%d)"
|
||||
" Return code: %d.",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
"%sEntering single user mode", theNodeId);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_CreateSubIdConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
case 1:
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Created subscription id"
|
||||
" (subId=%d,SubKey=%d)"
|
||||
" Return code: %d.",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
"%sEntered single user mode %d", theNodeId, theData[2]);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubCreateConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
const int nodegrp = theData[5];
|
||||
case 2:
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Created subscription using"
|
||||
" (subId=%d,SubKey=%d)"
|
||||
" in primary system. Primary system has %d nodegroup(s)."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
nodegrp,
|
||||
err);
|
||||
"%sExiting single user mode", theNodeId);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubCreateConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: All participants have created "
|
||||
"subscriptions"
|
||||
" using (subId=%d,SubKey=%d)."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubStartMetaConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Logging started on meta data changes."
|
||||
" using (subId=%d,SubKey=%d)"
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubStartMetaConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: All participants have started "
|
||||
"logging meta data"
|
||||
" changes on the subscription subId=%d,SubKey=%d) "
|
||||
"(N.I yet)."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubStartDataConf: {
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Logging started on table data changes "
|
||||
" using (subId=%d,SubKey=%d)"
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubStartDataConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: All participants have started logging "
|
||||
"table data changes on the subscription "
|
||||
"subId=%d,SubKey=%d)."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubSyncMetaConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: All participants have started "
|
||||
" synchronization on meta data (META SCAN) using "
|
||||
"(subId=%d,SubKey=%d)."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubSyncMetaConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Synchronization started (META SCAN) on "
|
||||
" meta data using (subId=%d,SubKey=%d)"
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubSyncDataConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: All participants have started "
|
||||
"synchronization "
|
||||
" on table data (DATA SCAN) using (subId=%d,SubKey=%d)."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubSyncDataConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
const int gci = theData[5];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Synchronization started (DATA SCAN) on "
|
||||
"table data using (subId=%d,SubKey=%d). GCI = %d"
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
gci,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubRemoveConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: All participants have removed "
|
||||
"subscription (subId=%d,SubKey=%d). I have cleaned "
|
||||
"up resources I've used."
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubRemoveConf:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Removed subscription "
|
||||
"(subId=%d,SubKey=%d)"
|
||||
" Return code: %d",
|
||||
subId,
|
||||
subKey,
|
||||
err);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BaseString::snprintf(m_text,
|
||||
m_text_len,
|
||||
"%sUnknown GrepSubscriptonInfo event: %d",
|
||||
theNodeId,
|
||||
theData[1]);
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"%sUnknown single user report %d", theNodeId, theData[1]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EventReport::GrepSubscriptionAlert :
|
||||
{
|
||||
GrepEvent::Subscription event = (GrepEvent::Subscription)theData[1];
|
||||
switch(event)
|
||||
{
|
||||
case GrepEvent::GrepSS_CreateSubIdRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord:Error code: %d Error message: %s"
|
||||
" (subId=%d,SubKey=%d)",
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err),
|
||||
subId,
|
||||
subKey);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubCreateRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: FAILED to Created subscription using"
|
||||
" (subId=%d,SubKey=%d)in primary system."
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubStartMetaRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Logging failed to start on meta "
|
||||
"data changes."
|
||||
" using (subId=%d,SubKey=%d)"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubStartDataRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Logging FAILED to start on table data "
|
||||
" changes using (subId=%d,SubKey=%d)"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubSyncMetaRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Synchronization FAILED (META SCAN) on "
|
||||
" meta data using (subId=%d,SubKey=%d)"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubSyncDataRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
const int gci = theData[5];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Synchronization FAILED (DATA SCAN) on "
|
||||
"table data using (subId=%d,SubKey=%d). GCI = %d"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
gci,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepSS_SubRemoveRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::SSCoord: Failed to remove subscription "
|
||||
"(subId=%d,SubKey=%d). "
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case GrepEvent::GrepPS_CreateSubIdRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Error code: %d Error Message: %s"
|
||||
" (subId=%d,SubKey=%d)",
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err),
|
||||
subId,
|
||||
subKey);
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubCreateRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: FAILED to Created subscription using"
|
||||
" (subId=%d,SubKey=%d)in primary system."
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubStartMetaRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Logging failed to start on meta "
|
||||
"data changes."
|
||||
" using (subId=%d,SubKey=%d)"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubStartDataRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Logging FAILED to start on table data "
|
||||
" changes using (subId=%d,SubKey=%d)"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubSyncMetaRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Synchronization FAILED (META SCAN) on "
|
||||
" meta data using (subId=%d,SubKey=%d)"
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubSyncDataRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
const int gci = theData[5];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Synchronization FAILED (DATA SCAN) on "
|
||||
"table data using (subId=%d,SubKey=%d). GCI = %d. "
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
gci,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::GrepPS_SubRemoveRef:
|
||||
{
|
||||
const int subId = theData[2];
|
||||
const int subKey = theData[3];
|
||||
const int err = theData[4];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Grep::PSCoord: Failed to remove subscription "
|
||||
"(subId=%d,SubKey=%d)."
|
||||
" Error code: %d Error Message: %s",
|
||||
subId,
|
||||
subKey,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
case GrepEvent::Rep_Disconnect:
|
||||
{
|
||||
const int err = theData[4];
|
||||
const int nodeId = theData[5];
|
||||
BaseString::snprintf(m_text, m_text_len,
|
||||
"Rep: Node %d."
|
||||
" Error code: %d Error Message: %s",
|
||||
nodeId,
|
||||
err,
|
||||
GrepError::getErrorDesc((GrepError::GE_Code)err));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
BaseString::snprintf(m_text,
|
||||
m_text_len,
|
||||
"%sUnknown GrepSubscriptionAlert event: %d",
|
||||
theNodeId,
|
||||
theData[1]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
case EventReport::BackupStarted:
|
||||
BaseString::snprintf(m_text,
|
||||
m_text_len,
|
||||
|
|
|
|||
|
|
@ -1966,6 +1966,11 @@ Ndbcntr::execRESUME_REQ(Signal* signal){
|
|||
//ResumeRef * const ref = (ResumeRef *)&signal->theData[0];
|
||||
|
||||
jamEntry();
|
||||
|
||||
signal->theData[0] = EventReport::SingleUser;
|
||||
signal->theData[1] = 2;
|
||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
|
||||
|
||||
//Uint32 senderData = req->senderData;
|
||||
//BlockReference senderRef = req->senderRef;
|
||||
NodeState newState(NodeState::SL_STARTED);
|
||||
|
|
@ -2004,12 +2009,11 @@ Ndbcntr::execSTOP_REQ(Signal* signal){
|
|||
return;
|
||||
}
|
||||
|
||||
if(c_stopRec.stopReq.senderRef != 0 && !singleuser){
|
||||
jam();
|
||||
if(c_stopRec.stopReq.senderRef != 0){
|
||||
/**
|
||||
* Requested a system shutdown
|
||||
*/
|
||||
if(StopReq::getSystemStop(req->requestInfo)){
|
||||
if(!singleuser && StopReq::getSystemStop(req->requestInfo)){
|
||||
jam();
|
||||
sendSignalWithDelay(reference(), GSN_STOP_REQ, signal, 100,
|
||||
StopReq::SignalLength);
|
||||
|
|
@ -2031,23 +2035,28 @@ Ndbcntr::execSTOP_REQ(Signal* signal){
|
|||
c_stopRec.stopReq = * req;
|
||||
c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
|
||||
|
||||
if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) && !singleuser) {
|
||||
jam();
|
||||
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
|
||||
((Configuration&)theConfiguration).stopOnError(false);
|
||||
}
|
||||
}
|
||||
if(!singleuser) {
|
||||
if(StopReq::getSystemStop(c_stopRec.stopReq.requestInfo)) {
|
||||
jam();
|
||||
if(StopReq::getPerformRestart(c_stopRec.stopReq.requestInfo)){
|
||||
((Configuration&)theConfiguration).stopOnError(false);
|
||||
}
|
||||
}
|
||||
if(!c_stopRec.checkNodeFail(signal)){
|
||||
jam();
|
||||
return;
|
||||
}
|
||||
signal->theData[0] = EventReport::NDBStopStarted;
|
||||
signal->theData[1] = StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) ? 1 : 0;
|
||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
|
||||
}
|
||||
|
||||
signal->theData[0] = EventReport::NDBStopStarted;
|
||||
signal->theData[1] = StopReq::getSystemStop(c_stopRec.stopReq.requestInfo) ? 1 : 0;
|
||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
|
||||
|
||||
else
|
||||
{
|
||||
signal->theData[0] = EventReport::SingleUser;
|
||||
signal->theData[1] = 0;
|
||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
|
||||
}
|
||||
|
||||
NodeState newState(NodeState::SL_STOPPING_1,
|
||||
StopReq::getSystemStop(c_stopRec.stopReq.requestInfo));
|
||||
|
||||
|
|
@ -2129,9 +2138,11 @@ Ndbcntr::StopRecord::checkNodeFail(Signal* signal){
|
|||
|
||||
stopReq.senderRef = 0;
|
||||
|
||||
NodeState newState(NodeState::SL_STARTED);
|
||||
|
||||
cntr.updateNodeState(signal, newState);
|
||||
if (cntr.getNodeState().startLevel != NodeState::SL_SINGLEUSER)
|
||||
{
|
||||
NodeState newState(NodeState::SL_STARTED);
|
||||
cntr.updateNodeState(signal, newState);
|
||||
}
|
||||
|
||||
signal->theData[0] = EventReport::NDBStopAborted;
|
||||
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 1, JBB);
|
||||
|
|
@ -2227,12 +2238,24 @@ void Ndbcntr::execABORT_ALL_CONF(Signal* signal){
|
|||
jamEntry();
|
||||
if(c_stopRec.stopReq.singleuser) {
|
||||
jam();
|
||||
|
||||
NodeState newState(NodeState::SL_SINGLEUSER);
|
||||
newState.setSingleUser(true);
|
||||
newState.setSingleUserApi(c_stopRec.stopReq.singleUserApi);
|
||||
updateNodeState(signal, newState);
|
||||
c_stopRec.stopInitiatedTime = NdbTick_CurrentMillisecond();
|
||||
|
||||
StopConf * const stopConf = (StopConf *)&signal->theData[0];
|
||||
stopConf->senderData = c_stopRec.stopReq.senderData;
|
||||
stopConf->nodeState = (Uint32) NodeState::SL_SINGLEUSER;
|
||||
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_CONF, signal, StopConf::SignalLength, JBB);
|
||||
|
||||
c_stopRec.stopReq.senderRef = 0; // the command is done
|
||||
|
||||
signal->theData[0] = EventReport::SingleUser;
|
||||
signal->theData[1] = 1;
|
||||
signal->theData[2] = c_stopRec.stopReq.singleUserApi;
|
||||
sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2250,7 +2273,13 @@ void Ndbcntr::execABORT_ALL_CONF(Signal* signal){
|
|||
|
||||
void Ndbcntr::execABORT_ALL_REF(Signal* signal){
|
||||
jamEntry();
|
||||
ndbrequire(false);
|
||||
AbortAllRef *abortAllRef = (AbortAllRef *)&signal->theData[0];
|
||||
AbortAllRef::ErrorCode errorCode = (AbortAllRef::ErrorCode) abortAllRef->errorCode;
|
||||
|
||||
StopRef * const stopRef = (StopRef *)&signal->theData[0];
|
||||
stopRef->senderData = c_stopRec.stopReq.senderData;
|
||||
stopRef->errorCode = StopRef::TransactionAbortFailed;
|
||||
sendSignal(c_stopRec.stopReq.senderRef, GSN_STOP_REF, signal, StopRef::SignalLength, JBB);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1430,9 +1430,8 @@ CommandInterpreter::executeEnterSingleUser(char* parameters)
|
|||
ndbout_c("Entering single user mode for node %d failed", nodeId);
|
||||
printError();
|
||||
} else {
|
||||
ndbout_c("Entering single user mode");
|
||||
ndbout_c("Access will be granted for API node %d only.", nodeId);
|
||||
ndbout_c("Use ALL STATUS to see when single user mode has been entered.");
|
||||
ndbout_c("Single user mode entered");
|
||||
ndbout_c("Access is granted for API node %d only.", nodeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1445,7 +1444,7 @@ CommandInterpreter::executeExitSingleUser(char* parameters)
|
|||
printError();
|
||||
} else {
|
||||
ndbout_c("Exiting single user mode in progress.");
|
||||
ndbout_c("Use ALL STATUS to see when single user mode has been exited.");
|
||||
ndbout_c("Use ALL STATUS or SHOW to see when single user mode has been exited.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -22,11 +22,11 @@
|
|||
#include <NdbCondition.h>
|
||||
#include <mgmapi.h>
|
||||
|
||||
|
||||
#include <NdbTCP.h>
|
||||
#include <ConfigRetriever.hpp>
|
||||
#include <Vector.hpp>
|
||||
#include <NodeBitmask.hpp>
|
||||
#include <signaldata/ManagementServer.hpp>
|
||||
#include "SignalQueue.hpp"
|
||||
#include <ndb_version.h>
|
||||
#include <EventLogger.hpp>
|
||||
#include <signaldata/EventSubscribeReq.hpp>
|
||||
|
|
@ -213,17 +213,6 @@ public:
|
|||
// COULD_NOT_ALLOCATE_MEMORY, SEND_OR_RECEIVE_FAILED
|
||||
|
||||
|
||||
typedef void (* StopCallback)(int nodeId, void * anyData, int errorCode);
|
||||
|
||||
typedef void (* VersionCallback)(int nodeId, int version,
|
||||
void * anyData, int errorCode);
|
||||
|
||||
|
||||
typedef void (* EnterSingleCallback)(int nodeId, void * anyData,
|
||||
int errorCode);
|
||||
typedef void (* ExitSingleCallback)(int nodeId, void * anyData,
|
||||
int errorCode);
|
||||
|
||||
/**
|
||||
* Lock configuration
|
||||
*/
|
||||
|
|
@ -272,12 +261,12 @@ public:
|
|||
* @param processId: Id of the DB process to stop
|
||||
* @return 0 if succeeded, otherwise: as stated above, plus:
|
||||
*/
|
||||
int stopNode(int nodeId, bool abort = false, StopCallback = 0, void *any= 0);
|
||||
int stopNode(int nodeId, bool abort = false);
|
||||
|
||||
/**
|
||||
* Stop the system
|
||||
*/
|
||||
int stop(int * cnt = 0, bool abort = false, StopCallback = 0, void *any = 0);
|
||||
int stop(int * cnt = 0, bool abort = false);
|
||||
|
||||
/**
|
||||
* print version info about a node
|
||||
|
|
@ -285,27 +274,18 @@ public:
|
|||
* @param processId: Id of the DB process to stop
|
||||
* @return 0 if succeeded, otherwise: as stated above, plus:
|
||||
*/
|
||||
int versionNode(int nodeId, bool abort = false,
|
||||
VersionCallback = 0, void *any= 0);
|
||||
int versionNode(int nodeId, Uint32 &version);
|
||||
|
||||
/**
|
||||
* print version info about all node in the system
|
||||
*/
|
||||
int version(int * cnt = 0, bool abort = false,
|
||||
VersionCallback = 0, void *any = 0);
|
||||
|
||||
/**
|
||||
* Maintenance on the system
|
||||
*/
|
||||
int enterSingleUser(int * cnt = 0, Uint32 singleuserNodeId = 0,
|
||||
EnterSingleCallback = 0, void *any = 0);
|
||||
int enterSingleUser(int * cnt = 0, Uint32 singleuserNodeId = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Resume from maintenance on the system
|
||||
*/
|
||||
int exitSingleUser(int * cnt = 0, bool abort = false,
|
||||
ExitSingleCallback = 0, void *any = 0);
|
||||
int exitSingleUser(int * cnt = 0, bool abort = false);
|
||||
|
||||
/**
|
||||
* Start DB process.
|
||||
|
|
@ -319,15 +299,14 @@ public:
|
|||
* @param processId: Id of the DB process to start
|
||||
*/
|
||||
int restartNode(int processId, bool nostart, bool initialStart,
|
||||
bool abort = false,
|
||||
StopCallback = 0, void * anyData = 0);
|
||||
bool abort = false);
|
||||
|
||||
/**
|
||||
* Restart the system
|
||||
*/
|
||||
int restart(bool nostart, bool initialStart,
|
||||
bool abort = false,
|
||||
int * stopCount = 0, StopCallback = 0, void * anyData = 0);
|
||||
int * stopCount = 0);
|
||||
|
||||
struct BackupEvent {
|
||||
enum Event {
|
||||
|
|
@ -518,7 +497,17 @@ private:
|
|||
//**************************************************************************
|
||||
|
||||
int setEventReportingLevel(int processId, LogLevel::EventCategory, Uint32);
|
||||
|
||||
void set_common_stop_req_params(void *stopReq);
|
||||
|
||||
int sendSTOP_REQ(NodeId nodeId,
|
||||
NodeBitmask &stoppedNodes,
|
||||
Uint32 singleUserNodeId,
|
||||
bool abort,
|
||||
bool stop,
|
||||
bool restart,
|
||||
bool nostart,
|
||||
bool initialStart);
|
||||
|
||||
/**
|
||||
* Check if it is possible to send a signal to a (DB) process
|
||||
*
|
||||
|
|
@ -608,59 +597,8 @@ private:
|
|||
enum WaitSignalType {
|
||||
NO_WAIT, // We don't expect to receive any signal
|
||||
WAIT_SET_VAR, // Accept SET_VAR_CONF and SET_VAR_REF
|
||||
WAIT_SUBSCRIBE_CONF, // Accept event subscription confirmation
|
||||
WAIT_STOP,
|
||||
WAIT_BACKUP_STARTED,
|
||||
WAIT_BACKUP_COMPLETED,
|
||||
WAIT_VERSION,
|
||||
WAIT_NODEFAILURE
|
||||
WAIT_SUBSCRIBE_CONF // Accept event subscription confirmation
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an unused signal
|
||||
* @return A signal if succeeded, NULL otherwise
|
||||
*/
|
||||
NdbApiSignal* getSignal();
|
||||
|
||||
/**
|
||||
* Add a signal to the list of unused signals
|
||||
* @param signal: The signal to add
|
||||
*/
|
||||
void releaseSignal(NdbApiSignal* signal);
|
||||
|
||||
/**
|
||||
* Remove a signal from the list of unused signals and delete
|
||||
* the memory for it.
|
||||
*/
|
||||
void freeSignal();
|
||||
|
||||
/**
|
||||
* Send a signal
|
||||
* @param processId: Id of the receiver process
|
||||
* @param waitState: State denoting a set of signals we accept to receive
|
||||
* @param signal: The signal to send
|
||||
* @return 0 if succeeded, -1 otherwise
|
||||
*/
|
||||
int sendSignal(Uint16 processId, WaitSignalType waitState,
|
||||
NdbApiSignal* signal, bool force = false);
|
||||
|
||||
/**
|
||||
* Send a signal and wait for an answer signal
|
||||
* @param processId: Id of the receiver process
|
||||
* @param waitState: State denoting a set of signals we accept to receive.
|
||||
* @param signal: The signal to send
|
||||
* @return 0 if succeeded, -1 otherwise (for example failed to send or
|
||||
* failed to receive expected signal).
|
||||
*/
|
||||
int sendRecSignal(Uint16 processId, WaitSignalType waitState,
|
||||
NdbApiSignal* signal, bool force = false,
|
||||
int waitTime = WAIT_FOR_RESPONSE_TIMEOUT);
|
||||
|
||||
/**
|
||||
* Wait for a signal to arrive.
|
||||
* @return 0 if signal arrived, -1 otherwise
|
||||
*/
|
||||
int receiveOptimisedResponse(int waitTime);
|
||||
|
||||
/**
|
||||
* This function is called from "outside" of MgmtSrvr
|
||||
|
|
@ -671,7 +609,7 @@ private:
|
|||
static void signalReceivedNotification(void* mgmtSrvr,
|
||||
NdbApiSignal* signal,
|
||||
struct LinearSectionPtr ptr[3]);
|
||||
|
||||
|
||||
/**
|
||||
* Called from "outside" of MgmtSrvr when a DB process has died.
|
||||
* @param mgmtSrvr: The MgmtSrvr object wreceiveOptimisedResponsehich
|
||||
|
|
@ -708,31 +646,7 @@ private:
|
|||
|
||||
class TransporterFacade * theFacade;
|
||||
|
||||
class SignalQueue m_signalRecvQueue;
|
||||
|
||||
struct StopRecord {
|
||||
StopRecord(){ inUse = false; callback = 0; singleUserMode = false;}
|
||||
bool inUse;
|
||||
bool singleUserMode;
|
||||
int sentCount;
|
||||
int reply;
|
||||
int nodeId;
|
||||
void * anyData;
|
||||
StopCallback callback;
|
||||
};
|
||||
StopRecord m_stopRec;
|
||||
|
||||
struct VersionRecord {
|
||||
VersionRecord(){ inUse = false; callback = 0;}
|
||||
bool inUse;
|
||||
Uint32 version[MAX_NODES];
|
||||
VersionCallback callback;
|
||||
};
|
||||
VersionRecord m_versionRec;
|
||||
int sendVersionReq( int processId);
|
||||
|
||||
|
||||
void handleStopReply(NodeId nodeId, Uint32 errCode);
|
||||
int sendVersionReq( int processId, Uint32 &version);
|
||||
int translateStopRef(Uint32 errCode);
|
||||
|
||||
bool _isStopThread;
|
||||
|
|
@ -753,14 +667,8 @@ private:
|
|||
static void *logLevelThread_C(void *);
|
||||
void logLevelThreadRun();
|
||||
|
||||
struct NdbThread *m_signalRecvThread;
|
||||
static void *signalRecvThread_C(void *);
|
||||
void signalRecvThreadRun();
|
||||
|
||||
Config *_props;
|
||||
|
||||
int send(class NdbApiSignal* signal, Uint32 node, Uint32 node_type);
|
||||
|
||||
ConfigRetriever *m_config_retriever;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
#include <ConfigRetriever.hpp>
|
||||
#include <ndb_version.h>
|
||||
|
||||
#if 0 // code must be rewritten to use SignalSender
|
||||
|
||||
void
|
||||
MgmtSrvr::handle_MGM_LOCK_CONFIG_REQ(NdbApiSignal *signal) {
|
||||
NodeId sender = refToNode(signal->theSendersBlockRef);
|
||||
|
|
@ -221,6 +223,8 @@ MgmtSrvr::unlockConf(bool commit) {
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif // code must be rewritten to use SignalSender
|
||||
|
||||
/**
|
||||
* Commit the new configuration
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,123 +20,3 @@
|
|||
// Some kind of reuse should be preferred.
|
||||
//******************************************************************************
|
||||
|
||||
#include "MgmtSrvr.hpp"
|
||||
#include <NdbApiSignal.hpp>
|
||||
#include <NdbTick.h>
|
||||
|
||||
|
||||
NdbApiSignal*
|
||||
MgmtSrvr::getSignal()
|
||||
{
|
||||
NdbApiSignal* tSignal;
|
||||
tSignal = theSignalIdleList;
|
||||
if (tSignal != NULL){
|
||||
NdbApiSignal* tSignalNext = tSignal->next();
|
||||
tSignal->next(NULL);
|
||||
theSignalIdleList = tSignalNext;
|
||||
return tSignal;
|
||||
} else
|
||||
{
|
||||
tSignal = new NdbApiSignal(_ownReference);
|
||||
if (tSignal != NULL)
|
||||
tSignal->next(NULL);
|
||||
}
|
||||
return tSignal;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MgmtSrvr::releaseSignal(NdbApiSignal* aSignal)
|
||||
{
|
||||
aSignal->next(theSignalIdleList);
|
||||
theSignalIdleList = aSignal;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MgmtSrvr::freeSignal()
|
||||
{
|
||||
NdbApiSignal* tSignal = theSignalIdleList;
|
||||
theSignalIdleList = tSignal->next();
|
||||
delete tSignal;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
MgmtSrvr::sendSignal(Uint16 aNodeId,
|
||||
WaitSignalType aWaitState,
|
||||
NdbApiSignal* aSignal,
|
||||
bool force)
|
||||
{
|
||||
int tReturnCode;
|
||||
theFacade->lock_mutex();
|
||||
if(force){
|
||||
tReturnCode = theFacade->sendSignalUnCond(aSignal,
|
||||
aNodeId);
|
||||
} else {
|
||||
tReturnCode = theFacade->sendSignal(aSignal,
|
||||
aNodeId);
|
||||
}
|
||||
releaseSignal(aSignal);
|
||||
if (tReturnCode == -1) {
|
||||
theFacade->unlock_mutex();
|
||||
return -1;
|
||||
}
|
||||
theWaitState = aWaitState;
|
||||
theFacade->unlock_mutex();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
MgmtSrvr::sendRecSignal(Uint16 aNodeId,
|
||||
WaitSignalType aWaitState,
|
||||
NdbApiSignal* aSignal,
|
||||
bool force,
|
||||
int waitTime)
|
||||
{
|
||||
int tReturnCode;
|
||||
theFacade->lock_mutex();
|
||||
if(force){
|
||||
tReturnCode = theFacade->sendSignalUnCond(aSignal, aNodeId);
|
||||
} else {
|
||||
tReturnCode = theFacade->sendSignalUnCond(aSignal, aNodeId);
|
||||
}
|
||||
releaseSignal(aSignal);
|
||||
if (tReturnCode == -1) {
|
||||
theFacade->unlock_mutex();
|
||||
return -1;
|
||||
}
|
||||
theWaitState = aWaitState;
|
||||
theWaitNode = aNodeId;
|
||||
return receiveOptimisedResponse(waitTime);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
MgmtSrvr::receiveOptimisedResponse(int waitTime)
|
||||
{
|
||||
int tResultCode;
|
||||
theFacade->checkForceSend(_blockNumber);
|
||||
NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime;
|
||||
|
||||
while (theWaitState != NO_WAIT && theWaitState != WAIT_NODEFAILURE
|
||||
&& waitTime > 0) {
|
||||
NdbCondition_WaitTimeout(theMgmtWaitForResponseCondPtr,
|
||||
theFacade->theMutexPtr,
|
||||
waitTime);
|
||||
if(theWaitState == NO_WAIT || theWaitState == WAIT_NODEFAILURE)
|
||||
break;
|
||||
waitTime = (maxTime - NdbTick_CurrentMillisecond());
|
||||
}//while
|
||||
|
||||
if(theWaitState == NO_WAIT) {
|
||||
tResultCode = 0;
|
||||
} else {
|
||||
tResultCode = -1;
|
||||
}
|
||||
theFacade->unlock_mutex();
|
||||
return tResultCode;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1203,7 +1203,11 @@ MgmApiSession::setLogFilter(Parser_t::Context &ctx,
|
|||
void
|
||||
MgmApiSession::configLock(Parser_t::Context &,
|
||||
Properties const &) {
|
||||
#if 0 // not implemented
|
||||
int ret = m_mgmsrv.lockConf();
|
||||
#else
|
||||
int ret = -1;
|
||||
#endif
|
||||
m_output->println("config lock reply");
|
||||
m_output->println("result: %d", ret);
|
||||
m_output->println("");
|
||||
|
|
@ -1214,7 +1218,11 @@ MgmApiSession::configUnlock(Parser_t::Context &,
|
|||
Properties const &args) {
|
||||
Uint32 commit;
|
||||
args.get("commit", &commit);
|
||||
#if 0 // not implemented
|
||||
int ret = m_mgmsrv.unlockConf(commit == 1);
|
||||
#else
|
||||
int ret = -1;
|
||||
#endif
|
||||
m_output->println("config unlock reply");
|
||||
m_output->println("result: %d", ret);
|
||||
m_output->println("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue