Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-12-25 12:45:33+02:00, pekka@stripped +10 -0
ndb - wl#3600
storage/ndb/include/kernel/GlobalSignalNumbers.h@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +4 -1
wl#3600 empty distributed schema trans in DICT
storage/ndb/include/kernel/signaldata/SchemaTransImpl.hpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +65 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/include/kernel/signaldata/SchemaTransImpl.hpp@stripped, 2006-12-22 15:12:37+02:00, pekka@stripped +0 -0
BitKeeper file /export/space/pekka/ndb/version/my52-wl3600/storage/ndb/include/kernel/signaldata/SchemaTransImpl.hpp
storage/ndb/include/kernel/signaldata/SchemaTransImpl.hpp@stripped, 2006-12-22 15:12:37+02:00, pekka@stripped +0 -0
storage/ndb/include/kernel/signaldata/SignalData.hpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +3 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/src/common/debugger/signaldata/Makefile.am@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +1 -1
wl#3600 empty distributed schema trans in DICT
storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +85 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp@stripped, 2006-12-22 15:13:20+02:00, pekka@stripped +0 -0
BitKeeper file /export/space/pekka/ndb/version/my52-wl3600/storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp
storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp@stripped, 2006-12-22 15:13:20+02:00, pekka@stripped +0 -0
storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +3 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +3 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +541 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +115 -0
wl#3600 empty distributed schema trans in DICT
storage/ndb/test/ndbapi/testDict.cpp@stripped, 2006-12-25 12:43:39+02:00, pekka@stripped +13 -1
wl#3600 empty distributed schema trans in DICT
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pekka
# Host: clam.(none)
# Root: /export/space/pekka/ndb/version/my52-wl3600
--- 1.31/storage/ndb/include/kernel/GlobalSignalNumbers.h 2006-12-20 09:21:57 +02:00
+++ 1.32/storage/ndb/include/kernel/GlobalSignalNumbers.h 2006-12-25 12:43:39 +02:00
@@ -23,7 +23,7 @@
*
* When adding a new signal, remember to update MAX_GSN and SignalNames.cpp
*/
-const GlobalSignalNumber MAX_GSN = 736;
+const GlobalSignalNumber MAX_GSN = 739;
struct GsnName {
GlobalSignalNumber gsn;
@@ -991,5 +991,8 @@
#define GSN_SCHEMA_TRANS_END_REQ 734
#define GSN_SCHEMA_TRANS_END_CONF 735
#define GSN_SCHEMA_TRANS_END_REF 736
+#define GSN_SCHEMA_TRANS_IMPL_REQ 737
+#define GSN_SCHEMA_TRANS_IMPL_CONF 738
+#define GSN_SCHEMA_TRANS_IMPL_REF 739
#endif
--- 1.13/storage/ndb/include/kernel/signaldata/SignalData.hpp 2006-12-20 16:02:02 +02:00
+++ 1.14/storage/ndb/include/kernel/signaldata/SignalData.hpp 2006-12-25 12:43:39 +02:00
@@ -233,5 +233,8 @@
GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_REQ);
GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_CONF);
GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_END_REF);
+GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_IMPL_REQ);
+GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_IMPL_CONF);
+GSN_PRINT_SIGNATURE(printSCHEMA_TRANS_IMPL_REF);
#endif
--- 1.17/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp 2006-12-20 16:02:02 +02:00
+++ 1.18/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp 2006-12-25 12:43:39 +02:00
@@ -209,6 +209,9 @@
,{ GSN_SCHEMA_TRANS_END_REQ, printSCHEMA_TRANS_END_REQ }
,{ GSN_SCHEMA_TRANS_END_CONF, printSCHEMA_TRANS_END_CONF }
,{ GSN_SCHEMA_TRANS_END_REF, printSCHEMA_TRANS_END_REF }
+ ,{ GSN_SCHEMA_TRANS_IMPL_REQ, printSCHEMA_TRANS_IMPL_REQ }
+ ,{ GSN_SCHEMA_TRANS_IMPL_CONF, printSCHEMA_TRANS_IMPL_CONF }
+ ,{ GSN_SCHEMA_TRANS_IMPL_REF, printSCHEMA_TRANS_IMPL_REF }
,{ 0, 0 }
};
--- 1.16/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2006-12-20 09:21:57 +02:00
+++ 1.17/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2006-12-25 12:43:39 +02:00
@@ -644,6 +644,9 @@
,{ GSN_SCHEMA_TRANS_END_REQ, "SCHEMA_TRANS_END_REQ" }
,{ GSN_SCHEMA_TRANS_END_CONF, "SCHEMA_TRANS_END_CONF" }
,{ GSN_SCHEMA_TRANS_END_REF, "SCHEMA_TRANS_END_REF" }
+ ,{ GSN_SCHEMA_TRANS_IMPL_REQ, "SCHEMA_TRANS_IMPL_REQ" }
+ ,{ GSN_SCHEMA_TRANS_IMPL_CONF, "SCHEMA_TRANS_IMPL_CONF" }
+ ,{ GSN_SCHEMA_TRANS_IMPL_REF, "SCHEMA_TRANS_IMPL_REF" }
};
const unsigned short NO_OF_SIGNAL_NAMES = sizeof(SignalNames)/sizeof(GsnName);
--- 1.116/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2006-12-24 02:04:45 +02:00
+++ 1.117/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2006-12-25 12:43:39 +02:00
@@ -88,6 +88,7 @@
#include <SLList.hpp>
#include <signaldata/SchemaTrans.hpp>
+#include <signaldata/SchemaTransImpl.hpp>
#define ZNOT_FOUND 626
#define ZALREADYEXIST 630
@@ -1509,6 +1510,7 @@
c_file_hash(c_file_pool),
c_filegroup_hash(c_filegroup_pool),
c_obj_hash(c_obj_pool),
+ c_schemaTransHash(c_schemaTransPool),
c_opCreateTable(c_opRecordPool),
c_opDropTable(c_opRecordPool),
c_opCreateIndex(c_opRecordPool),
@@ -1702,6 +1704,9 @@
addRecSignal(GSN_SCHEMA_TRANS_BEGIN_REQ, &Dbdict::execSCHEMA_TRANS_BEGIN_REQ);
addRecSignal(GSN_SCHEMA_TRANS_END_REQ, &Dbdict::execSCHEMA_TRANS_END_REQ);
+ addRecSignal(GSN_SCHEMA_TRANS_IMPL_REQ, &Dbdict::execSCHEMA_TRANS_IMPL_REQ);
+ addRecSignal(GSN_SCHEMA_TRANS_IMPL_CONF, &Dbdict::execSCHEMA_TRANS_IMPL_CONF);
+ addRecSignal(GSN_SCHEMA_TRANS_IMPL_REF, &Dbdict::execSCHEMA_TRANS_IMPL_REF);
addRecSignal(GSN_DICT_LOCK_REQ, &Dbdict::execDICT_LOCK_REQ);
addRecSignal(GSN_DICT_UNLOCK_ORD, &Dbdict::execDICT_UNLOCK_ORD);
@@ -2071,6 +2076,9 @@
c_tableRecordPool.setSize(tablerecSize);
g_key_descriptor_pool.setSize(tablerecSize);
c_triggerRecordPool.setSize(c_maxNoOfTriggers);
+
+ c_schemaTransPool.setSize(2);
+ c_schemaTransHash.setSize(2);
c_obj_pool.setSize(tablerecSize+c_maxNoOfTriggers);
c_obj_hash.setSize((tablerecSize+c_maxNoOfTriggers+1)/2);
@@ -16318,3 +16326,536 @@
// MODULE: SchemaTrans
+// ErrorInfo
+
+void
+Dbdict::resetError(ErrorInfo& error)
+{
+ new (&error) ErrorInfo();
+}
+
+void
+Dbdict::setError(ErrorInfo& error, Uint32 code, Uint32 line, Uint32 nodeId)
+{
+ // can only store details for first error
+ if (error.errorCount == 0) {
+ error.errorCode = code;
+ error.errorLine = line;
+ error.errorNodeId = nodeId ? nodeId : getOwnNodeId();
+ }
+ error.errorCount++;
+}
+
+void
+Dbdict::setError(ErrorInfo& error, const ErrorInfo& error2)
+{
+ setError(error, error2.errorCode, error2.errorLine, error2.errorNodeId);
+}
+
+bool
+Dbdict::hasError(const ErrorInfo& error)
+{
+ return error.errorCount != 0;
+}
+
+bool
+Dbdict::seizeSchemaTrans(SchemaTransPtr& trans_ptr, Uint32 trans_key)
+{
+ if (!findSchemaTrans(trans_ptr, trans_key)) {
+ jam();
+ if (c_schemaTransHash.seize(trans_ptr)) {
+ jam();
+ new (trans_ptr.p) SchemaTrans();
+ trans_ptr.p->trans_key = trans_key;
+ c_schemaTransHash.add(trans_ptr);
+ D("seizeSchemaTrans" << V(trans_ptr.i) << *trans_ptr.p);
+ return true;
+ }
+ }
+ trans_ptr.setNull();
+ return false;
+}
+
+// SchemaTrans seize / find / release
+
+bool
+Dbdict::seizeSchemaTrans(SchemaTransPtr& trans_ptr)
+{
+ Uint32 trans_key = c_opRecordSequence + 1;
+ if (seizeSchemaTrans(trans_ptr, trans_key)) {
+ c_opRecordSequence = trans_key;
+ return true;
+ }
+ return false;
+}
+
+bool
+Dbdict::findSchemaTrans(SchemaTransPtr& trans_ptr, Uint32 trans_key)
+{
+ SchemaTrans trans_rec;
+ trans_rec.trans_key = trans_key;
+ if (c_schemaTransHash.find(trans_ptr, trans_rec)) {
+ jam();
+ return true;
+ }
+ trans_ptr.setNull();
+ return false;
+}
+
+void
+Dbdict::releaseSchemaTrans(SchemaTransPtr& trans_ptr)
+{
+#if wl3600_todo
+ LocalDLFifoList<SchemaOp> list(c_schemaOpPool, trans_ptr.p->m_opList);
+ SchemaOpPtr op_ptr;
+ while (list.first(op_ptr)) {
+ list.remove(op_ptr);
+ releaseSchemaOp(op_ptr);
+ }
+#endif
+ c_schemaTransHash.release(trans_ptr);
+ trans_ptr.setNull();
+}
+
+// client requests
+
+void
+Dbdict::execSCHEMA_TRANS_BEGIN_REQ(Signal* signal)
+{
+ jamEntry();
+ const SchemaTransBeginReq* req =
+ (const SchemaTransBeginReq*)signal->getDataPtr();
+ Uint32 transId = req->transId;
+ Uint32 clientRef = req->clientRef;
+
+ ErrorInfo error;
+ do {
+ SchemaTransPtr trans_ptr;
+
+ if (getOwnNodeId() != c_masterNodeId) {
+ jam();
+ setError(error, SchemaTransBeginRef::NotMaster, __LINE__);
+ break;
+ }
+ if (c_blockState == BS_NODE_RESTART) {
+ jam();
+ setError(error, SchemaTransBeginRef::BusyWithNR, __LINE__);
+ break;
+ }
+ if (c_blockState != BS_IDLE) {
+ jam();
+ setError(error, SchemaTransBeginRef::Busy, __LINE__);
+ break;
+ }
+
+ seizeSchemaTrans(trans_ptr);
+ if (trans_ptr.isNull()) {
+ jam();
+ // future when more than 1 tx allowed
+ setError(error, SchemaTransBeginRef::TooManySchemaTrans, __LINE__);
+ break;
+ }
+
+ trans_ptr.p->m_clientRef = clientRef;
+ trans_ptr.p->m_transId = transId;
+ trans_ptr.p->m_initialNodes = c_aliveNodes;
+
+ // begin tx on all participants
+ trans_ptr.p->m_requestType = SchemaTransImplReq::RT_BEGIN;
+ schemaTrans_sendReq(signal, trans_ptr);
+
+#if wl3600_todo
+ c_blockState = BS_BUSY;
+#endif
+ return;
+ } while(0);
+
+ SchemaTransBeginRef* ref =
+ (SchemaTransBeginRef*)signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->transId = transId;
+ getError(error, ref);
+
+ sendSignal(clientRef, GSN_SCHEMA_TRANS_BEGIN_REF,
+ signal, SchemaTransBeginRef::SignalLength, JBB);
+}
+
+void
+Dbdict::execSCHEMA_TRANS_END_REQ(Signal* signal)
+{
+ jamEntry();
+ const SchemaTransEndReq* req =
+ (const SchemaTransEndReq*)signal->getDataPtr();
+ Uint32 clientRef = req->clientRef;
+ Uint32 transId = req->transId;
+ Uint32 trans_key = req->transKey;
+ bool commitFlag = req->commitFlag;
+
+ ErrorInfo error;
+ do {
+ SchemaTransPtr trans_ptr;
+
+ if (getOwnNodeId() != c_masterNodeId) {
+ jam();
+ // future when MNF is handled
+ setError(error, SchemaTransEndRef::NotMaster, __LINE__);
+ break;
+ }
+
+ findSchemaTrans(trans_ptr, trans_key);
+ if (trans_ptr.isNull()) {
+ jam();
+ setError(error, SchemaTransEndRef::InvalidTransKey, __LINE__);
+ break;
+ }
+ if (trans_ptr.p->m_transId != transId) {
+ jam();
+ setError(error, SchemaTransEndRef::InvalidTransId, __LINE__);
+ break;
+ }
+
+ if (!commitFlag) {
+ // wl3600_todo
+ ndbrequire(false);
+ return;
+ }
+
+ // start execution phases - wl3600_todo
+
+ // end tx on all participants
+ trans_ptr.p->m_requestType = SchemaTransImplReq::RT_END;
+ schemaTrans_sendReq(signal, trans_ptr);
+ return;
+ } while (0);
+
+ SchemaTransEndRef* ref =
+ (SchemaTransEndRef*)signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->transId = transId;
+ getError(error, ref);
+
+ sendSignal(clientRef, GSN_SCHEMA_TRANS_END_REF,
+ signal, SchemaTransEndRef::SignalLength, JBB);
+}
+
+// master signal handling
+
+void
+Dbdict::schemaTrans_sendReq(Signal* signal, SchemaTransPtr trans_ptr)
+{
+ D("schemaTrans_sendReq" << *trans_ptr.p);
+
+ SchemaTransImplReq* req = (SchemaTransImplReq*)signal->getDataPtrSend();
+
+ req->senderRef = reference();
+ req->transKey = trans_ptr.p->trans_key;
+ req->opKey = RNIL;
+ req->requestType = trans_ptr.p->m_requestType;
+ req->clientRef = trans_ptr.p->m_clientRef;
+ req->transId = trans_ptr.p->m_transId;
+ req->gsn = 0;
+
+ NdbNodeBitmask nodes = trans_ptr.p->m_initialNodes;
+ nodes.bitANDC(trans_ptr.p->m_failedNodes);
+ ndbrequire(!nodes.isclear());
+
+ NodeReceiverGroup rg(DBDICT, nodes);
+ {
+ SafeCounter sc(c_counterMgr, trans_ptr.p->m_counter);
+ bool ok = sc.init<SchemaTransImplRef>(rg, trans_ptr.p->trans_key);
+ ndbrequire(ok);
+ }
+
+ sendSignal(rg, GSN_SCHEMA_TRANS_IMPL_REQ,
+ signal, SchemaTransImplReq::SignalLength, JBB);
+}
+
+void
+Dbdict::execSCHEMA_TRANS_IMPL_CONF(Signal* signal)
+{
+ jamEntry();
+ ndbrequire(signal->getNoOfSections() == 0);
+ schemaTrans_recvReply(signal, true);
+}
+
+void
+Dbdict::execSCHEMA_TRANS_IMPL_REF(Signal* signal)
+{
+ jamEntry();
+ ndbrequire(signal->getNoOfSections() == 0);
+ schemaTrans_recvReply(signal, false);
+}
+
+void
+Dbdict::schemaTrans_recvReply(Signal* signal, bool isConf)
+{
+ Uint32 trans_key;
+ Uint32 senderRef;
+ Uint32 replyInfo = 0;
+ ErrorInfo error;
+
+ if (isConf) {
+ const SchemaTransImplConf* conf =
+ (const SchemaTransImplConf*)signal->getDataPtr();
+ senderRef = conf->senderRef;
+ trans_key = conf->transKey;
+ replyInfo = conf->replyInfo;
+ } else {
+ jam();
+ const SchemaTransImplRef* ref =
+ (const SchemaTransImplRef*)signal->getDataPtr();
+ senderRef = ref->senderRef;
+ trans_key = ref->transKey;
+ setError(error, ref);
+ }
+
+ Uint32 nodeId = refToNode(senderRef);
+
+ SchemaTransPtr trans_ptr;
+ findSchemaTrans(trans_ptr, trans_key);
+ ndbrequire(!trans_ptr.isNull());
+
+ if (error.errorCode == SchemaTransImplRef::NF_FakeErrorREF) {
+ jam();
+ // exclude the node permanently from this tx
+ trans_ptr.p->m_failedNodes.set(nodeId);
+ resetError(error);
+ }
+
+ if (hasError(error)) {
+ jam();
+ setError(trans_ptr.p->m_error, error);
+ }
+
+ {
+ SafeCounter sc(c_counterMgr, trans_ptr.p->m_counter);
+ if (! sc.clearWaitingFor(nodeId)) {
+ jam();
+ return;
+ }
+ }
+
+ if (hasError(trans_ptr.p->m_error)) {
+ jam();
+ // wl3600_todo
+ ndbrequire(false);
+ return;
+ }
+
+ Uint32 clientRef = trans_ptr.p->m_clientRef;
+ Uint32 transId = trans_ptr.p->m_transId;
+
+ switch (trans_ptr.p->m_requestType) {
+ case SchemaTransImplReq::RT_BEGIN:
+ jam();
+ {
+ SchemaTransBeginConf* conf =
+ (SchemaTransBeginConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->transId = transId;
+ conf->transKey = trans_key;
+ sendSignal(clientRef, GSN_SCHEMA_TRANS_BEGIN_CONF,
+ signal, SchemaTransBeginConf::SignalLength, JBB);
+ }
+ break;
+
+ case SchemaTransImplReq::RT_END:
+ jam();
+ {
+ SchemaTransEndConf* conf =
+ (SchemaTransEndConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->transId = transId;
+ sendSignal(clientRef, GSN_SCHEMA_TRANS_END_CONF,
+ signal, SchemaTransEndConf::SignalLength, JBB);
+
+ releaseSchemaTrans(trans_ptr);
+
+ c_blockState = BS_IDLE;
+ }
+ break;
+
+ default:
+ ndbrequire(false);
+ break;
+ }
+}
+
+// participant signal handling
+
+void
+Dbdict::execSCHEMA_TRANS_IMPL_REQ(Signal* signal)
+{
+ if (!assembleFragments(signal)) {
+ jam();
+ return;
+ }
+ jamEntry();
+ schemaTrans_recvReq(signal);
+}
+
+void
+Dbdict::schemaTrans_recvReq(Signal* signal)
+{
+ const SchemaTransImplReq* req =
+ (const SchemaTransImplReq*)signal->getDataPtr();
+
+ Uint32 senderRef = req->senderRef;
+ Uint32 trans_key = req->transKey;
+ Uint32 op_key = req->opKey;
+ Uint32 requestType = req->requestType;
+ Uint32 clientRef = req->clientRef;
+ Uint32 transId = req->transId;
+ Uint32 gsn = req->gsn;
+
+ D("schemaTrans_recvReq" << V(gsn) << hex << V(op_key));
+
+ // cannot receive a new master before this signal arrives
+ ndbrequire(c_masterNodeId == refToNode(senderRef));
+
+ ErrorInfo error;
+ do {
+ SchemaTransPtr trans_ptr;
+
+ const bool isMaster = (senderRef == reference());
+
+ const bool seizeTrans =
+ !isMaster && requestType == SchemaTransImplReq::RT_BEGIN;
+
+ const bool releaseTrans =
+ !isMaster && requestType == SchemaTransImplReq::RT_END;
+
+ const bool sendConf =
+ requestType == SchemaTransImplReq::RT_BEGIN ||
+ requestType == SchemaTransImplReq::RT_END;
+
+ if (seizeTrans) {
+ if (!seizeSchemaTrans(trans_ptr, trans_key)) {
+ jam();
+ setError(error, SchemaTransImplRef::TooManySchemaTrans, __LINE__);
+ break;
+ }
+ trans_ptr.p->m_clientRef = clientRef;
+ trans_ptr.p->m_transId = transId;
+ } else {
+ jam();
+ findSchemaTrans(trans_ptr, trans_key);
+ ndbrequire(!trans_ptr.isNull());
+ }
+
+ if (isMaster) {
+ ndbrequire(trans_ptr.p->m_requestType == requestType);
+ } else {
+ trans_ptr.p->m_requestType = requestType;
+ }
+ trans_ptr.p->m_masterRef = senderRef;
+
+ switch (requestType) {
+ case SchemaTransImplReq::RT_BEGIN:
+ jam();
+ break;
+
+ case SchemaTransImplReq::RT_END:
+ jam();
+ break;
+
+ default:
+ ndbrequire(false);
+ break;
+ }
+
+ if (releaseTrans) {
+ jam();
+ releaseSchemaTrans(trans_ptr);
+ }
+
+ if (sendConf) {
+ jam();
+ schemaTrans_sendConf(signal, trans_ptr);
+ }
+
+ return;
+ } while (0);
+
+ schemaTrans_sendRef(signal, senderRef, trans_key, error);
+}
+
+void
+Dbdict::schemaTrans_sendConf(Signal* signal, SchemaTransPtr trans_ptr)
+{
+ D("schemaTrans_sendConf");
+
+ SchemaTransImplConf* conf =
+ (SchemaTransImplConf*)signal->getDataPtrSend();
+ conf->senderRef = reference();
+ conf->transKey = trans_ptr.p->trans_key;
+ conf->replyInfo = 0;
+
+ Uint32 masterRef = trans_ptr.p->m_masterRef;
+ sendSignal(masterRef, GSN_SCHEMA_TRANS_IMPL_CONF,
+ signal, SchemaTransImplConf::SignalLength, JBB);
+}
+
+void
+Dbdict::schemaTrans_sendRef(Signal* signal, SchemaTransPtr trans_ptr,
+ ErrorInfo error)
+{
+ Uint32 masterRef = trans_ptr.p->m_masterRef;
+ Uint32 trans_key = trans_ptr.p->trans_key;
+ schemaTrans_sendRef(signal, masterRef, trans_key, error);
+}
+
+void
+Dbdict::schemaTrans_sendRef(Signal* signal, Uint32 masterRef, Uint32 trans_key,
+ ErrorInfo error)
+{
+ D("schemaTrans_sendRef" << V(error.errorCode));
+
+ SchemaTransImplRef* ref = (SchemaTransImplRef*)signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->transKey = trans_key;
+ getError(error, ref);
+
+ sendSignal(masterRef, GSN_SCHEMA_TRANS_IMPL_REF,
+ signal, SchemaTransImplRef::SignalLength, JBB);
+}
+
+// MODULE: debug
+
+#ifdef VM_TRACE
+
+NdbOut&
+operator<<(NdbOut& out, const Dbdict::ErrorInfo& a)
+{
+ a.print(out);
+ return out;
+}
+
+void
+Dbdict::ErrorInfo::print(NdbOut& out) const
+{
+ out << " (ErrorInfo";
+ out << V(errorCode);
+ out << V(errorLine);
+ out << V(errorNodeId);
+ out << ")";
+}
+
+NdbOut&
+operator<<(NdbOut& out, const Dbdict::SchemaTrans& a)
+{
+ a.print(out);
+ return out;
+}
+
+void
+Dbdict::SchemaTrans::print(NdbOut& out) const
+{
+ out << " (SchemaTrans";
+ out << hex << V(trans_key);
+ out << hex << V(m_clientRef);
+ out << hex << V(m_transId);
+ out << ")";
+}
+
+#endif
--- 1.47/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2006-12-22 23:39:59 +02:00
+++ 1.48/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2006-12-25 12:43:39 +02:00
@@ -826,6 +826,9 @@
void execSCHEMA_TRANS_BEGIN_REQ(Signal* signal);
void execSCHEMA_TRANS_END_REQ(Signal* signal);
+ void execSCHEMA_TRANS_IMPL_REQ(Signal* signal);
+ void execSCHEMA_TRANS_IMPL_CONF(Signal* signal);
+ void execSCHEMA_TRANS_IMPL_REF(Signal* signal);
void execDICT_LOCK_REQ(Signal* signal);
void execDICT_UNLOCK_ORD(Signal* signal);
@@ -1152,6 +1155,116 @@
}
};
+ // MODULE: SchemaTrans
+
+ struct SchemaOp;
+ struct SchemaTrans;
+ typedef Ptr<SchemaOp> SchemaOpPtr;
+ typedef Ptr<SchemaTrans> SchemaTransPtr;
+
+ // ErrorInfo
+
+ struct ErrorInfo {
+ Uint32 errorCode;
+ Uint32 errorLine;
+ Uint32 errorNodeId;
+ Uint32 errorCount;
+ ErrorInfo() :
+ errorCode(0),
+ errorLine(0),
+ errorNodeId(0),
+ errorCount(0)
+ {}
+#ifdef VM_TRACE
+ void print(NdbOut&) const;
+#endif
+ };
+
+ void resetError(ErrorInfo&);
+ void setError(ErrorInfo&, Uint32 code, Uint32 line, Uint32 nodeId = 0);
+ void setError(ErrorInfo&, const ErrorInfo&);
+ bool hasError(const ErrorInfo&);
+
+ template <class Ref>
+ inline void
+ setError(ErrorInfo& error, const Ref* ref)
+ {
+ error.errorCode = ref->errorCode;
+ error.errorLine = ref->errorLine;
+ error.errorNodeId = ref->errorNodeId;
+ }
+
+ template <class Ref>
+ inline void
+ getError(const ErrorInfo& error, Ref* ref) {
+ ref->errorCode = error.errorCode;
+ ref->errorLine = error.errorLine;
+ ref->errorNodeId = error.errorNodeId;
+ ref->masterNodeId = c_masterNodeId;
+ }
+
+ // SchemaTrans
+
+ struct SchemaTrans {
+ // ArrayPool
+ Uint32 nextPool;
+
+ // DLHashTable
+ Uint32 trans_key;
+ Uint32 nextHash;
+ Uint32 prevHash;
+ Uint32 hashValue() const {
+ return trans_key;
+ }
+ bool equal(const SchemaTrans& rec) const {
+ return trans_key == rec.trans_key;
+ }
+
+ Uint32 m_clientRef;
+ Uint32 m_transId;
+ Uint32 m_requestType;
+ Uint32 m_masterRef;
+ NdbNodeBitmask m_initialNodes;
+ NdbNodeBitmask m_failedNodes;
+ SafeCounterHandle m_counter;
+
+ ErrorInfo m_error;
+
+ SchemaTrans() :
+ trans_key(0),
+ m_clientRef(0),
+ m_transId(0),
+ m_requestType(0),
+ m_masterRef(0)
+ {}
+
+#ifdef VM_TRACE
+ void print(NdbOut&) const;
+#endif
+ };
+
+ ArrayPool<SchemaTrans> c_schemaTransPool;
+ DLHashTable<SchemaTrans> c_schemaTransHash;
+
+ bool seizeSchemaTrans(SchemaTransPtr&, Uint32 trans_key);
+ bool seizeSchemaTrans(SchemaTransPtr&);
+ bool findSchemaTrans(SchemaTransPtr&, Uint32 trans_key);
+ void releaseSchemaTrans(SchemaTransPtr&);
+
+ // master signal handling
+ void schemaTrans_sendReq(Signal*, SchemaTransPtr);
+ void schemaTrans_recvReply(Signal*, bool isConf);
+
+ // participant signal handling
+ void schemaTrans_recvReq(Signal*);
+ void schemaTrans_sendConf(Signal*, SchemaTransPtr);
+ void schemaTrans_sendRef(Signal*, SchemaTransPtr,
+ ErrorInfo);
+ void schemaTrans_sendRef(Signal*, Uint32 masterRef, Uint32 trans_key,
+ ErrorInfo);
+
+ // MODULE: CreateTable
+
/**
* Create table record
*/
@@ -2653,6 +2766,8 @@
void drop_undofile_prepare_start(Signal* signal, SchemaOperation*);
#ifdef VM_TRACE
NdbOut debugOut;
+ friend NdbOut& operator<<(NdbOut& out, const ErrorInfo&);
+ friend NdbOut& operator<<(NdbOut& out, const SchemaTrans&);
#endif
};
--- 1.33/storage/ndb/test/ndbapi/testDict.cpp 2006-12-20 09:21:58 +02:00
+++ 1.34/storage/ndb/test/ndbapi/testDict.cpp 2006-12-25 12:43:39 +02:00
@@ -2117,6 +2117,11 @@
int numTables = NDBT_Tables::getNumTables();
{
+ Uint32 n = ctx->getProperty("NumberOfTables", 0xffff);
+ if (numTables > (int)n)
+ numTables = (int)n;
+ }
+ {
for (int num = 0; num < numTables; num++) {
(void)pDic->dropTable(NDBT_Tables::getTable(num)->getName());
}
@@ -2341,9 +2346,16 @@
STEP(runRestarts);
STEP(runDictOps);
}
+TESTCASE("SchemaTrans_0",
+ "Test empty schema transactions"){
+ TC_PROPERTY("Standalone", 1);
+ TC_PROPERTY("NumberOfTables", (Uint32)0);
+ STEP(runSchemaTrans);
+}
TESTCASE("SchemaTrans",
- "Test schema transactions"){
+ "Test schema transactions with create/drop tables"){
TC_PROPERTY("Standalone", 1);
+ TC_PROPERTY("NumberOfTables", 3);
STEP(runSchemaTrans);
}
TESTCASE("SchemaTrans_NF",
--- New file ---
+++ storage/ndb/include/kernel/signaldata/SchemaTransImpl.hpp 06/12/22 15:12:37
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef SCHEMA_TRANS_IMPL_HPP
#define SCHEMA_TRANS_IMPL_HPP
#include "SignalData.hpp"
#include "GlobalSignalNumbers.h"
struct SchemaTransImplReq {
enum RequestType {
RT_UNDEFINED = 0,
RT_BEGIN = 1,
RT_END = 2
};
STATIC_CONST( SignalLength = 7 );
Uint32 senderRef;
Uint32 transKey;
Uint32 opKey;
Uint32 requestType;
Uint32 clientRef;
Uint32 transId;
Uint32 gsn;
};
struct SchemaTransImplConf {
STATIC_CONST( SignalLength = 3 );
Uint32 senderRef;
Uint32 transKey;
Uint32 replyInfo;
};
struct SchemaTransImplRef {
STATIC_CONST( SignalLength = 6 );
STATIC_CONST( GSN = GSN_SCHEMA_TRANS_IMPL_REF );
enum ErrorCode {
NoError = 0,
TooManySchemaTrans = 780,
NF_FakeErrorREF = 1
};
Uint32 senderRef;
union {
Uint32 transKey;
Uint32 senderData; // alias for SafeCounter
};
Uint32 errorCode;
Uint32 errorLine;
Uint32 errorNodeId;
Uint32 masterNodeId;
};
#endif
--- New file ---
+++ storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp 06/12/22 15:13:20
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <signaldata/SchemaTransImpl.hpp>
#include <signaldata/SignalData.hpp>
#include <SignalLoggerManager.hpp>
#include <DebuggerNames.hpp>
bool
printSCHEMA_TRANS_IMPL_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
{
const SchemaTransImplReq* sig = (const SchemaTransImplReq*)theData;
fprintf(output, " senderRef: %x", sig->senderRef);
fprintf(output, " transKey: %x", sig->transKey);
fprintf(output, " opKey: %x", sig->opKey);
fprintf(output, " requestType: %u", sig->requestType);
fprintf(output, "\n");
fprintf(output, " clientRef: %x", sig->clientRef);
fprintf(output, " transId: %x", sig->transId);
fprintf(output, " gsn: %u", sig->gsn);
fprintf(output, "\n");
const Uint32 fixed_len = SchemaTransImplReq::SignalLength;
if (len > fixed_len) {
fprintf(output, "piggy-backed: %s\n", getSignalName(sig->gsn));
const Uint32* pb_data = &theData[fixed_len];
const Uint32 pb_len = len - fixed_len;
switch (sig->gsn) {
#if wl3600_todo
case GSN_CREATE_TAB_REQ:
printCREATE_TAB_REQ(output, pb_data, pb_len, rbn);
break;
// etc for all internal DICT signals
#endif
default:
{
Uint32 i;
for (i = 0; i < len - fixed_len; i++) {
if (i > 0 && i % 7 == 0)
fprintf(output, "\n");
fprintf(output, " H'%08x", theData[fixed_len + i]);
}
fprintf(output, "\n");
}
break;
}
}
return true;
}
bool
printSCHEMA_TRANS_IMPL_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
{
const SchemaTransImplConf* sig = (const SchemaTransImplConf*)theData;
fprintf(output, " senderRef: %x", sig->senderRef);
fprintf(output, " transKey: %x", sig->transKey);
fprintf(output, " replyInfo: %x", sig->replyInfo);
fprintf(output, "\n");
return true;
}
bool
printSCHEMA_TRANS_IMPL_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
{
const SchemaTransImplRef* sig = (const SchemaTransImplRef*)theData;
fprintf(output, " senderRef: %x", sig->senderRef);
fprintf(output, " transKey: %x", sig->transKey);
fprintf(output, "\n");
fprintf(output, " errorCode: %u", sig->errorCode);
fprintf(output, " errorLine: %u", sig->errorLine);
fprintf(output, "\n");
return true;
}
--- 1.10/storage/ndb/src/common/debugger/signaldata/Makefile.am 2006-12-20 14:30:20 +02:00
+++ 1.11/storage/ndb/src/common/debugger/signaldata/Makefile.am 2006-12-25 12:43:39 +02:00
@@ -25,7 +25,7 @@
UtilLock.cpp TuxMaint.cpp AccLock.cpp \
LqhTrans.cpp ReadNodesConf.cpp CntrStart.cpp \
ScanFrag.cpp \
- SchemaTrans.cpp
+ SchemaTrans.cpp SchemaTransImpl.cpp
include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
| Thread |
|---|
| • bk commit into 5.1 tree (pekka:1.2374) | pekka | 25 Dec |