From 159325f0fc69b2516ac284488a3432220d3eead6 Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Wed, 21 Feb 2007 18:00:12 +0100 Subject: [PATCH 1/6] ndb - bug#26515 make sure logPartPtr is correctly initialized --- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index ab5deca27b5..796b7245def 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -11950,6 +11950,10 @@ void Dblqh::execFSCLOSECONF(Signal* signal) // Set the prev file to check if we shall close it. logFilePtr.i = logFilePtr.p->prevLogFile; ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + + logPartPtr.i = logFilePtr.p->logPartRec; + ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord); + exitFromInvalidate(signal); return; case LogFileRecord::CLOSING_INIT: From 990a505db6908b5e1cec8ed5a2203884b7e5a9f5 Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Wed, 21 Feb 2007 18:01:04 +0100 Subject: [PATCH 2/6] ndb - Make StartREDO come up as default in cluster log --- ndb/src/common/debugger/EventLogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp index c6f02a7807a..2defdfc8de5 100644 --- a/ndb/src/common/debugger/EventLogger.cpp +++ b/ndb/src/common/debugger/EventLogger.cpp @@ -836,7 +836,7 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = { ROW(NDBStopCompleted, LogLevel::llStartUp, 1, Logger::LL_INFO ), ROW(NDBStopForced, LogLevel::llStartUp, 1, Logger::LL_ALERT ), ROW(NDBStopAborted, LogLevel::llStartUp, 1, Logger::LL_INFO ), - ROW(StartREDOLog, LogLevel::llStartUp, 10, Logger::LL_INFO ), + ROW(StartREDOLog, LogLevel::llStartUp, 4, Logger::LL_INFO ), ROW(StartLog, LogLevel::llStartUp, 10, Logger::LL_INFO ), ROW(UNDORecordsExecuted, LogLevel::llStartUp, 15, Logger::LL_INFO ), ROW(StartReport, LogLevel::llStartUp, 4, Logger::LL_INFO ), From 9370d6a3ce9bf94fc4bde2e9c0593e9a77c5d85b Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Thu, 22 Feb 2007 15:31:21 +0100 Subject: [PATCH 3/6] ndb - bug#26481 - fix of bug fix 5.0 version --- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 796b7245def..698e5ac292c 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -457,6 +457,7 @@ void Dblqh::execCONTINUEB(Signal* signal) else { jam(); + cstartRecReq = 2; StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend(); conf->startingNodeId = getOwnNodeId(); sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal, @@ -11673,7 +11674,7 @@ void Dblqh::execGCP_SAVEREQ(Signal* signal) return; } - if(getNodeState().getNodeRestartInProgress() && cstartRecReq == ZFALSE) + if(getNodeState().getNodeRestartInProgress() && cstartRecReq < 2) { GCPSaveRef * const saveRef = (GCPSaveRef*)&signal->theData[0]; saveRef->dihPtr = dihPtr; @@ -13822,7 +13823,7 @@ void Dblqh::srCompletedLab(Signal* signal) * NO MORE FRAGMENTS ARE WAITING FOR SYSTEM RESTART. * -------------------------------------------------------------------- */ lcpPtr.p->lcpState = LcpRecord::LCP_IDLE; - if (cstartRecReq == ZTRUE) { + if (cstartRecReq == 1) { jam(); /* ---------------------------------------------------------------- * WE HAVE ALSO RECEIVED AN INDICATION THAT NO MORE FRAGMENTS @@ -13892,7 +13893,7 @@ void Dblqh::execSTART_RECREQ(Signal* signal) ndbrequire(req->receivingNodeId == cownNodeid); cnewestCompletedGci = cnewestGci; - cstartRecReq = ZTRUE; + cstartRecReq = 1; for (logPartPtr.i = 0; logPartPtr.i < 4; logPartPtr.i++) { ptrAss(logPartPtr, logPartRecord); logPartPtr.p->logPartNewestCompletedGCI = cnewestCompletedGci; @@ -13913,6 +13914,7 @@ void Dblqh::execSTART_RECREQ(Signal* signal) }//if if(cstartType == NodeState::ST_INITIAL_NODE_RESTART){ jam(); + cstartRecReq = 2; StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend(); conf->startingNodeId = getOwnNodeId(); sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal, @@ -15733,6 +15735,7 @@ void Dblqh::srFourthComp(Signal* signal) else { jam(); + cstartRecReq = 2; StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend(); conf->startingNodeId = getOwnNodeId(); sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal, @@ -16699,7 +16702,7 @@ void Dblqh::initialiseRecordsLab(Signal* signal, Uint32 data, cCommitBlocked = false; ccurrentGcprec = RNIL; caddNodeState = ZFALSE; - cstartRecReq = ZFALSE; + cstartRecReq = 0; cnewestGci = (UintR)-1; cnewestCompletedGci = (UintR)-1; crestartOldestGci = 0; From 6dd7294dfbad6c93c45082826c0dcf1e5c8cd6f8 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.mysql.com" <> Date: Thu, 1 Mar 2007 08:34:59 +0700 Subject: [PATCH 4/6] ndb - rel5.1.16 NdbRecAttr print of blob length assumed uint64 aligned buffer ndb - 5.1.16 uint64 align for ndb_restore (backport) --- ndb/src/ndbapi/NdbRecAttr.cpp | 38 +++++++++++++++++------------------ ndb/tools/restore/Restore.cpp | 7 ++++++- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index e1b0ef3a350..18e17071777 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -346,27 +346,27 @@ 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.arraySize() - 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.arraySize() - sizeof(*h); - for (unsigned k = 0; k < n && k < h->length; k++) - out.print("%c", (int)p[k]); - j = length; + { + // 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.arraySize() < sizeof(head)) + out << "***error***"; // really cannot happen + else { + unsigned n = r.arraySize() - 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]); + } } - break; + j = length; + } + break; case NdbDictionary::Column::Longvarchar: { unsigned len = uint2korr(r.aRef()); diff --git a/ndb/tools/restore/Restore.cpp b/ndb/tools/restore/Restore.cpp index 9aa79f4dc94..8b2e9a799a4 100644 --- a/ndb/tools/restore/Restore.cpp +++ b/ndb/tools/restore/Restore.cpp @@ -54,7 +54,12 @@ BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Ui return true; case 64: for(i = 0; iu_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: From fa47c63b91a34f6168abd096cbd386bd2e4d59e5 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.mysql.com" <> Date: Fri, 2 Mar 2007 08:56:22 +0700 Subject: [PATCH 5/6] Bug #26720 Infinite loop on unknown signal in logging function - terminate printing --- ndb/src/common/debugger/signaldata/PackedSignal.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ndb/src/common/debugger/signaldata/PackedSignal.cpp b/ndb/src/common/debugger/signaldata/PackedSignal.cpp index 54048bcbb35..a5f585c23f0 100644 --- a/ndb/src/common/debugger/signaldata/PackedSignal.cpp +++ b/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"); From f106c25765378306a9a6a8e30b1737d28f80b7bf Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.mysql.com" <> Date: Fri, 2 Mar 2007 09:06:05 +0700 Subject: [PATCH 6/6] Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes (part 1) - add signal data - add ref in dict on create/drop table/index --- ndb/include/kernel/signaldata/AlterTable.hpp | 3 +- ndb/include/kernel/signaldata/CreateIndx.hpp | 3 +- ndb/include/kernel/signaldata/CreateTable.hpp | 3 +- ndb/include/kernel/signaldata/DropIndx.hpp | 3 +- ndb/include/kernel/signaldata/DropTable.hpp | 3 +- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 41 +++++++++++++++++++ ndb/src/ndbapi/ndberror.c | 1 + 7 files changed, 52 insertions(+), 5 deletions(-) diff --git a/ndb/include/kernel/signaldata/AlterTable.hpp b/ndb/include/kernel/signaldata/AlterTable.hpp index 6042b7233f6..c2fd742c234 100644 --- a/ndb/include/kernel/signaldata/AlterTable.hpp +++ b/ndb/include/kernel/signaldata/AlterTable.hpp @@ -130,7 +130,8 @@ public: NullablePrimaryKey = 740, UnsupportedChange = 741, BackupInProgress = 762, - IncompatibleVersions = 763 + IncompatibleVersions = 763, + SingleUser = 299 }; private: diff --git a/ndb/include/kernel/signaldata/CreateIndx.hpp b/ndb/include/kernel/signaldata/CreateIndx.hpp index 8a2054a1a42..f6168959d1a 100644 --- a/ndb/include/kernel/signaldata/CreateIndx.hpp +++ b/ndb/include/kernel/signaldata/CreateIndx.hpp @@ -206,7 +206,8 @@ public: NotUnique = 4251, AllocationError = 4252, CreateIndexTableFailed = 4253, - DuplicateAttributes = 4258 + DuplicateAttributes = 4258, + SingleUser = 299 }; CreateIndxConf m_conf; diff --git a/ndb/include/kernel/signaldata/CreateTable.hpp b/ndb/include/kernel/signaldata/CreateTable.hpp index d29a06c751e..3f33da1e9b4 100644 --- a/ndb/include/kernel/signaldata/CreateTable.hpp +++ b/ndb/include/kernel/signaldata/CreateTable.hpp @@ -91,7 +91,8 @@ public: RecordTooBig = 738, InvalidPrimaryKeySize = 739, NullablePrimaryKey = 740, - InvalidCharset = 743 + InvalidCharset = 743, + SingleUser = 299 }; private: diff --git a/ndb/include/kernel/signaldata/DropIndx.hpp b/ndb/include/kernel/signaldata/DropIndx.hpp index 01d500f2d84..6e3b183995f 100644 --- a/ndb/include/kernel/signaldata/DropIndx.hpp +++ b/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/ndb/include/kernel/signaldata/DropTable.hpp b/ndb/include/kernel/signaldata/DropTable.hpp index 36268b23be1..c0a4596e1dc 100644 --- a/ndb/include/kernel/signaldata/DropTable.hpp +++ b/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/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 7b82631884f..16964ec443f 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -2910,6 +2910,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); @@ -3072,6 +3081,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){ @@ -5401,6 +5419,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){ @@ -6531,6 +6558,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; @@ -7101,6 +7135,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/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 45248000703..15445620ce9 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -264,6 +264,7 @@ ErrorBundle ErrorCodes[] = { /** * Application error */ + { 299, AE, "Operation not allowed or aborted due to single user mode" }, { 763, AE, "Alter table requires cluster nodes to have exact same version" }, { 823, AE, "Too much attrinfo from application in tuple manager" }, { 831, AE, "Too many nullable/bitfields in table definition" },