diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2007-03-02 11:41:21 +0100 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2007-03-02 11:41:21 +0100 |
commit | be3d4002f732337e0a264e91320756b1788d5acf (patch) | |
tree | 9cfd27c8e0fa2048a24e3147dab5eafea1000e08 /storage/ndb | |
parent | 4c3a363b5e8e07dd36919f7a64a1894649cd1aa8 (diff) | |
parent | af0554d133a412637d93160d1c8a6a183db793be (diff) | |
download | mariadb-git-be3d4002f732337e0a264e91320756b1788d5acf.tar.gz |
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-telco-gca
into perch.ndb.mysql.com:/home/jonas/src/51-work
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
merge
Diffstat (limited to 'storage/ndb')
20 files changed, 252 insertions, 111 deletions
diff --git a/storage/ndb/include/kernel/signaldata/AlterTable.hpp b/storage/ndb/include/kernel/signaldata/AlterTable.hpp index 6469e673370..3d348f8582a 100644 --- a/storage/ndb/include/kernel/signaldata/AlterTable.hpp +++ b/storage/ndb/include/kernel/signaldata/AlterTable.hpp @@ -212,7 +212,8 @@ public: NullablePrimaryKey = 740, UnsupportedChange = 741, BackupInProgress = 762, - IncompatibleVersions = 763 + IncompatibleVersions = 763, + SingleUser = 299 }; private: diff --git a/storage/ndb/include/kernel/signaldata/CreateIndx.hpp b/storage/ndb/include/kernel/signaldata/CreateIndx.hpp index 58a5c2ced93..74f1237c383 100644 --- a/storage/ndb/include/kernel/signaldata/CreateIndx.hpp +++ b/storage/ndb/include/kernel/signaldata/CreateIndx.hpp @@ -208,6 +208,7 @@ public: AllocationError = 4252, CreateIndexTableFailed = 4253, DuplicateAttributes = 4258, + SingleUser = 299, TableIsTemporary = 776, TableIsNotTemporary = 777, NoLoggingTemporaryIndex = 778 diff --git a/storage/ndb/include/kernel/signaldata/CreateTable.hpp b/storage/ndb/include/kernel/signaldata/CreateTable.hpp index 4257c0b20eb..6ee304fcad8 100644 --- a/storage/ndb/include/kernel/signaldata/CreateTable.hpp +++ b/storage/ndb/include/kernel/signaldata/CreateTable.hpp @@ -92,6 +92,7 @@ public: InvalidPrimaryKeySize = 739, NullablePrimaryKey = 740, InvalidCharset = 743, + SingleUser = 299, InvalidTablespace = 755, VarsizeBitfieldNotSupported = 757, NotATablespace = 758, diff --git a/storage/ndb/include/kernel/signaldata/DropIndx.hpp b/storage/ndb/include/kernel/signaldata/DropIndx.hpp index 01d500f2d84..6e3b183995f 100644 --- a/storage/ndb/include/kernel/signaldata/DropIndx.hpp +++ b/storage/ndb/include/kernel/signaldata/DropIndx.hpp @@ -172,7 +172,8 @@ public: IndexNotFound = 4243, BadRequestType = 4247, InvalidName = 4248, - NotAnIndex = 4254 + NotAnIndex = 4254, + SingleUser = 299 }; STATIC_CONST( SignalLength = DropIndxConf::SignalLength + 3 ); diff --git a/storage/ndb/include/kernel/signaldata/DropTable.hpp b/storage/ndb/include/kernel/signaldata/DropTable.hpp index 36268b23be1..c0a4596e1dc 100644 --- a/storage/ndb/include/kernel/signaldata/DropTable.hpp +++ b/storage/ndb/include/kernel/signaldata/DropTable.hpp @@ -58,7 +58,8 @@ public: InvalidTableVersion = 241, DropInProgress = 283, NoDropTableRecordAvailable = 1229, - BackupInProgress = 761 + BackupInProgress = 761, + SingleUser = 299 }; }; diff --git a/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp index 27bb9af03c0..46c5ef3751b 100644 --- a/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp +++ b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp @@ -107,7 +107,10 @@ public: CmvmiDumpLongSignalMemory = 2601, CmvmiSetRestartOnErrorInsert = 2602, CmvmiTestLongSigWithDelay = 2603, - + CmvmiDumpSubscriptions = 2604, /* note: done to respective outfile + to be able to debug if events + for some reason does not end up + in clusterlog */ LCPContinue = 5900, // 7000 DIH // 7001 DIH diff --git a/storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp b/storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp index 54048bcbb35..a5f585c23f0 100644 --- a/storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp +++ b/storage/ndb/src/common/debugger/signaldata/PackedSignal.cpp @@ -96,6 +96,8 @@ printPACKED_SIGNAL(FILE * output, const Uint32 * theData, Uint32 len, Uint16 rec } default: fprintf(output, "Unknown signal type\n"); + i = len; // terminate printing + break; } }//for fprintf(output, "--------- End Packed Signals ----------\n"); diff --git a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp index 57828fa928f..e1ec85ff179 100644 --- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp +++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp @@ -921,7 +921,7 @@ void Cmvmi::execSET_VAR_REQ(Signal* signal) case TimeToWaitAlive: // QMGR - case HeartbeatIntervalDbDb: // TODO ev till Ndbcnt också + case HeartbeatIntervalDbDb: // TODO possibly Ndbcnt too case HeartbeatIntervalDbApi: case ArbitTimeout: sendSignal(QMGR_REF, GSN_SET_VAR_REQ, signal, 3, JBB); @@ -1129,6 +1129,24 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal) } } + if (arg == DumpStateOrd::CmvmiDumpSubscriptions) + { + SubscriberPtr ptr; + subscribers.first(ptr); + g_eventLogger.info("List subscriptions:"); + while(ptr.i != RNIL) + { + g_eventLogger.info("Subscription: %u, nodeId: %u, ref: 0x%x", + ptr.i, refToNode(ptr.p->blockRef), ptr.p->blockRef); + for(Uint32 i = 0; i < LogLevel::LOGLEVEL_CATEGORIES; i++) + { + Uint32 level = ptr.p->logLevel.getLogLevel((LogLevel::EventCategory)i); + g_eventLogger.info("Category %u Level %u", i, level); + } + subscribers.next(ptr); + } + } + if (arg == DumpStateOrd::CmvmiDumpLongSignalMemory){ infoEvent("Cmvmi: g_sectionSegmentPool size: %d free: %d", g_sectionSegmentPool.getSize(), diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index cae9e8432f5..64b2c4597e4 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -3759,6 +3759,15 @@ Dbdict::execCREATE_TABLE_REQ(Signal* signal){ break; } + if(getNodeState().getSingleUserMode() && + (refToNode(signal->getSendersBlockRef()) != + getNodeState().getSingleUserApi())) + { + jam(); + parseRecord.errorCode = CreateTableRef::SingleUser; + break; + } + CreateTableRecordPtr createTabPtr; c_opCreateTable.seize(createTabPtr); @@ -3951,6 +3960,15 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal) return; } + if(getNodeState().getSingleUserMode() && + (refToNode(signal->getSendersBlockRef()) != + getNodeState().getSingleUserApi())) + { + jam(); + alterTableRef(signal, req, AlterTableRef::SingleUser); + return; + } + const TableRecord::TabState tabState = tablePtr.p->tabState; bool ok = false; switch(tabState){ @@ -6550,6 +6568,15 @@ Dbdict::execDROP_TABLE_REQ(Signal* signal){ return; } + if(getNodeState().getSingleUserMode() && + (refToNode(signal->getSendersBlockRef()) != + getNodeState().getSingleUserApi())) + { + jam(); + dropTableRef(signal, req, DropTableRef::SingleUser); + return; + } + const TableRecord::TabState tabState = tablePtr.p->tabState; bool ok = false; switch(tabState){ @@ -7758,6 +7785,13 @@ Dbdict::execCREATE_INDX_REQ(Signal* signal) jam(); tmperr = CreateIndxRef::Busy; } + else if(getNodeState().getSingleUserMode() && + (refToNode(senderRef) != + getNodeState().getSingleUserApi())) + { + jam(); + tmperr = CreateIndxRef::SingleUser; + } if (tmperr != CreateIndxRef::NoError) { releaseSections(signal); OpCreateIndex opBusy; @@ -8401,6 +8435,13 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) jam(); tmperr = DropIndxRef::Busy; } + else if(getNodeState().getSingleUserMode() && + (refToNode(senderRef) != + getNodeState().getSingleUserApi())) + { + jam(); + tmperr = DropIndxRef::SingleUser; + } if (tmperr != DropIndxRef::NoError) { err = tmperr; goto error; diff --git a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index 1583646704f..a93a93fd724 100644 --- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -1831,8 +1831,8 @@ void Dbdih::execSTART_PERMREQ(Signal* signal) return; }//if if (getNodeStatus(nodeId) != NodeRecord::DEAD){ - ndbout << "nodeStatus in START_PERMREQ = " - << (Uint32) getNodeStatus(nodeId) << endl; + g_eventLogger.error("nodeStatus in START_PERMREQ = %u", + (Uint32) getNodeStatus(nodeId)); ndbrequire(false); }//if @@ -4245,9 +4245,9 @@ void Dbdih::checkCopyTab(NodeRecordPtr failedNodePtr) jam(); break; default: - ndbout_c("outstanding gsn: %s(%d)", - getSignalName(c_nodeStartMaster.m_outstandingGsn), - c_nodeStartMaster.m_outstandingGsn); + g_eventLogger.error("outstanding gsn: %s(%d)", + getSignalName(c_nodeStartMaster.m_outstandingGsn), + c_nodeStartMaster.m_outstandingGsn); ndbrequire(false); } @@ -4700,9 +4700,10 @@ void Dbdih::failedNodeLcpHandling(Signal* signal, NodeRecordPtr failedNodePtr) failedNodePtr.p->activeStatus = Sysfile::NS_NotActive_NotTakenOver; break; default: - ndbout << "activeStatus = " << (Uint32) failedNodePtr.p->activeStatus; - ndbout << " at failure after NODE_FAILREP of node = "; - ndbout << failedNodePtr.i << endl; + g_eventLogger.error("activeStatus = %u " + "at failure after NODE_FAILREP of node = %u", + (Uint32) failedNodePtr.p->activeStatus, + failedNodePtr.i); ndbrequire(false); break; }//switch @@ -4859,7 +4860,7 @@ Dbdih::startLcpMasterTakeOver(Signal* signal, Uint32 nodeId){ /** * Node failure during master take over... */ - ndbout_c("Nodefail during master take over (old: %d)", oldNode); + g_eventLogger.info("Nodefail during master take over (old: %d)", oldNode); } NodeRecordPtr nodePtr; @@ -5112,7 +5113,8 @@ void Dbdih::execMASTER_GCPCONF(Signal* signal) if (latestLcpId > SYSFILE->latestLCP_ID) { jam(); #if 0 - ndbout_c("Dbdih: Setting SYSFILE->latestLCP_ID to %d", latestLcpId); + g_eventLogger.info("Dbdih: Setting SYSFILE->latestLCP_ID to %d", + latestLcpId); SYSFILE->latestLCP_ID = latestLcpId; #endif SYSFILE->keepGCI = oldestKeepGci; @@ -5771,7 +5773,7 @@ Dbdih::checkLocalNodefailComplete(Signal* signal, Uint32 failedNodeId, if (ERROR_INSERTED(7030)) { - ndbout_c("Reenable GCP_PREPARE"); + g_eventLogger.info("Reenable GCP_PREPARE"); CLEAR_ERROR_INSERT_VALUE; } @@ -5952,7 +5954,7 @@ Dbdih::sendMASTER_LCPCONF(Signal * signal){ c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__); #if 0 if(c_copyGCISlave.m_copyReason == CopyGCIReq::LOCAL_CHECKPOINT){ - ndbout_c("Dbdih: Also resetting c_copyGCISlave"); + g_eventLogger.info("Dbdih: Also resetting c_copyGCISlave"); c_copyGCISlave.m_copyReason = CopyGCIReq::IDLE; c_copyGCISlave.m_expectedNextWord = 0; } @@ -6037,7 +6039,7 @@ Dbdih::sendMASTER_LCPCONF(Signal * signal){ if(c_lcpState.lcpStatus == LCP_TAB_SAVED){ #ifdef VM_TRACE - ndbout_c("Sending extra GSN_LCP_COMPLETE_REP to new master"); + g_eventLogger.info("Sending extra GSN_LCP_COMPLETE_REP to new master"); #endif sendLCP_COMPLETE_REP(signal); } @@ -6195,7 +6197,7 @@ void Dbdih::execMASTER_LCPCONF(Signal* signal) CRASH_INSERTION(7180); #ifdef VM_TRACE - ndbout_c("MASTER_LCPCONF"); + g_eventLogger.info("MASTER_LCPCONF"); printMASTER_LCP_CONF(stdout, &signal->theData[0], 0, 0); #endif @@ -6272,7 +6274,7 @@ void Dbdih::MASTER_LCPhandling(Signal* signal, Uint32 failedNodeId) // protocol. /* --------------------------------------------------------------------- */ #ifdef VM_TRACE - ndbout_c("MASTER_LCPhandling:: LMTOS_ALL_IDLE -> checkLcpStart"); + g_eventLogger.info("MASTER_LCPhandling:: LMTOS_ALL_IDLE -> checkLcpStart"); #endif checkLcpStart(signal, __LINE__); break; @@ -6283,7 +6285,7 @@ void Dbdih::MASTER_LCPhandling(Signal* signal, Uint32 failedNodeId) // protocol by calculating the keep gci and storing the new lcp id. /* --------------------------------------------------------------------- */ #ifdef VM_TRACE - ndbout_c("MASTER_LCPhandling:: LMTOS_COPY_ONGOING -> storeNewLcpId"); + g_eventLogger.info("MASTER_LCPhandling:: LMTOS_COPY_ONGOING -> storeNewLcpId"); #endif if (c_lcpState.lcpStatus == LCP_STATUS_ACTIVE) { jam(); @@ -6294,7 +6296,7 @@ void Dbdih::MASTER_LCPhandling(Signal* signal, Uint32 failedNodeId) /*---------------------------------------------------------------------*/ Uint32 lcpId = SYSFILE->latestLCP_ID; #ifdef VM_TRACE - ndbout_c("Decreasing latestLCP_ID from %d to %d", lcpId, lcpId - 1); + g_eventLogger.info("Decreasing latestLCP_ID from %d to %d", lcpId, lcpId - 1); #endif SYSFILE->latestLCP_ID--; }//if @@ -6311,10 +6313,10 @@ void Dbdih::MASTER_LCPhandling(Signal* signal, Uint32 failedNodeId) * complete before finalising the LCP process. * ------------------------------------------------------------------ */ #ifdef VM_TRACE - ndbout_c("MASTER_LCPhandling:: LMTOS_ALL_ACTIVE -> " - "startLcpRoundLoopLab(table=%u, fragment=%u)", - c_lcpMasterTakeOverState.minTableId, - c_lcpMasterTakeOverState.minFragId); + g_eventLogger.info("MASTER_LCPhandling:: LMTOS_ALL_ACTIVE -> " + "startLcpRoundLoopLab(table=%u, fragment=%u)", + c_lcpMasterTakeOverState.minTableId, + c_lcpMasterTakeOverState.minFragId); #endif c_lcpState.keepGci = SYSFILE->keepGCI; @@ -7718,8 +7720,8 @@ void Dbdih::checkGcpStopLab(Signal* signal) if (cgcpSameCounter == 1200) { jam(); #ifdef VM_TRACE - ndbout << "System crash due to GCP Stop in state = "; - ndbout << (Uint32) cgcpStatus << endl; + g_eventLogger.error("System crash due to GCP Stop in state = %u", + (Uint32) cgcpStatus); #endif crashSystemAtGcpStop(signal); return; @@ -7732,8 +7734,8 @@ void Dbdih::checkGcpStopLab(Signal* signal) if (cgcpSameCounter == 1200) { jam(); #ifdef VM_TRACE - ndbout << "System crash due to GCP Stop in state = "; - ndbout << (Uint32) cgcpStatus << endl; + g_eventLogger.error("System crash due to GCP Stop in state = %u", + (Uint32) cgcpStatus); #endif crashSystemAtGcpStop(signal); return; @@ -7924,7 +7926,7 @@ void Dbdih::GCP_SAVEhandling(Signal* signal, Uint32 nodeId) getNodeState().startLevel == NodeState::SL_STARTED){ jam(); #if 0 - ndbout_c("Dbdih: Clearing initial start ongoing"); + g_eventLogger.info("Dbdih: Clearing initial start ongoing"); #endif Sysfile::clearInitialStartOngoing(SYSFILE->systemRestartBits); } @@ -7943,7 +7945,7 @@ void Dbdih::execGCP_PREPARE(Signal* signal) if (ERROR_INSERTED(7030)) { cgckptflag = true; - ndbout_c("Delayed GCP_PREPARE 5s"); + g_eventLogger.info("Delayed GCP_PREPARE 5s"); sendSignalWithDelay(reference(), GSN_GCP_PREPARE, signal, 5000, signal->getLength()); return; @@ -7963,7 +7965,7 @@ void Dbdih::execGCP_PREPARE(Signal* signal) if (ERROR_INSERTED(7031)) { - ndbout_c("Crashing delayed in GCP_PREPARE 3s"); + g_eventLogger.info("Crashing delayed in GCP_PREPARE 3s"); signal->theData[0] = 9999; sendSignalWithDelay(CMVMI_REF, GSN_NDB_TAMPER, signal, 3000, 1); return; @@ -8487,7 +8489,7 @@ void Dbdih::initLcpLab(Signal* signal, Uint32 senderRef, Uint32 tableId) * This is LCP master takeover */ #ifdef VM_TRACE - ndbout_c("initLcpLab aborted due to LCP master takeover - 1"); + g_eventLogger.info("initLcpLab aborted due to LCP master takeover - 1"); #endif c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__); sendMASTER_LCPCONF(signal); @@ -8500,7 +8502,7 @@ void Dbdih::initLcpLab(Signal* signal, Uint32 senderRef, Uint32 tableId) * Master take over but has not yet received MASTER_LCPREQ */ #ifdef VM_TRACE - ndbout_c("initLcpLab aborted due to LCP master takeover - 2"); + g_eventLogger.info("initLcpLab aborted due to LCP master takeover - 2"); #endif return; } @@ -9809,9 +9811,10 @@ void Dbdih::checkTcCounterLab(Signal* signal) { CRASH_INSERTION(7009); if (c_lcpState.lcpStatus != LCP_STATUS_IDLE) { - ndbout << "lcpStatus = " << (Uint32) c_lcpState.lcpStatus; - ndbout << "lcpStatusUpdatedPlace = " << - c_lcpState.lcpStatusUpdatedPlace << endl; + g_eventLogger.error("lcpStatus = %u" + "lcpStatusUpdatedPlace = %d", + (Uint32) c_lcpState.lcpStatus, + c_lcpState.lcpStatusUpdatedPlace); ndbrequire(false); return; }//if @@ -10394,9 +10397,8 @@ void Dbdih::execLCP_FRAG_REP(Signal* signal) if(tabPtr.p->tabStatus == TabRecord::TS_DROPPING){ jam(); - ndbout_c("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ", - tableId, - fragId); + g_eventLogger.info("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ", + tableId, fragId); } else { jam(); /** @@ -10526,7 +10528,7 @@ void Dbdih::findReplica(ReplicaRecordPtr& replicaPtr, }; #ifdef VM_TRACE - ndbout_c("Fragment Replica(node=%d) not found", nodeId); + g_eventLogger.info("Fragment Replica(node=%d) not found", nodeId); replicaPtr.i = fragPtrP->oldStoredReplicas; while(replicaPtr.i != RNIL){ ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord); @@ -10539,9 +10541,9 @@ void Dbdih::findReplica(ReplicaRecordPtr& replicaPtr, }//if }; if(replicaPtr.i != RNIL){ - ndbout_c("...But was found in oldStoredReplicas"); + g_eventLogger.info("...But was found in oldStoredReplicas"); } else { - ndbout_c("...And wasn't found in oldStoredReplicas"); + g_eventLogger.info("...And wasn't found in oldStoredReplicas"); } #endif ndbrequire(false); @@ -10608,8 +10610,8 @@ Dbdih::reportLcpCompletion(const LcpFragRep* lcpReport) if(lcpNo != replicaPtr.p->nextLcp){ if (handle_invalid_lcp_no(lcpReport, replicaPtr)) { - ndbout_c("lcpNo = %d replicaPtr.p->nextLcp = %d", - lcpNo, replicaPtr.p->nextLcp); + g_eventLogger.error("lcpNo = %d replicaPtr.p->nextLcp = %d", + lcpNo, replicaPtr.p->nextLcp); ndbrequire(false); } } @@ -10645,7 +10647,7 @@ Dbdih::reportLcpCompletion(const LcpFragRep* lcpReport) // Not all fragments in table have been checkpointed. /* ----------------------------------------------------------------- */ if(0) - ndbout_c("reportLcpCompletion: fragment %d not ready", fid); + g_eventLogger.info("reportLcpCompletion: fragment %d not ready", fid); return false; }//if }//for @@ -10773,7 +10775,7 @@ void Dbdih::execLCP_COMPLETE_REP(Signal* signal) jamEntry(); #if 0 - ndbout_c("LCP_COMPLETE_REP"); + g_eventLogger.info("LCP_COMPLETE_REP"); printLCP_COMPLETE_REP(stdout, signal->getDataPtr(), signal->length(), number()); @@ -10859,7 +10861,7 @@ void Dbdih::allNodesLcpCompletedLab(Signal* signal) if(c_lcpMasterTakeOverState.state != LMTOS_IDLE){ jam(); #ifdef VM_TRACE - ndbout_c("Exiting from allNodesLcpCompletedLab"); + g_eventLogger.info("Exiting from allNodesLcpCompletedLab"); #endif return; } @@ -11096,14 +11098,14 @@ void Dbdih::crashSystemAtGcpStop(Signal* signal) infoEvent("Detected GCP stop...sending kill to %s", c_GCP_SAVEREQ_Counter.getText()); - ndbout_c("Detected GCP stop...sending kill to %s", - c_GCP_SAVEREQ_Counter.getText()); + g_eventLogger.error("Detected GCP stop...sending kill to %s", + c_GCP_SAVEREQ_Counter.getText()); return; } case GCP_SAVE_LQH_FINISHED: - ndbout_c("m_copyReason: %d m_waiting: %d", - c_copyGCIMaster.m_copyReason, - c_copyGCIMaster.m_waiting); + g_eventLogger.error("m_copyReason: %d m_waiting: %d", + c_copyGCIMaster.m_copyReason, + c_copyGCIMaster.m_waiting); break; case GCP_READY: // shut up lint case GCP_PREPARE_SENT: @@ -11111,11 +11113,11 @@ void Dbdih::crashSystemAtGcpStop(Signal* signal) break; } - ndbout_c("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d", - c_copyGCISlave.m_senderData, - c_copyGCISlave.m_senderRef, - c_copyGCISlave.m_copyReason, - c_copyGCISlave.m_expectedNextWord); + g_eventLogger.error("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d", + c_copyGCISlave.m_senderData, + c_copyGCISlave.m_senderRef, + c_copyGCISlave.m_copyReason, + c_copyGCISlave.m_expectedNextWord); FileRecordPtr file0Ptr; file0Ptr.i = crestartInfoFile[0]; @@ -13325,9 +13327,9 @@ void Dbdih::setLcpActiveStatusEnd() nodePtr.i = getOwnNodeId(); ptrAss(nodePtr, nodeRecord); ndbrequire(nodePtr.p->activeStatus == Sysfile::NS_Active); - ndbout_c("NR: setLcpActiveStatusEnd - m_participatingLQH"); + g_eventLogger.info("NR: setLcpActiveStatusEnd - m_participatingLQH"); } else { - ndbout_c("NR: setLcpActiveStatusEnd - !m_participatingLQH"); + g_eventLogger.info("NR: setLcpActiveStatusEnd - !m_participatingLQH"); } } @@ -14159,8 +14161,8 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) } if(arg == DumpStateOrd::EnableUndoDelayDataWrite){ - ndbout << "Dbdih:: delay write of datapages for table = " - << dumpState->args[1]<< endl; + g_eventLogger.info("Dbdih:: delay write of datapages for table = %s", + dumpState->args[1]); // Send this dump to ACC and TUP EXECUTE_DIRECT(DBACC, GSN_DUMP_STATE_ORD, signal, 2); EXECUTE_DIRECT(DBTUP, GSN_DUMP_STATE_ORD, signal, 2); @@ -14177,13 +14179,13 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) }//if if (signal->theData[0] == DumpStateOrd::DihMinTimeBetweenLCP) { // Set time between LCP to min value - ndbout << "Set time between LCP to min value" << endl; + g_eventLogger.info("Set time between LCP to min value"); c_lcpState.clcpDelay = 0; // TimeBetweenLocalCheckpoints.min return; } if (signal->theData[0] == DumpStateOrd::DihMaxTimeBetweenLCP) { // Set time between LCP to max value - ndbout << "Set time between LCP to max value" << endl; + g_eventLogger.info("Set time between LCP to max value"); c_lcpState.clcpDelay = 31; // TimeBetweenLocalCheckpoints.max return; } @@ -14219,7 +14221,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) { cgcpDelay = signal->theData[1]; } - ndbout_c("Setting time between gcp : %d", cgcpDelay); + g_eventLogger.info("Setting time between gcp : %d", cgcpDelay); } if (arg == 7021 && signal->getLength() == 2) @@ -14342,7 +14344,7 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* signal){ while(index < count){ if(nodePtr.p->queuedChkpt[index].tableId == tabPtr.i){ jam(); - // ndbout_c("Unqueuing %d", index); + // g_eventLogger.info("Unqueuing %d", index); count--; for(Uint32 i = index; i<count; i++){ @@ -14382,7 +14384,7 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* signal){ if(checkLcpAllTablesDoneInLqh()){ jam(); - ndbout_c("This is the last table"); + g_eventLogger.info("This is the last table"); /** * Then check if saving of tab info is done for all tables @@ -14391,7 +14393,7 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* signal){ checkLcpCompletedLab(signal); if(a != c_lcpState.lcpStatus){ - ndbout_c("And all tables are written to already written disk"); + g_eventLogger.info("And all tables are written to already written disk"); } } break; diff --git a/storage/ndb/src/kernel/vm/WatchDog.cpp b/storage/ndb/src/kernel/vm/WatchDog.cpp index d8311ec5d35..d1abb709b1e 100644 --- a/storage/ndb/src/kernel/vm/WatchDog.cpp +++ b/storage/ndb/src/kernel/vm/WatchDog.cpp @@ -22,7 +22,10 @@ #include <NdbOut.hpp> #include <NdbSleep.h> #include <ErrorHandlingMacros.hpp> - +#include <EventLogger.hpp> + +extern EventLogger g_eventLogger; + extern "C" void* runWatchDog(void* w){ @@ -125,7 +128,7 @@ WatchDog::run(){ last_stuck_action = "Unknown place"; break; }//switch - ndbout << "Ndb kernel is stuck in: " << last_stuck_action << endl; + g_eventLogger.warning("Ndb kernel is stuck in: %s", last_stuck_action); if(alerts == 3){ shutdownSystem(last_stuck_action); } diff --git a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp index b0d9818dfff..f46ee8261ec 100644 --- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -699,7 +699,7 @@ int MgmtSrvr::okToSendTo(NodeId nodeId, bool unCond) return WRONG_PROCESS_TYPE; // Check if we have contact with it if(unCond){ - if(theFacade->theClusterMgr->getNodeInfo(nodeId).connected) + if(theFacade->theClusterMgr->getNodeInfo(nodeId).m_api_reg_conf) return 0; } else if (theFacade->get_node_alive(nodeId) == true) @@ -1574,32 +1574,85 @@ MgmtSrvr::status(int nodeId, } int -MgmtSrvr::setEventReportingLevelImpl(int nodeId, +MgmtSrvr::setEventReportingLevelImpl(int nodeId_arg, const EventSubscribeReq& ll) { SignalSender ss(theFacade); - ss.lock(); - - SimpleSignal ssig; - EventSubscribeReq * dst = - CAST_PTR(EventSubscribeReq, ssig.getDataPtrSend()); - ssig.set(ss,TestOrd::TraceAPI, CMVMI, GSN_EVENT_SUBSCRIBE_REQ, - EventSubscribeReq::SignalLength); - *dst = ll; - - NodeBitmask nodes; + NdbNodeBitmask nodes; + int retries = 30; nodes.clear(); - Uint32 max = (nodeId == 0) ? (nodeId = 1, MAX_NDB_NODES) : nodeId; - for(; (Uint32) nodeId <= max; nodeId++) + while (1) { - if (nodeTypes[nodeId] != NODE_TYPE_DB) - continue; - if (okToSendTo(nodeId, true)) - continue; - if (ss.sendSignal(nodeId, &ssig) == SEND_OK) + Uint32 nodeId, max; + ss.lock(); + SimpleSignal ssig; + EventSubscribeReq * dst = + CAST_PTR(EventSubscribeReq, ssig.getDataPtrSend()); + ssig.set(ss,TestOrd::TraceAPI, CMVMI, GSN_EVENT_SUBSCRIBE_REQ, + EventSubscribeReq::SignalLength); + *dst = ll; + + if (nodeId_arg == 0) { - nodes.set(nodeId); + // all nodes + nodeId = 1; + max = MAX_NDB_NODES; + } + else + { + // only one node + max = nodeId = nodeId_arg; + } + // first make sure nodes are sendable + for(; nodeId <= max; nodeId++) + { + if (nodeTypes[nodeId] != NODE_TYPE_DB) + continue; + if (okToSendTo(nodeId, true)) + { + if (theFacade->theClusterMgr->getNodeInfo(nodeId).connected == false) + { + // node not connected we can safely skip this one + continue; + } + // api_reg_conf not recevied yet, need to retry + break; + } + } + if (nodeId <= max) + { + if (--retries) + { + ss.unlock(); + NdbSleep_MilliSleep(100); + continue; + } + return SEND_OR_RECEIVE_FAILED; + } + + if (nodeId_arg == 0) + { + // all nodes + nodeId = 1; + max = MAX_NDB_NODES; + } + else + { + // only one node + max = nodeId = nodeId_arg; } + // now send to all sendable nodes nodes + // note, lock is held, so states have not changed + for(; (Uint32) nodeId <= max; nodeId++) + { + if (nodeTypes[nodeId] != NODE_TYPE_DB) + continue; + if (theFacade->theClusterMgr->getNodeInfo(nodeId).connected == false) + continue; // node is not connected, skip + if (ss.sendSignal(nodeId, &ssig) == SEND_OK) + nodes.set(nodeId); + } + break; } if (nodes.isclear()) @@ -1610,6 +1663,7 @@ MgmtSrvr::setEventReportingLevelImpl(int nodeId, int error = 0; while (!nodes.isclear()) { + Uint32 nodeId; SimpleSignal *signal = ss.waitFor(); int gsn = signal->readSignalNumber(); nodeId = refToNode(signal->header.theSendersBlockRef); diff --git a/storage/ndb/src/ndbapi/ClusterMgr.cpp b/storage/ndb/src/ndbapi/ClusterMgr.cpp index f7900b9b0b0..5095c6c3856 100644 --- a/storage/ndb/src/ndbapi/ClusterMgr.cpp +++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp @@ -313,7 +313,7 @@ ClusterMgr::showState(NodeId nodeId){ ClusterMgr::Node::Node() : m_state(NodeState::SL_NOTHING) { compatible = nfCompleteRep = true; - connected = defined = m_alive = false; + connected = defined = m_alive = m_api_reg_conf = false; m_state.m_connected_nodes.clear(); } @@ -387,6 +387,8 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){ node.m_info.m_version); } + node.m_api_reg_conf = true; + node.m_state = apiRegConf->nodeState; if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED || node.m_state.startLevel == NodeState::SL_SINGLEUSER)){ @@ -503,6 +505,7 @@ ClusterMgr::reportDisconnected(NodeId nodeId){ noOfConnectedNodes--; theNodes[nodeId].connected = false; + theNodes[nodeId].m_api_reg_conf = false; theNodes[nodeId].m_state.m_connected_nodes.clear(); reportNodeFailed(nodeId, true); diff --git a/storage/ndb/src/ndbapi/ClusterMgr.hpp b/storage/ndb/src/ndbapi/ClusterMgr.hpp index bb20d447c0c..6e74620dd4f 100644 --- a/storage/ndb/src/ndbapi/ClusterMgr.hpp +++ b/storage/ndb/src/ndbapi/ClusterMgr.hpp @@ -70,6 +70,7 @@ public: bool compatible; // Version is compatible bool nfCompleteRep; // NF Complete Rep has arrived bool m_alive; // Node is alive + bool m_api_reg_conf;// API_REGCONF has arrived NodeInfo m_info; NodeState m_state; diff --git a/storage/ndb/src/ndbapi/NdbRecAttr.cpp b/storage/ndb/src/ndbapi/NdbRecAttr.cpp index c46219af7d0..92cb357ad5c 100644 --- a/storage/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/storage/ndb/src/ndbapi/NdbRecAttr.cpp @@ -343,24 +343,24 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) } break; case NdbDictionary::Column::Blob: - { - const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef(); - out << h->length << ":"; - const unsigned char* p = (const unsigned char*)(h + 1); - unsigned n = r.get_size_in_bytes() - sizeof(*h); - for (unsigned k = 0; k < n && k < h->length; k++) - out.print("%02X", (int)p[k]); - j = length; - } - break; case NdbDictionary::Column::Text: { - const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef(); - out << h->length << ":"; - const unsigned char* p = (const unsigned char*)(h + 1); - unsigned n = r.get_size_in_bytes() - sizeof(*h); - for (unsigned k = 0; k < n && k < h->length; k++) - out.print("%c", (int)p[k]); + // user defined aRef() may not be aligned to Uint64 + NdbBlob::Head head; + memcpy(&head, r.aRef(), sizeof(head)); + out << head.length << ":"; + const unsigned char* p = (const unsigned char*)r.aRef() + sizeof(head); + if (r.get_size_in_bytes() < sizeof(head)) + out << "***error***"; // really cannot happen + else { + unsigned n = r.get_size_in_bytes() - sizeof(head); + for (unsigned k = 0; k < n && k < head.length; k++) { + if (r.getType() == NdbDictionary::Column::Blob) + out.print("%02X", (int)p[k]); + else + out.print("%c", (int)p[k]); + } + } j = length; } break; diff --git a/storage/ndb/src/ndbapi/SignalSender.hpp b/storage/ndb/src/ndbapi/SignalSender.hpp index ec874e63c52..4cad759a334 100644 --- a/storage/ndb/src/ndbapi/SignalSender.hpp +++ b/storage/ndb/src/ndbapi/SignalSender.hpp @@ -32,7 +32,7 @@ public: Uint32 theData[25]; LinearSectionPtr ptr[3]; - int readSignalNumber() {return header.theVerId_signalNumber; } + int readSignalNumber() const {return header.theVerId_signalNumber; } Uint32 *getDataPtrSend() { return theData; } const Uint32 *getDataPtr() const { return theData; } diff --git a/storage/ndb/src/ndbapi/TransporterFacade.cpp b/storage/ndb/src/ndbapi/TransporterFacade.cpp index 24bf6dbbc6a..f982c36cba1 100644 --- a/storage/ndb/src/ndbapi/TransporterFacade.cpp +++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp @@ -1527,7 +1527,8 @@ SignalSender::sendSignal(Uint16 nodeId, const SimpleSignal * s){ signalLogger.flushSignalLog(); } #endif - + assert(getNodeInfo(nodeId).m_api_reg_conf == true || + s->readSignalNumber() == GSN_API_REGREQ); return theFacade->theTransporterRegistry->prepareSend(&s->header, 1, // JBB &s->theData[0], diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c index 24c79ce1e2c..8ed8727dd9e 100644 --- a/storage/ndb/src/ndbapi/ndberror.c +++ b/storage/ndb/src/ndbapi/ndberror.c @@ -283,6 +283,7 @@ ErrorBundle ErrorCodes[] = { /** * Application error */ + { 299, DMEC, AE, "Operation not allowed or aborted due to single user mode" }, { 763, DMEC, AE, "Alter table requires cluster nodes to have exact same version" }, { 823, DMEC, AE, "Too much attrinfo from application in tuple manager" }, { 831, DMEC, AE, "Too many nullable/bitfields in table definition" }, diff --git a/storage/ndb/tools/restore/Restore.cpp b/storage/ndb/tools/restore/Restore.cpp index e95531fec06..3d466384782 100644 --- a/storage/ndb/tools/restore/Restore.cpp +++ b/storage/ndb/tools/restore/Restore.cpp @@ -59,7 +59,12 @@ BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Ui return true; case 64: for(i = 0; i<arraySize; i++){ - attr_data->u_int64_value[i] = Twiddle64(attr_data->u_int64_value[i]); + // allow unaligned + char* p = (char*)&attr_data->u_int64_value[i]; + Uint64 x; + memcpy(&x, p, sizeof(Uint64)); + x = Twiddle64(x); + memcpy(p, &x, sizeof(Uint64)); } return true; default: diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp index e276eb7d6f9..5b194fb7033 100644 --- a/storage/ndb/tools/restore/consumer_restore.cpp +++ b/storage/ndb/tools/restore/consumer_restore.cpp @@ -667,6 +667,8 @@ err: bool BackupRestore::createSystable(const TableS & tables){ + if (!m_restore && !m_restore_meta && !m_restore_epoch) + return true; const char *tablename = tables.getTableName(); if( strcmp(tablename, NDB_REP_DB "/def/" NDB_APPLY_TABLE) != 0 && |