Below is the list of changes that have just been committed into a local
5.1 repository of marty. When marty 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
1.1888 05/09/16 10:14:04 mskold@stripped +5 -0
Merge mskold@stripped:/home/bk/mysql-5.1
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-opt
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
1.37 05/09/16 10:13:59 mskold@stripped +2 -2
Merge
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
1.94 05/09/16 10:13:59 mskold@stripped +12 -11
Merge
storage/ndb/src/ndbapi/NdbDictionary.cpp
1.41 05/09/16 09:32:21 mskold@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
1.20 05/09/16 09:32:21 mskold@stripped +0 -0
Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
1.55 05/09/16 09:32:21 mskold@stripped +0 -0
Auto merged
# 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: mskold
# Host: blowfish.ndb.mysql.com
# Root: /usr/local/home/marty/MySQL/mysql-5.1-opt/RESYNC
--- 1.54/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-09-13 14:10:48 +02:00
+++ 1.55/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2005-09-16 09:32:21 +02:00
@@ -60,8 +60,6 @@
#include <signaldata/UtilExecute.hpp>
#include <signaldata/UtilRelease.hpp>
#include <signaldata/SumaImpl.hpp>
-#include <GrepError.hpp>
-//#include <signaldata/DropEvnt.hpp>
#include <signaldata/LqhFrag.hpp>
@@ -1290,9 +1288,6 @@
addRecSignal(GSN_SUB_STOP_CONF, &Dbdict::execSUB_STOP_CONF);
addRecSignal(GSN_SUB_STOP_REF, &Dbdict::execSUB_STOP_REF);
- addRecSignal(GSN_SUB_SYNC_CONF, &Dbdict::execSUB_SYNC_CONF);
- addRecSignal(GSN_SUB_SYNC_REF, &Dbdict::execSUB_SYNC_REF);
-
addRecSignal(GSN_DROP_EVNT_REQ, &Dbdict::execDROP_EVNT_REQ);
addRecSignal(GSN_SUB_REMOVE_REQ, &Dbdict::execSUB_REMOVE_REQ);
@@ -2690,13 +2685,27 @@
c_tableRecordPool.getPtr(tabPtr, createTabPtr.p->m_tablePtrI);
tabPtr.p->tabState = TableRecord::DEFINED;
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
c_restartRecord.activeTable++;
checkSchemaStatus(signal);
}
void
+Dbdict::releaseCreateTableOp(Signal* signal, CreateTableRecordPtr createTabPtr)
+{
+ if (createTabPtr.p->m_tabInfoPtrI != RNIL)
+ {
+ jam();
+ SegmentedSectionPtr tabInfoPtr;
+ getSection(tabInfoPtr, createTabPtr.p->m_tabInfoPtrI);
+ signal->setSection(tabInfoPtr, 0);
+ releaseSections(signal);
+ }
+ c_opCreateTable.release(createTabPtr);
+}
+
+void
Dbdict::restartDropTab(Signal* signal, Uint32 tableId){
const Uint32 key = ++c_opRecordSequence;
@@ -3777,7 +3786,7 @@
TableRecordPtr tabPtr;
c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_tablePtrI);
releaseTableObject(tabPtr.i, false);
- c_opCreateTable.release(alterTabPtr);
+ releaseCreateTableOp(signal,alterTabPtr);
c_blockState = BS_IDLE;
}
else {
@@ -3930,6 +3939,7 @@
writeTableFile(signal, tableId, tabInfoPtr, &callback);
+ alterTabPtr.p->m_tabInfoPtrI = RNIL;
signal->setSection(tabInfoPtr, 0);
releaseSections(signal);
}
@@ -3954,6 +3964,17 @@
conf->tableVersion = tabPtr.p->tableVersion;
conf->gci = tabPtr.p->gciTableCreated;
conf->requestType = AlterTabReq::AlterTableCommit;
+ {
+ AlterTabConf tmp= *conf;
+ if (coordinatorRef == reference())
+ conf->senderRef = alterTabPtr.p->m_senderRef;
+ else
+ conf->senderRef = 0;
+ EXECUTE_DIRECT(SUMA, GSN_ALTER_TAB_CONF, signal,
+ AlterTabConf::SignalLength);
+ jamEntry();
+ *conf= tmp;
+ }
sendSignal(coordinatorRef, GSN_ALTER_TAB_CONF, signal,
AlterTabConf::SignalLength, JBB);
@@ -3982,7 +4003,7 @@
// Release resources
c_tableRecordPool.getPtr(tabPtr, alterTabPtr.p->m_tablePtrI);
releaseTableObject(tabPtr.i, false);
- c_opCreateTable.release(alterTabPtr);
+ releaseCreateTableOp(signal,alterTabPtr);
c_blockState = BS_IDLE;
}
}
@@ -4172,7 +4193,7 @@
//@todo check api failed
sendSignal(createTabPtr.p->m_senderRef, GSN_CREATE_TABLE_REF, signal,
CreateTableRef::SignalLength, JBB);
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
c_blockState = BS_IDLE;
return;
}
@@ -4231,7 +4252,7 @@
//@todo check api failed
sendSignal(createTabPtr.p->m_senderRef, GSN_CREATE_TABLE_CONF, signal,
CreateTableConf::SignalLength, JBB);
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
c_blockState = BS_IDLE;
return;
}
@@ -4362,10 +4383,11 @@
SegmentedSectionPtr tabInfoPtr;
getSection(tabInfoPtr, createTabPtr.p->m_tabInfoPtrI);
writeTableFile(signal, createTabPtr.p->m_tablePtrI, tabInfoPtr, &callback);
-
+#if 0
createTabPtr.p->m_tabInfoPtrI = RNIL;
signal->setSection(tabInfoPtr, 0);
releaseSections(signal);
+#endif
}
void
@@ -4853,12 +4875,28 @@
CreateTabConf * const conf = (CreateTabConf*)signal->getDataPtr();
conf->senderRef = reference();
conf->senderData = createTabPtr.p->key;
+ {
+ CreateTabConf tmp= *conf;
+ conf->senderData = createTabPtr.p->m_tablePtrI;
+#if 0
+ signal->header.m_noOfSections = 1;
+ SegmentedSectionPtr tabInfoPtr;
+ getSection(tabInfoPtr, createTabPtr.p->m_tabInfoPtrI);
+ signal->setSection(tabInfoPtr, 0);
+#endif
+ sendSignal(SUMA_REF, GSN_CREATE_TAB_CONF, signal,
+ CreateTabConf::SignalLength, JBB);
+ *conf= tmp;
+#if 0
+ signal->header.m_noOfSections = 0;
+#endif
+ }
sendSignal(createTabPtr.p->m_coordinatorRef, GSN_CREATE_TAB_CONF,
signal, CreateTabConf::SignalLength, JBB);
if(createTabPtr.p->m_coordinatorRef != reference()){
jam();
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
}
}
@@ -4926,7 +4964,7 @@
if(createTabPtr.p->m_coordinatorRef != reference()){
jam();
- c_opCreateTable.release(createTabPtr);
+ releaseCreateTableOp(signal,createTabPtr);
}
c_opDropTable.release(dropTabPtr);
@@ -5095,7 +5133,8 @@
if (parseP->requestType != DictTabInfo::AlterTableFromAPI) {
jam();
#ifdef VM_TRACE
- ndbout_c("Dbdict: name=%s,id=%u", tablePtr.p->tableName, tablePtr.i);
+ ndbout_c("Dbdict: name=%s, id=%u, version=%u",
+ tablePtr.p->tableName, tablePtr.i, tablePtr.p->tableVersion);
TableRecordPtr tmp;
ndbrequire(!c_tableRecordHash.find(tmp, * tablePtr.p));
#endif
@@ -5744,7 +5783,6 @@
conf->senderData = dropTabPtr.p->m_request.senderData;
conf->tableId = dropTabPtr.p->m_request.tableId;
conf->tableVersion = dropTabPtr.p->m_request.tableVersion;
-
Uint32 ref = dropTabPtr.p->m_request.senderRef;
sendSignal(ref, GSN_DROP_TABLE_CONF, signal,
DropTableConf::SignalLength, JBB);
@@ -6005,7 +6043,17 @@
conf->senderRef = reference();
conf->senderData = dropTabPtrI;
conf->tableId = dropTabPtr.p->m_request.tableId;
-
+ {
+ DropTabConf tmp= *conf;
+ if (dropTabPtr.p->m_coordinatorRef == reference())
+ conf->senderRef = dropTabPtr.p->m_request.senderRef;
+ else
+ conf->senderRef = 0;
+ EXECUTE_DIRECT(SUMA, GSN_DROP_TAB_CONF, signal,
+ DropTabConf::SignalLength);
+ jamEntry();
+ *conf= tmp;
+ }
dropTabPtr.p->m_participantData.m_gsn = GSN_DROP_TAB_CONF;
sendSignal(dropTabPtr.p->m_coordinatorRef, GSN_DROP_TAB_CONF, signal,
DropTabConf::SignalLength, JBB);
@@ -6152,7 +6200,7 @@
* The format of GetTabInfo Req/Ref is the same
*/
BlockReference retRef = req->senderRef;
- ref->err = errorCode;
+ ref->err = errorCode;
sendSignal(retRef, GSN_GET_TABLEID_REF, signal,
GetTableIdRef::SignalLength, JBB);
}//sendGET_TABINFOREF()
@@ -7577,6 +7625,8 @@
const Uint32 Dbdict::sysTab_NDBEVENTS_0_szs[EVENT_SYSTEM_TABLE_LENGTH] = {
sizeof(((sysTab_NDBEVENTS_0*)0)->NAME),
sizeof(((sysTab_NDBEVENTS_0*)0)->EVENT_TYPE),
+ sizeof(((sysTab_NDBEVENTS_0*)0)->TABLEID),
+ sizeof(((sysTab_NDBEVENTS_0*)0)->TABLEVERSION),
sizeof(((sysTab_NDBEVENTS_0*)0)->TABLE_NAME),
sizeof(((sysTab_NDBEVENTS_0*)0)->ATTRIBUTE_MASK),
sizeof(((sysTab_NDBEVENTS_0*)0)->SUBID),
@@ -7794,7 +7844,7 @@
CreateEvntRef * ret = (CreateEvntRef *)signal->getDataPtrSend();
ret->senderRef = reference();
- ret->setErrorCode(CreateEvntRef::SeizeError);
+ ret->setErrorCode(747);
ret->setErrorLine(__LINE__);
ret->setErrorNode(reference());
sendSignal(signal->senderBlockRef(), GSN_CREATE_EVNT_REF, signal,
@@ -7835,7 +7885,7 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
@@ -7849,8 +7899,10 @@
*****************************************************************/
void
-Dbdict::createEvent_RT_USER_CREATE(Signal* signal, OpCreateEventPtr evntRecPtr){
+Dbdict::createEvent_RT_USER_CREATE(Signal* signal, OpCreateEventPtr evntRecPtr)
+{
jam();
+ DBUG_ENTER("Dbdict::createEvent_RT_USER_CREATE");
evntRecPtr.p->m_request.setUserRef(signal->senderBlockRef());
#ifdef EVENT_DEBUG
@@ -7878,12 +7930,12 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
r0.getString(evntRecPtr.p->m_eventRec.NAME);
{
@@ -7904,24 +7956,19 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
r0.getString(evntRecPtr.p->m_eventRec.TABLE_NAME);
{
int len = strlen(evntRecPtr.p->m_eventRec.TABLE_NAME);
memset(evntRecPtr.p->m_eventRec.TABLE_NAME+len, 0, MAX_TAB_NAME_SIZE-len);
}
-
-#ifdef EVENT_DEBUG
- ndbout_c("event name: %s",evntRecPtr.p->m_eventRec.NAME);
- ndbout_c("table name: %s",evntRecPtr.p->m_eventRec.TABLE_NAME);
-#endif
-
+
releaseSections(signal);
// Send request to SUMA
@@ -7930,6 +7977,7 @@
(CreateSubscriptionIdReq *)signal->getDataPtrSend();
// make sure we save the original sender for later
+ sumaIdReq->senderRef = reference();
sumaIdReq->senderData = evntRecPtr.i;
#ifdef EVENT_DEBUG
ndbout << "sumaIdReq->senderData = " << sumaIdReq->senderData << endl;
@@ -7938,12 +7986,13 @@
CreateSubscriptionIdReq::SignalLength, JBB);
// we should now return in either execCREATE_SUBID_CONF
// or execCREATE_SUBID_REF
+ DBUG_VOID_RETURN;
}
void Dbdict::execCREATE_SUBID_REF(Signal* signal)
{
- jamEntry();
- EVENT_TRACE;
+ jamEntry();
+ DBUG_ENTER("Dbdict::execCREATE_SUBID_REF");
CreateSubscriptionIdRef * const ref =
(CreateSubscriptionIdRef *)signal->getDataPtr();
OpCreateEventPtr evntRecPtr;
@@ -7951,17 +8000,26 @@
evntRecPtr.i = ref->senderData;
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
+ if (ref->errorCode)
+ {
+ evntRecPtr.p->m_errorCode = ref->errorCode;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
+ else
+ {
+ evntRecPtr.p->m_errorCode = 1;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
+ DBUG_VOID_RETURN;
}
void Dbdict::execCREATE_SUBID_CONF(Signal* signal)
{
jamEntry();
- EVENT_TRACE;
+ DBUG_ENTER("Dbdict::execCREATE_SUBID_CONF");
CreateSubscriptionIdConf const * sumaIdConf =
(CreateSubscriptionIdConf *)signal->getDataPtr();
@@ -7980,6 +8038,7 @@
prepareTransactionEventSysTable(&c, signal, evntRecId,
UtilPrepareReq::Insert);
+ DBUG_VOID_RETURN;
}
void
@@ -7997,46 +8056,47 @@
*/
void interpretUtilPrepareErrorCode(UtilPrepareRef::ErrorCode errorCode,
- bool& temporary, Uint32& line)
+ Uint32& error, Uint32& line)
{
+ DBUG_ENTER("interpretUtilPrepareErrorCode");
switch (errorCode) {
case UtilPrepareRef::NO_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::PREPARE_SEIZE_ERROR:
jam();
- temporary = true;
+ error = 748;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::PREPARE_PAGES_SEIZE_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::PREPARED_OPERATION_SEIZE_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::DICT_TAB_INFO_ERROR:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
case UtilPrepareRef::MISSING_PROPERTIES_SECTION:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
default:
jam();
+ error = 1;
line = __LINE__;
- EVENT_TRACE;
- break;
+ DBUG_VOID_RETURN;
}
+ DBUG_VOID_RETURN;
}
void
@@ -8059,25 +8119,28 @@
switch (evntRecPtr.p->m_requestType) {
case CreateEvntReq::RT_USER_GET:
-#ifdef EVENT_DEBUG
- printf("get type = %d\n", CreateEvntReq::RT_USER_GET);
-#endif
jam();
executeTransEventSysTable(&c, signal,
evntRecPtr.i, evntRecPtr.p->m_eventRec,
prepareId, UtilPrepareReq::Read);
break;
case CreateEvntReq::RT_USER_CREATE:
-#ifdef EVENT_DEBUG
- printf("create type = %d\n", CreateEvntReq::RT_USER_CREATE);
-#endif
{
evntRecPtr.p->m_eventRec.EVENT_TYPE = evntRecPtr.p->m_request.getEventType();
+ evntRecPtr.p->m_eventRec.TABLEID = evntRecPtr.p->m_request.getTableId();
+ evntRecPtr.p->m_eventRec.TABLEVERSION=evntRecPtr.p->m_request.getTableVersion();
AttributeMask m = evntRecPtr.p->m_request.getAttrListBitmask();
memcpy(evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK, &m,
sizeof(evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK));
evntRecPtr.p->m_eventRec.SUBID = evntRecPtr.p->m_request.getEventId();
evntRecPtr.p->m_eventRec.SUBKEY = evntRecPtr.p->m_request.getEventKey();
+ DBUG_PRINT("info",
+ ("CREATE: event name: %s table name: %s table id: %u table version: %u",
+ evntRecPtr.p->m_eventRec.NAME,
+ evntRecPtr.p->m_eventRec.TABLE_NAME,
+ evntRecPtr.p->m_eventRec.TABLEID,
+ evntRecPtr.p->m_eventRec.TABLEVERSION));
+
}
jam();
executeTransEventSysTable(&c, signal,
@@ -8102,17 +8165,9 @@
evntRecPtr.i = ref->getSenderData();
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
- bool temporary = false;
- interpretUtilPrepareErrorCode(errorCode,
- temporary, evntRecPtr.p->m_errorLine);
- if (temporary) {
- evntRecPtr.p->m_errorCode =
- CreateEvntRef::makeTemporary(CreateEvntRef::Undefined);
- }
-
- if (evntRecPtr.p->m_errorCode == 0) {
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- }
+ Uint32 err;
+ interpretUtilPrepareErrorCode(errorCode, evntRecPtr.p->m_errorCode,
+ evntRecPtr.p->m_errorLine);
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
@@ -8283,20 +8338,22 @@
switch (evntRec->m_requestType) {
case CreateEvntReq::RT_USER_GET: {
-#ifdef EVENT_DEBUG
- printf("get type = %d\n", CreateEvntReq::RT_USER_GET);
-#endif
parseReadEventSys(signal, evntRecPtr.p->m_eventRec);
evntRec->m_request.setEventType(evntRecPtr.p->m_eventRec.EVENT_TYPE);
- evntRec->m_request.setAttrListBitmask(*(AttributeMask*)evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK);
+ evntRec->m_request.setTableId(evntRecPtr.p->m_eventRec.TABLEID);
+ evntRec->m_request.setTableVersion(evntRecPtr.p->m_eventRec.TABLEVERSION);
+ evntRec->m_request.setAttrListBitmask(*(AttributeMask*)
+ evntRecPtr.p->m_eventRec.ATTRIBUTE_MASK);
evntRec->m_request.setEventId(evntRecPtr.p->m_eventRec.SUBID);
evntRec->m_request.setEventKey(evntRecPtr.p->m_eventRec.SUBKEY);
-#ifdef EVENT_DEBUG
- printf("EventName: %s\n", evntRec->m_eventRec.NAME);
- printf("TableName: %s\n", evntRec->m_eventRec.TABLE_NAME);
-#endif
+ DBUG_PRINT("info",
+ ("GET: event name: %s table name: %s table id: %u table version: %u",
+ evntRecPtr.p->m_eventRec.NAME,
+ evntRecPtr.p->m_eventRec.TABLE_NAME,
+ evntRecPtr.p->m_eventRec.TABLEID,
+ evntRecPtr.p->m_eventRec.TABLEVERSION));
// find table id for event table
TableRecord keyRecord;
@@ -8307,7 +8364,7 @@
if (tablePtr.i == RNIL) {
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 723;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
@@ -8316,6 +8373,7 @@
}
evntRec->m_request.setTableId(tablePtr.p->tableId);
+ evntRec->m_request.setTableVersion(tablePtr.p->tableVersion);
createEventComplete_RT_USER_GET(signal, evntRecPtr);
return;
@@ -8346,21 +8404,21 @@
switch (ref->getTCErrorCode()) {
case ZNOT_FOUND:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::EventNotFound;
+ evntRecPtr.p->m_errorCode = 4710;
break;
case ZALREADYEXIST:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::EventNameExists;
+ evntRecPtr.p->m_errorCode = 746;
break;
default:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::UndefinedTCError;
+ evntRecPtr.p->m_errorCode = ref->getTCErrorCode();
break;
}
break;
default:
jam();
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = ref->getErrorCode();
break;
}
@@ -8396,7 +8454,7 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
@@ -8532,8 +8590,8 @@
SubCreateReq * sumaReq = (SubCreateReq *)signal->getDataPtrSend();
- sumaReq->subscriberRef = reference(); // reference to DICT
- sumaReq->subscriberData = evntRecPtr.i;
+ sumaReq->senderRef = reference(); // reference to DICT
+ sumaReq->senderData = evntRecPtr.i;
sumaReq->subscriptionId = evntRecPtr.p->m_request.getEventId();
sumaReq->subscriptionKey = evntRecPtr.p->m_request.getEventKey();
sumaReq->subscriptionType = SubCreateReq::TableEvent;
@@ -8544,106 +8602,56 @@
#endif
sendSignal(SUMA_REF, GSN_SUB_CREATE_REQ, signal,
- SubCreateReq::SignalLength+1 /*to get table Id*/, JBB);
+ SubCreateReq::SignalLength, JBB);
}
void Dbdict::execSUB_CREATE_REF(Signal* signal)
{
jamEntry();
- EVENT_TRACE;
+ DBUG_ENTER("Dbdict::execSUB_CREATE_REF");
+
SubCreateRef * const ref = (SubCreateRef *)signal->getDataPtr();
OpCreateEventPtr evntRecPtr;
- evntRecPtr.i = ref->subscriberData;
+ evntRecPtr.i = ref->senderData;
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("DBDICT(Participant) got SUB_CREATE_REF evntRecPtr.i = (%d)", evntRecPtr.i);
-#endif
-
- if (ref->err == GrepError::SUBSCRIPTION_ID_NOT_UNIQUE) {
+ if (ref->errorCode == 1415) {
jam();
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("SUBSCRIPTION_ID_NOT_UNIQUE");
-#endif
createEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("Other error");
-#endif
-
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
+ if (ref->errorCode)
+ {
+ evntRecPtr.p->m_errorCode = ref->errorCode;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
+ else
+ {
+ evntRecPtr.p->m_errorCode = 1;
+ evntRecPtr.p->m_errorLine = __LINE__;
+ }
evntRecPtr.p->m_errorNode = reference();
createEvent_sendReply(signal, evntRecPtr);
+ DBUG_VOID_RETURN;
}
void Dbdict::execSUB_CREATE_CONF(Signal* signal)
{
jamEntry();
+ DBUG_ENTER("Dbdict::execSUB_CREATE_CONF");
EVENT_TRACE;
SubCreateConf * const sumaConf = (SubCreateConf *)signal->getDataPtr();
-
- const Uint32 subscriptionId = sumaConf->subscriptionId;
- const Uint32 subscriptionKey = sumaConf->subscriptionKey;
- const Uint32 evntRecId = sumaConf->subscriberData;
-
- OpCreateEvent *evntRec;
- ndbrequire((evntRec = c_opCreateEvent.getPtr(evntRecId)) != NULL);
-
-#ifdef EVENT_PH2_DEBUG
- ndbout_c("DBDICT(Participant) got SUB_CREATE_CONF evntRecPtr.i = (%d)", evntRecId);
-#endif
-
- SubSyncReq *sumaSync = (SubSyncReq *)signal->getDataPtrSend();
-
- sumaSync->subscriptionId = subscriptionId;
- sumaSync->subscriptionKey = subscriptionKey;
- sumaSync->part = (Uint32) SubscriptionData::MetaData;
- sumaSync->subscriberData = evntRecId;
-
- sendSignal(SUMA_REF, GSN_SUB_SYNC_REQ, signal,
- SubSyncReq::SignalLength, JBB);
-}
-
-void Dbdict::execSUB_SYNC_REF(Signal* signal)
-{
- jamEntry();
- EVENT_TRACE;
- SubSyncRef * const ref = (SubSyncRef *)signal->getDataPtr();
OpCreateEventPtr evntRecPtr;
-
- evntRecPtr.i = ref->subscriberData;
+ evntRecPtr.i = sumaConf->senderData;
ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
- evntRecPtr.p->m_errorNode = reference();
-
createEvent_sendReply(signal, evntRecPtr);
-}
-
-void Dbdict::execSUB_SYNC_CONF(Signal* signal)
-{
- jamEntry();
- EVENT_TRACE;
-
- SubSyncConf * const sumaSyncConf = (SubSyncConf *)signal->getDataPtr();
-
- // Uint32 subscriptionId = sumaSyncConf->subscriptionId;
- // Uint32 subscriptionKey = sumaSyncConf->subscriptionKey;
- OpCreateEventPtr evntRecPtr;
- evntRecPtr.i = sumaSyncConf->subscriberData;
- ndbrequire((evntRecPtr.p = c_opCreateEvent.getPtr(evntRecPtr.i)) != NULL);
-
- ndbrequire(sumaSyncConf->part == (Uint32)SubscriptionData::MetaData);
-
- createEvent_sendReply(signal, evntRecPtr);
+ DBUG_VOID_RETURN;
}
/****************************************************
@@ -8670,7 +8678,7 @@
if (evntRecPtr.p->m_reqTracker.hasRef()) {
ptr = NULL; // we don't want to return anything if there's an error
if (!evntRecPtr.p->hasError()) {
- evntRecPtr.p->m_errorCode = CreateEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
jam();
@@ -8694,6 +8702,7 @@
ret->setUserData(evntRecPtr.p->m_request.getUserData());
ret->senderRef = reference();
ret->setTableId(evntRecPtr.p->m_request.getTableId());
+ ret->setTableVersion(evntRecPtr.p->m_request.getTableVersion());
ret->setEventType(evntRecPtr.p->m_request.getEventType());
ret->setRequestType(evntRecPtr.p->m_request.getRequestType());
@@ -8719,6 +8728,7 @@
evntConf->setUserData(evntRecPtr.p->m_request.getUserData());
evntConf->senderRef = reference();
evntConf->setTableId(evntRecPtr.p->m_request.getTableId());
+ evntConf->setTableVersion(evntRecPtr.p->m_request.getTableVersion());
evntConf->setAttrListBitmask(evntRecPtr.p->m_request.getAttrListBitmask());
evntConf->setEventType(evntRecPtr.p->m_request.getEventType());
evntConf->setRequestType(evntRecPtr.p->m_request.getRequestType());
@@ -8767,7 +8777,7 @@
// ret->setErrorLine(__LINE__);
// ret->setErrorNode(reference());
ref->senderRef = reference();
- ref->setTemporary(SubStartRef::Busy);
+ ref->errorCode = SubStartRef::Busy;
sendSignal(origSenderRef, GSN_SUB_START_REF, signal,
SubStartRef::SignalLength2, JBB);
@@ -8828,6 +8838,7 @@
const SubStartRef* ref = (SubStartRef*) signal->getDataPtr();
Uint32 senderRef = ref->senderRef;
+ Uint32 err = ref->errorCode;
OpSubEventPtr subbPtr;
c_opSubEvent.getPtr(subbPtr, ref->senderData);
@@ -8842,27 +8853,13 @@
ndbout_c("DBDICT(Participant) got GSN_SUB_START_REF = (%d)", subbPtr.i);
#endif
- if (ref->isTemporary()){
- jam();
- SubStartReq* req = (SubStartReq*)signal->getDataPtrSend();
- { // fix
- Uint32 subscriberRef = ref->subscriberRef;
- req->subscriberRef = subscriberRef;
- }
- req->senderRef = reference();
- req->senderData = subbPtr.i;
- sendSignal(SUMA_REF, GSN_SUB_START_REQ,
- signal, SubStartReq::SignalLength2, JBB);
- } else {
- jam();
-
- SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->senderData = subbPtr.p->m_senderData;
- sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF,
- signal, SubStartRef::SignalLength2, JBB);
- c_opSubEvent.release(subbPtr);
- }
+ jam();
+ SubStartRef* ref = (SubStartRef*) signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->senderData = subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_START_REF,
+ signal, SubStartRef::SignalLength2, JBB);
+ c_opSubEvent.release(subbPtr);
return;
}
/*
@@ -8872,11 +8869,15 @@
#ifdef EVENT_PH3_DEBUG
ndbout_c("DBDICT(Coordinator) got GSN_SUB_START_REF = (%d)", subbPtr.i);
#endif
- if (ref->errorCode == SubStartRef::NF_FakeErrorREF){
+ if (err == SubStartRef::NF_FakeErrorREF){
jam();
subbPtr.p->m_reqTracker.ignoreRef(c_counterMgr, refToNode(senderRef));
} else {
jam();
+ if (subbPtr.p->m_errorCode == 0)
+ {
+ subbPtr.p->m_errorCode= err ? err : 1;
+ }
subbPtr.p->m_reqTracker.reportRef(c_counterMgr, refToNode(senderRef));
}
completeSubStartReq(signal,subbPtr.i,0);
@@ -8979,7 +8980,7 @@
// ret->setErrorLine(__LINE__);
// ret->setErrorNode(reference());
ref->senderRef = reference();
- ref->setTemporary(SubStopRef::Busy);
+ ref->errorCode = SubStopRef::Busy;
sendSignal(origSenderRef, GSN_SUB_STOP_REF, signal,
SubStopRef::SignalLength, JBB);
@@ -9036,6 +9037,7 @@
jamEntry();
const SubStopRef* ref = (SubStopRef*) signal->getDataPtr();
Uint32 senderRef = ref->senderRef;
+ Uint32 err = ref->errorCode;
OpSubEventPtr subbPtr;
c_opSubEvent.getPtr(subbPtr, ref->senderData);
@@ -9045,33 +9047,27 @@
* Participant
*/
jam();
- if (ref->isTemporary()){
- jam();
- SubStopReq* req = (SubStopReq*)signal->getDataPtrSend();
- req->senderRef = reference();
- req->senderData = subbPtr.i;
- sendSignal(SUMA_REF, GSN_SUB_STOP_REQ,
- signal, SubStopReq::SignalLength, JBB);
- } else {
- jam();
- SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->senderData = subbPtr.p->m_senderData;
- sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
- signal, SubStopRef::SignalLength, JBB);
- c_opSubEvent.release(subbPtr);
- }
+ SubStopRef* ref = (SubStopRef*) signal->getDataPtrSend();
+ ref->senderRef = reference();
+ ref->senderData = subbPtr.p->m_senderData;
+ sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
+ signal, SubStopRef::SignalLength, JBB);
+ c_opSubEvent.release(subbPtr);
return;
}
/*
* Coordinator
*/
ndbrequire(refToBlock(senderRef) == DBDICT);
- if (ref->errorCode == SubStopRef::NF_FakeErrorREF){
+ if (err == SubStopRef::NF_FakeErrorREF){
jam();
subbPtr.p->m_reqTracker.ignoreRef(c_counterMgr, refToNode(senderRef));
} else {
jam();
+ if (subbPtr.p->m_errorCode == 0)
+ {
+ subbPtr.p->m_errorCode= err ? err : 1;
+ }
subbPtr.p->m_reqTracker.reportRef(c_counterMgr, refToNode(senderRef));
}
completeSubStopReq(signal,subbPtr.i,0);
@@ -9131,17 +9127,9 @@
#endif
SubStopRef* ref = (SubStopRef*)signal->getDataPtrSend();
- ref->senderRef = reference();
- ref->senderData = subbPtr.p->m_senderData;
- /*
- ref->subscriptionId = subbPtr.p->m_senderData;
- ref->subscriptionKey = subbPtr.p->m_senderData;
- ref->part = subbPtr.p->m_part; // SubscriptionData::Part
- ref->subscriberData = subbPtr.p->m_subscriberData;
- ref->subscriberRef = subbPtr.p->m_subscriberRef;
- */
- ref->errorCode = subbPtr.p->m_errorCode;
-
+ ref->senderRef = reference();
+ ref->senderData = subbPtr.p->m_senderData;
+ ref->errorCode = subbPtr.p->m_errorCode;
sendSignal(subbPtr.p->m_senderRef, GSN_SUB_STOP_REF,
signal, SubStopRef::SignalLength, JBB);
@@ -9171,7 +9159,7 @@
Dbdict::execDROP_EVNT_REQ(Signal* signal)
{
jamEntry();
- EVENT_TRACE;
+ DBUG_ENTER("Dbdict::execDROP_EVNT_REQ");
DropEvntReq *req = (DropEvntReq*)signal->getDataPtr();
const Uint32 senderRef = signal->senderBlockRef();
@@ -9184,12 +9172,12 @@
releaseSections(signal);
DropEvntRef * ret = (DropEvntRef *)signal->getDataPtrSend();
- ret->setErrorCode(DropEvntRef::SeizeError);
+ ret->setErrorCode(747);
ret->setErrorLine(__LINE__);
ret->setErrorNode(reference());
sendSignal(senderRef, GSN_DROP_EVNT_REF, signal,
DropEvntRef::SignalLength, JBB);
- return;
+ DBUG_VOID_RETURN;
}
#ifdef EVENT_DEBUG
@@ -9214,12 +9202,12 @@
jam();
releaseSections(signal);
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = 1;
evntRecPtr.p->m_errorLine = __LINE__;
evntRecPtr.p->m_errorNode = reference();
dropEvent_sendReply(signal, evntRecPtr);
- return;
+ DBUG_VOID_RETURN;
}
r0.getString(evntRecPtr.p->m_eventRec.NAME);
{
@@ -9240,6 +9228,7 @@
prepareTransactionEventSysTable(&c, signal, evntRecPtr.i,
UtilPrepareReq::Read);
+ DBUG_VOID_RETURN;
}
void
@@ -9313,6 +9302,7 @@
Dbdict::execSUB_REMOVE_REQ(Signal* signal)
{
jamEntry();
+ DBUG_ENTER("Dbdict::execSUB_REMOVE_REQ");
Uint32 origSenderRef = signal->senderBlockRef();
@@ -9321,11 +9311,11 @@
SubRemoveRef * ref = (SubRemoveRef *)signal->getDataPtrSend();
jam();
ref->senderRef = reference();
- ref->setTemporary(SubRemoveRef::Busy);
+ ref->errorCode = SubRemoveRef::Busy;
sendSignal(origSenderRef, GSN_SUB_REMOVE_REF, signal,
SubRemoveRef::SignalLength, JBB);
- return;
+ DBUG_VOID_RETURN;
}
{
@@ -9340,6 +9330,7 @@
req->senderData = subbPtr.i;
sendSignal(SUMA_REF, GSN_SUB_REMOVE_REQ, signal, SubRemoveReq::SignalLength, JBB);
+ DBUG_VOID_RETURN;
}
/*
@@ -9350,8 +9341,11 @@
Dbdict::execSUB_REMOVE_REF(Signal* signal)
{
jamEntry();
+ DBUG_ENTER("Dbdict::execSUB_REMOVE_REF");
+
const SubRemoveRef* ref = (SubRemoveRef*) signal->getDataPtr();
Uint32 senderRef = ref->senderRef;
+ Uint32 err= ref->errorCode;
if (refToBlock(senderRef) == SUMA) {
/*
@@ -9360,8 +9354,8 @@
jam();
OpSubEventPtr subbPtr;
c_opSubEvent.getPtr(subbPtr, ref->senderData);
- if (ref->errorCode == (Uint32) GrepError::SUBSCRIPTION_ID_NOT_FOUND) {
- // conf this since this may occur if a nodefailiure has occured
+ if (err == 1407) {
+ // conf this since this may occur if a nodefailure has occured
// earlier so that the systable was not cleared
SubRemoveConf* conf = (SubRemoveConf*) signal->getDataPtrSend();
conf->senderRef = reference();
@@ -9376,7 +9370,7 @@
signal, SubRemoveRef::SignalLength, JBB);
}
c_opSubEvent.release(subbPtr);
- return;
+ DBUG_VOID_RETURN;
}
/*
* Coordinator
@@ -9384,14 +9378,21 @@
ndbrequire(refToBlock(senderRef) == DBDICT);
OpDropEventPtr eventRecPtr;
c_opDropEvent.getPtr(eventRecPtr, ref->senderData);
- if (ref->errorCode == SubRemoveRef::NF_FakeErrorREF){
+ if (err == SubRemoveRef::NF_FakeErrorREF){
jam();
eventRecPtr.p->m_reqTracker.ignoreRef(c_counterMgr, refToNode(senderRef));
} else {
jam();
+ if (eventRecPtr.p->m_errorCode == 0)
+ {
+ eventRecPtr.p->m_errorCode= err ? err : 1;
+ eventRecPtr.p->m_errorLine= __LINE__;
+ eventRecPtr.p->m_errorNode= reference();
+ }
eventRecPtr.p->m_reqTracker.reportRef(c_counterMgr, refToNode(senderRef));
}
completeSubRemoveReq(signal,eventRecPtr.i,0);
+ DBUG_VOID_RETURN;
}
void
@@ -9439,9 +9440,12 @@
if (evntRecPtr.p->m_reqTracker.hasRef()) {
jam();
- evntRecPtr.p->m_errorNode = reference();
- evntRecPtr.p->m_errorLine = __LINE__;
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
+ if ( evntRecPtr.p->m_errorCode == 0 )
+ {
+ evntRecPtr.p->m_errorNode = reference();
+ evntRecPtr.p->m_errorLine = __LINE__;
+ evntRecPtr.p->m_errorCode = 1;
+ }
dropEvent_sendReply(signal, evntRecPtr);
return;
}
@@ -9517,18 +9521,8 @@
evntRecPtr.i = ref->getSenderData();
ndbrequire((evntRecPtr.p = c_opDropEvent.getPtr(evntRecPtr.i)) != NULL);
- bool temporary = false;
interpretUtilPrepareErrorCode((UtilPrepareRef::ErrorCode)ref->getErrorCode(),
- temporary, evntRecPtr.p->m_errorLine);
- if (temporary) {
- evntRecPtr.p->m_errorCode = (DropEvntRef::ErrorCode)
- ((Uint32) DropEvntRef::Undefined | (Uint32) DropEvntRef::Temporary);
- }
-
- if (evntRecPtr.p->m_errorCode == 0) {
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
- evntRecPtr.p->m_errorLine = __LINE__;
- }
+ evntRecPtr.p->m_errorCode, evntRecPtr.p->m_errorLine);
evntRecPtr.p->m_errorNode = reference();
dropEvent_sendReply(signal, evntRecPtr);
@@ -9555,17 +9549,17 @@
switch (ref->getTCErrorCode()) {
case ZNOT_FOUND:
jam();
- evntRecPtr.p->m_errorCode = DropEvntRef::EventNotFound;
+ evntRecPtr.p->m_errorCode = 4710;
break;
default:
jam();
- evntRecPtr.p->m_errorCode = DropEvntRef::UndefinedTCError;
+ evntRecPtr.p->m_errorCode = ref->getTCErrorCode();
break;
}
break;
default:
jam();
- evntRecPtr.p->m_errorCode = DropEvntRef::Undefined;
+ evntRecPtr.p->m_errorCode = ref->getErrorCode();
break;
}
dropEvent_sendReply(signal, evntRecPtr);
--- 1.19/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2005-09-13 14:10:48 +02:00
+++ 1.20/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2005-09-16 09:32:21 +02:00
@@ -107,11 +107,13 @@
*/
#define EVENT_SYSTEM_TABLE_NAME "sys/def/NDB$EVENTS_0"
-#define EVENT_SYSTEM_TABLE_LENGTH 6
+#define EVENT_SYSTEM_TABLE_LENGTH 8
struct sysTab_NDBEVENTS_0 {
char NAME[MAX_TAB_NAME_SIZE];
Uint32 EVENT_TYPE;
+ Uint32 TABLEID;
+ Uint32 TABLEVERSION;
char TABLE_NAME[MAX_TAB_NAME_SIZE];
Uint32 ATTRIBUTE_MASK[MAXNROFATTRIBUTESINWORDS];
Uint32 SUBID;
@@ -546,9 +548,6 @@
void execSUB_CREATE_CONF(Signal* signal);
void execSUB_CREATE_REF (Signal* signal);
- void execSUB_SYNC_CONF(Signal* signal);
- void execSUB_SYNC_REF (Signal* signal);
-
void execSUB_REMOVE_REQ(Signal* signal);
void execSUB_REMOVE_CONF(Signal* signal);
void execSUB_REMOVE_REF(Signal* signal);
@@ -1393,7 +1392,7 @@
CreateEvntReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
- CreateEvntRef::ErrorCode m_errorCode;
+ Uint32 m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
// ctor
@@ -1437,24 +1436,24 @@
sysTab_NDBEVENTS_0 m_eventRec;
RequestTracker m_reqTracker;
// error info
- DropEvntRef::ErrorCode m_errorCode;
+ Uint32 m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
// ctor
OpDropEvent() {
memset(&m_request, 0, sizeof(m_request));
- m_errorCode = DropEvntRef::NoError;
+ m_errorCode = 0;
m_errorLine = 0;
m_errorNode = 0;
}
void init(const DropEvntReq* req) {
m_request = *req;
- m_errorCode = DropEvntRef::NoError;
+ m_errorCode = 0;
m_errorLine = 0;
m_errorNode = 0;
}
bool hasError() {
- return m_errorCode != DropEvntRef::NoError;
+ return m_errorCode != 0;
}
void setError(const DropEvntRef* ref) {
if (ref != 0 && ! hasError()) {
@@ -1787,6 +1786,7 @@
/* ------------------------------------------------------------ */
// Add Table Handling
/* ------------------------------------------------------------ */
+ void releaseCreateTableOp(Signal* signal, CreateTableRecordPtr createTabPtr);
/* ------------------------------------------------------------ */
// Add Fragment Handling
--- 1.40/storage/ndb/src/ndbapi/NdbDictionary.cpp 2005-09-15 10:09:06 +02:00
+++ 1.41/storage/ndb/src/ndbapi/NdbDictionary.cpp 2005-09-16 09:32:21 +02:00
@@ -284,6 +284,11 @@
return m_impl.getName();
}
+const char *
+NdbDictionary::Table::getMysqlName() const {
+ return m_impl.getMysqlName();
+}
+
int
NdbDictionary::Table::getTableId() const {
return m_impl.m_tableId;
@@ -838,6 +843,12 @@
m_impl.invalidateObject(* i->m_table);
}
DBUG_VOID_RETURN;
+}
+
+int
+NdbDictionary::Dictionary::forceGCPWait()
+{
+ return m_impl.forceGCPWait();
}
void
--- 1.93/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2005-09-15 10:09:06 +02:00
+++ 1.94/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2005-09-16 10:13:59 +02:00
@@ -29,6 +29,7 @@
#include <signaldata/AlterTable.hpp>
#include <signaldata/DropIndx.hpp>
#include <signaldata/ListTables.hpp>
+#include <signaldata/WaitGCP.hpp>
#include <SimpleProperties.hpp>
#include <Bitmask.hpp>
#include <AttributeList.hpp>
@@ -42,6 +43,8 @@
#define DEBUG_PRINT 0
#define INCOMPATIBLE_VERSION -2
+extern Uint64 g_latest_trans_gci;
+
//#define EVENT_DEBUG
/**
@@ -394,6 +397,7 @@
{
m_tableId = org.m_tableId;
m_internalName.assign(org.m_internalName);
+ updateMysqlName();
m_externalName.assign(org.m_externalName);
//m_newExternalName.assign(org.m_newExternalName);
m_frm.assign(org.m_frm.get_data(), org.m_frm.length());
@@ -465,6 +469,18 @@
}
void
+NdbTableImpl::updateMysqlName()
+{
+ Vector<BaseString> v;
+ if (m_internalName.split(v,"/") == 3)
+ {
+ m_mysqlName.assfmt("%s/%s",v[0].c_str(),v[2].c_str());
+ return;
+ }
+ m_mysqlName.assign("");
+}
+
+void
NdbTableImpl::buildColumnHash(){
const Uint32 size = m_columns.size();
@@ -653,8 +669,6 @@
mi_type= 0;
m_dur= NdbDictionary::Event::ED_UNDEFINED;
m_tableImpl= NULL;
- m_bufferId= RNIL;
- eventOp= NULL;
}
NdbEventImpl::~NdbEventImpl()
@@ -665,12 +679,12 @@
void NdbEventImpl::setName(const char * name)
{
- m_externalName.assign(name);
+ m_name.assign(name);
}
const char *NdbEventImpl::getName() const
{
- return m_externalName.c_str();
+ return m_name.c_str();
}
void
@@ -695,12 +709,7 @@
void
NdbEventImpl::addTableEvent(const NdbDictionary::Event::TableEvent t = NdbDictionary::Event::TE_ALL)
{
- switch (t) {
- case NdbDictionary::Event::TE_INSERT : mi_type |= 1; break;
- case NdbDictionary::Event::TE_DELETE : mi_type |= 2; break;
- case NdbDictionary::Event::TE_UPDATE : mi_type |= 4; break;
- default: mi_type = 4 | 2 | 1; // all types
- }
+ mi_type |= (unsigned)t;
}
void
@@ -963,12 +972,6 @@
case GSN_SUB_START_REF:
tmp->execSUB_START_REF(signal, ptr);
break;
- case GSN_SUB_TABLE_DATA:
- tmp->execSUB_TABLE_DATA(signal, ptr);
- break;
- case GSN_SUB_GCP_COMPLETE_REP:
- tmp->execSUB_GCP_COMPLETE_REP(signal, ptr);
- break;
case GSN_SUB_STOP_CONF:
tmp->execSUB_STOP_CONF(signal, ptr);
break;
@@ -984,6 +987,12 @@
case GSN_LIST_TABLES_CONF:
tmp->execLIST_TABLES_CONF(signal, ptr);
break;
+ case GSN_WAIT_GCP_CONF:
+ tmp->execWAIT_GCP_CONF(signal, ptr);
+ break;
+ case GSN_WAIT_GCP_REF:
+ tmp->execWAIT_GCP_REF(signal, ptr);
+ break;
default:
abort();
}
@@ -1086,7 +1095,13 @@
DBUG_RETURN(-1);
}
- if ( (temporaryMask & m_error.code) != 0 ) {
+ if ( temporaryMask == -1)
+ {
+ const NdbError &error= getNdbError();
+ if (error.status == NdbError::TemporaryError)
+ continue;
+ }
+ else if ( (temporaryMask & m_error.code) != 0 ) {
continue;
}
if (errcodes) {
@@ -1344,6 +1359,7 @@
impl->m_version = tableDesc.TableVersion;
impl->m_status = NdbDictionary::Object::Retrieved;
impl->m_internalName.assign(internalName);
+ impl->updateMysqlName();
impl->m_externalName.assign(externalName);
impl->m_frm.assign(tableDesc.FrmData, tableDesc.FrmLen);
@@ -1669,6 +1685,7 @@
const BaseString internalName(
ndb.internalize_table_name(impl.m_externalName.c_str()));
impl.m_internalName.assign(internalName);
+ impl.updateMysqlName();
UtilBufferWriter w(m_buffer);
DictTabInfo::Table tmpTab;
tmpTab.init();
@@ -2484,26 +2501,26 @@
int
NdbDictionaryImpl::createEvent(NdbEventImpl & evnt)
{
+ DBUG_ENTER("NdbDictionaryImpl::createEvent");
int i;
- NdbTableImpl* tab = getTable(evnt.getTableName());
-
- if(tab == 0){
-#ifdef EVENT_DEBUG
- ndbout_c("NdbDictionaryImpl::createEvent: table not found: %s",
- evnt.getTableName());
-#endif
- return -1;
+ NdbTableImpl* tab= evnt.m_tableImpl;
+ if (tab == 0)
+ {
+ tab= getTable(evnt.getTableName());
+ if(tab == 0){
+ DBUG_PRINT("info",("NdbDictionaryImpl::createEvent: table not found: %s",
+ evnt.getTableName()));
+ DBUG_RETURN(-1);
+ }
}
+ DBUG_PRINT("info",("Table: id: %d version: %d", tab->m_tableId, tab->m_version));
+
evnt.m_tableId = tab->m_tableId;
+ evnt.m_tableVersion = tab->m_version;
evnt.m_tableImpl = tab;
-#ifdef EVENT_DEBUG
- ndbout_c("Event on tableId=%d", evnt.m_tableId);
-#endif
-
NdbTableImpl &table = *evnt.m_tableImpl;
-
int attributeList_sz = evnt.m_attrIds.size();
for (i = 0; i < attributeList_sz; i++) {
@@ -2514,17 +2531,19 @@
ndbout_c("Attr id %u in table %s not found", evnt.m_attrIds[i],
evnt.getTableName());
m_error.code= 4713;
- return -1;
+ DBUG_RETURN(-1);
}
}
evnt.m_attrIds.clear();
attributeList_sz = evnt.m_columns.size();
-#ifdef EVENT_DEBUG
- ndbout_c("creating event %s", evnt.m_externalName.c_str());
- ndbout_c("no of columns %d", evnt.m_columns.size());
-#endif
+
+ DBUG_PRINT("info",("Event on tableId=%d, tableVersion=%d, event name %s, no of columns %d",
+ evnt.m_tableId, evnt.m_tableVersion,
+ evnt.m_name.c_str(),
+ evnt.m_columns.size()));
+
int pk_count = 0;
evnt.m_attrListBitmask.clear();
@@ -2533,7 +2552,7 @@
table.getColumn(evnt.m_columns[i]->m_name.c_str());
if(col == 0){
m_error.code= 4247;
- return -1;
+ DBUG_RETURN(-1);
}
// Copy column definition
*evnt.m_columns[i] = *col;
@@ -2559,7 +2578,7 @@
for(i = 1; i<attributeList_sz; i++) {
if (evnt.m_columns[i-1]->m_attrId == evnt.m_columns[i]->m_attrId) {
m_error.code= 4258;
- return -1;
+ DBUG_RETURN(-1);
}
}
@@ -2570,7 +2589,7 @@
#endif
// NdbDictInterface m_receiver;
- return m_receiver.createEvent(m_ndb, evnt, 0 /* getFlag unset */);
+ DBUG_RETURN(m_receiver.createEvent(m_ndb, evnt, 0 /* getFlag unset */));
}
int
@@ -2578,6 +2597,9 @@
NdbEventImpl & evnt,
int getFlag)
{
+ DBUG_ENTER("NdbDictInterface::createEvent");
+ DBUG_PRINT("enter",("getFlag=%d",getFlag));
+
NdbApiSignal tSignal(m_reference);
tSignal.theReceiversBlockNumber = DBDICT;
tSignal.theVerId_signalNumber = GSN_CREATE_EVNT_REQ;
@@ -2595,22 +2617,25 @@
// getting event from Dictionary
req->setRequestType(CreateEvntReq::RT_USER_GET);
} else {
+ DBUG_PRINT("info",("tableId: %u tableVersion: %u",
+ evnt.m_tableId, evnt.m_tableVersion));
// creating event in Dictionary
req->setRequestType(CreateEvntReq::RT_USER_CREATE);
req->setTableId(evnt.m_tableId);
+ req->setTableVersion(evnt.m_tableVersion);
req->setAttrListBitmask(evnt.m_attrListBitmask);
req->setEventType(evnt.mi_type);
}
UtilBufferWriter w(m_buffer);
- const size_t len = strlen(evnt.m_externalName.c_str()) + 1;
+ const size_t len = strlen(evnt.m_name.c_str()) + 1;
if(len > MAX_TAB_NAME_SIZE) {
m_error.code= 4241;
- return -1;
+ DBUG_RETURN(-1);
}
- w.add(SimpleProperties::StringValue, evnt.m_externalName.c_str());
+ w.add(SimpleProperties::StringValue, evnt.m_name.c_str());
if (getFlag == 0)
{
@@ -2627,7 +2652,7 @@
int ret = createEvent(&tSignal, ptr, 1);
if (ret) {
- return ret;
+ DBUG_RETURN(ret);
}
char *dataPtr = (char *)m_buffer.get_data();
@@ -2640,89 +2665,86 @@
if (getFlag) {
evnt.m_tableId = evntConf->getTableId();
+ evnt.m_tableVersion = evntConf->getTableVersion();
evnt.m_attrListBitmask = evntConf->getAttrListBitmask();
evnt.mi_type = evntConf->getEventType();
evnt.setTable(dataPtr);
} else {
if (evnt.m_tableId != evntConf->getTableId() ||
+ evnt.m_tableVersion != evntConf->getTableVersion() ||
//evnt.m_attrListBitmask != evntConf->getAttrListBitmask() ||
evnt.mi_type != evntConf->getEventType()) {
ndbout_c("ERROR*************");
- return 1;
+ DBUG_RETURN(1);
}
}
evnt.m_eventId = evntConf->getEventId();
evnt.m_eventKey = evntConf->getEventKey();
- return ret;
+ DBUG_RETURN(0);
}
int
NdbDictInterface::createEvent(NdbApiSignal* signal,
LinearSectionPtr ptr[3], int noLSP)
{
- const int noErrCodes = 1;
- int errCodes[noErrCodes] = {CreateEvntRef::Busy};
return dictSignal(signal,ptr,noLSP,
1 /*use masternode id*/,
100,
WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/,
-1,
- errCodes,noErrCodes, CreateEvntRef::Temporary);
+ NULL,0, -1);
}
int
-NdbDictionaryImpl::executeSubscribeEvent(NdbEventImpl & ev)
+NdbDictionaryImpl::executeSubscribeEvent(NdbEventOperationImpl & ev_op)
{
// NdbDictInterface m_receiver;
- return m_receiver.executeSubscribeEvent(m_ndb, ev);
+ return m_receiver.executeSubscribeEvent(m_ndb, ev_op);
}
int
NdbDictInterface::executeSubscribeEvent(class Ndb & ndb,
- NdbEventImpl & evnt)
+ NdbEventOperationImpl & ev_op)
{
DBUG_ENTER("NdbDictInterface::executeSubscribeEvent");
NdbApiSignal tSignal(m_reference);
- // tSignal.theReceiversBlockNumber = SUMA;
tSignal.theReceiversBlockNumber = DBDICT;
tSignal.theVerId_signalNumber = GSN_SUB_START_REQ;
tSignal.theLength = SubStartReq::SignalLength2;
- SubStartReq * sumaStart = CAST_PTR(SubStartReq, tSignal.getDataPtrSend());
+ SubStartReq * req = CAST_PTR(SubStartReq, tSignal.getDataPtrSend());
- sumaStart->subscriptionId = evnt.m_eventId;
- sumaStart->subscriptionKey = evnt.m_eventKey;
- sumaStart->part = SubscriptionData::TableData;
- sumaStart->subscriberData = evnt.m_bufferId & 0xFF;
- sumaStart->subscriberRef = m_reference;
+ req->subscriptionId = ev_op.m_eventImpl->m_eventId;
+ req->subscriptionKey = ev_op.m_eventImpl->m_eventKey;
+ req->part = SubscriptionData::TableData;
+ req->subscriberData = ev_op.m_oid;
+ req->subscriberRef = m_reference;
- DBUG_RETURN(executeSubscribeEvent(&tSignal, NULL));
-}
+ DBUG_PRINT("info",("GSN_SUB_START_REQ subscriptionId=%d,subscriptionKey=%d,"
+ "subscriberData=%d",req->subscriptionId,
+ req->subscriptionKey,req->subscriberData));
-int
-NdbDictInterface::executeSubscribeEvent(NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
-{
- return dictSignal(signal,NULL,0,
- 1 /*use masternode id*/,
- 100,
- WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/,
- -1,
- NULL,0);
+ int errCodes[] = { SubStartRef::Busy };
+ DBUG_RETURN(dictSignal(&tSignal,NULL,0,
+ 1 /*use masternode id*/,
+ 100,
+ WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/,
+ -1,
+ errCodes, sizeof(errCodes)/sizeof(errCodes[0])));
}
int
-NdbDictionaryImpl::stopSubscribeEvent(NdbEventImpl & ev)
+NdbDictionaryImpl::stopSubscribeEvent(NdbEventOperationImpl & ev_op)
{
// NdbDictInterface m_receiver;
- return m_receiver.stopSubscribeEvent(m_ndb, ev);
+ return m_receiver.stopSubscribeEvent(m_ndb, ev_op);
}
int
NdbDictInterface::stopSubscribeEvent(class Ndb & ndb,
- NdbEventImpl & evnt)
+ NdbEventOperationImpl & ev_op)
{
DBUG_ENTER("NdbDictInterface::stopSubscribeEvent");
@@ -2732,36 +2754,36 @@
tSignal.theVerId_signalNumber = GSN_SUB_STOP_REQ;
tSignal.theLength = SubStopReq::SignalLength;
- SubStopReq * sumaStop = CAST_PTR(SubStopReq, tSignal.getDataPtrSend());
-
- sumaStop->subscriptionId = evnt.m_eventId;
- sumaStop->subscriptionKey = evnt.m_eventKey;
- sumaStop->subscriberData = evnt.m_bufferId & 0xFF;
- sumaStop->part = (Uint32) SubscriptionData::TableData;
- sumaStop->subscriberRef = m_reference;
+ SubStopReq * req = CAST_PTR(SubStopReq, tSignal.getDataPtrSend());
- DBUG_RETURN(stopSubscribeEvent(&tSignal, NULL));
-}
-
-int
-NdbDictInterface::stopSubscribeEvent(NdbApiSignal* signal,
- LinearSectionPtr ptr[3])
-{
- return dictSignal(signal,NULL,0,
- 1 /*use masternode id*/,
- 100,
- WAIT_CREATE_INDX_REQ /*WAIT_SUB_STOP__REQ*/,
- -1,
- NULL,0);
+ req->subscriptionId = ev_op.m_eventImpl->m_eventId;
+ req->subscriptionKey = ev_op.m_eventImpl->m_eventKey;
+ req->subscriberData = ev_op.m_oid;
+ req->part = (Uint32) SubscriptionData::TableData;
+ req->subscriberRef = m_reference;
+
+ DBUG_PRINT("info",("GSN_SUB_STOP_REQ subscriptionId=%d,subscriptionKey=%d,"
+ "subscriberData=%d",req->subscriptionId,
+ req->subscriptionKey,req->subscriberData));
+
+ int errCodes[] = { SubStopRef::Busy };
+ DBUG_RETURN(dictSignal(&tSignal,NULL,0,
+ 1 /*use masternode id*/,
+ 100,
+ WAIT_CREATE_INDX_REQ /*WAIT_SUB_STOP__REQ*/,
+ -1,
+ errCodes, sizeof(errCodes)/sizeof(errCodes[0])));
}
NdbEventImpl *
NdbDictionaryImpl::getEvent(const char * eventName)
{
- NdbEventImpl *ev = new NdbEventImpl();
+ DBUG_ENTER("NdbDictionaryImpl::getEvent");
+ DBUG_PRINT("enter",("eventName= %s", eventName));
+ NdbEventImpl *ev = new NdbEventImpl();
if (ev == NULL) {
- return NULL;
+ DBUG_RETURN(NULL);
}
ev->setName(eventName);
@@ -2770,48 +2792,83 @@
if (ret) {
delete ev;
- return NULL;
+ DBUG_RETURN(NULL);
}
// We only have the table name with internal name
+ DBUG_PRINT("info",("table %s", ev->getTableName()));
+ Ndb_local_table_info *info;
+ int retry= 0;
+ while (1)
+ {
+ info= get_local_table_info(ev->getTableName(), true);
+ if (info == 0)
+ {
+ DBUG_PRINT("error",("unable to find table %s", ev->getTableName()));
+ delete ev;
+ DBUG_RETURN(NULL);
+ }
+
+ if (ev->m_tableId == info->m_table_impl->m_tableId &&
+ ev->m_tableVersion == info->m_table_impl->m_version)
+ break;
+ if (retry)
+ {
+ m_error.code= 241;
+ DBUG_PRINT("error",("%s: table version mismatch, event: [%u,%u] table: [%u,%u]",
+ ev->getTableName(), ev->m_tableId, ev->m_tableVersion,
+ info->m_table_impl->m_tableId, info->m_table_impl->m_version));
+ delete ev;
+ DBUG_RETURN(NULL);
+ }
+ invalidateObject(*info->m_table_impl);
+ retry++;
+ }
+
+ ev->m_tableImpl= info->m_table_impl;
ev->setTable(m_ndb.externalizeTableName(ev->getTableName()));
- ev->m_tableImpl = getTable(ev->getTableName());
// get the columns from the attrListBitmask
NdbTableImpl &table = *ev->m_tableImpl;
AttributeMask & mask = ev->m_attrListBitmask;
- int attributeList_sz = mask.count();
- int id = -1;
+ unsigned attributeList_sz = mask.count();
-#ifdef EVENT_DEBUG
- ndbout_c("NdbDictionaryImpl::getEvent attributeList_sz = %d",
- attributeList_sz);
+ DBUG_PRINT("info",("Table: id: %d version: %d", table.m_tableId, table.m_version));
+
+#ifndef DBUG_OFF
char buf[128] = {0};
mask.getText(buf);
- ndbout_c("mask = %s", buf);
+ DBUG_PRINT("info",("attributeList_sz= %d, mask= %s", attributeList_sz, buf));
#endif
- for(int i = 0; i < attributeList_sz; i++) {
- id++; while (!mask.get(id)) id++;
+
+ if ( attributeList_sz > table.getNoOfColumns() )
+ {
+ DBUG_PRINT("error",("Invalid version, too many columns"));
+ delete ev;
+ DBUG_RETURN(NULL);
+ }
- const NdbColumnImpl* col = table.getColumn(id);
- if(col == 0) {
-#ifdef EVENT_DEBUG
- ndbout_c("NdbDictionaryImpl::getEvent could not find column id %d", id);
-#endif
- m_error.code= 4247;
+ assert( (int)attributeList_sz <= table.getNoOfColumns() );
+ for(unsigned id= 0; ev->m_columns.size() < attributeList_sz; id++) {
+ if ( id >= table.getNoOfColumns())
+ {
+ DBUG_PRINT("error",("Invalid version, column %d out of range", id));
delete ev;
- return NULL;
+ DBUG_RETURN(NULL);
}
+ if (!mask.get(id))
+ continue;
+
+ const NdbColumnImpl* col = table.getColumn(id);
+ DBUG_PRINT("info",("column %d %s", id, col->getName()));
NdbColumnImpl* new_col = new NdbColumnImpl;
// Copy column definition
*new_col = *col;
-
ev->m_columns.push_back(new_col);
}
-
- return ev;
+ DBUG_RETURN(ev);
}
void
@@ -2835,7 +2892,8 @@
Uint32 subscriptionId = createEvntConf->getEventId();
Uint32 subscriptionKey = createEvntConf->getEventKey();
- DBUG_PRINT("info",("subscriptionId=%d,subscriptionKey=%d",
+ DBUG_PRINT("info",("nodeid=%d,subscriptionId=%d,subscriptionKey=%d",
+ refToNode(signal->theSendersBlockRef),
subscriptionId,subscriptionKey));
m_waiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
@@ -2940,74 +2998,6 @@
m_waiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
-void
-NdbDictInterface::execSUB_GCP_COMPLETE_REP(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
-{
- const SubGcpCompleteRep * const rep=
- CAST_CONSTPTR(SubGcpCompleteRep, signal->getDataPtr());
-
- const Uint32 gci = rep->gci;
- // const Uint32 senderRef = rep->senderRef;
- const Uint32 subscriberData = rep->subscriberData;
-
- const Uint32 bufferId = subscriberData;
-
- const Uint32 ref = signal->theSendersBlockRef;
-
- NdbApiSignal tSignal(m_reference);
- SubGcpCompleteAcc * acc=
- CAST_PTR(SubGcpCompleteAcc, tSignal.getDataPtrSend());
-
- acc->rep = *rep;
-
- tSignal.theReceiversBlockNumber = refToBlock(ref);
- tSignal.theVerId_signalNumber = GSN_SUB_GCP_COMPLETE_ACC;
- tSignal.theLength = SubGcpCompleteAcc::SignalLength;
-
- Uint32 aNodeId = refToNode(ref);
-
- // m_transporter->lock_mutex();
- int r;
- r = m_transporter->sendSignal(&tSignal, aNodeId);
- // m_transporter->unlock_mutex();
-
- NdbGlobalEventBufferHandle::latestGCI(bufferId, gci);
-}
-
-void
-NdbDictInterface::execSUB_TABLE_DATA(NdbApiSignal * signal,
- LinearSectionPtr ptr[3])
-{
-#ifdef EVENT_DEBUG
- const char * FNAME = "NdbDictInterface::execSUB_TABLE_DATA";
-#endif
- //TODO
- const SubTableData * const sdata = CAST_CONSTPTR(SubTableData, signal->getDataPtr());
-
- // const Uint32 gci = sdata->gci;
- // const Uint32 operation = sdata->operation;
- // const Uint32 tableId = sdata->tableId;
- // const Uint32 noOfAttrs = sdata->noOfAttributes;
- // const Uint32 dataLen = sdata->dataSize;
- const Uint32 subscriberData = sdata->subscriberData;
- // const Uint32 logType = sdata->logType;
-
- for (int i=signal->m_noOfSections;i < 3; i++) {
- ptr[i].p = NULL;
- ptr[i].sz = 0;
- }
-#ifdef EVENT_DEBUG
- ndbout_c("%s: senderData %d, gci %d, operation %d, tableId %d, noOfAttrs %d, dataLen %d",
- FNAME, subscriberData, gci, operation, tableId, noOfAttrs, dataLen);
- ndbout_c("ptr[0] %u %u ptr[1] %u %u ptr[2] %u %u\n",
- ptr[0].p,ptr[0].sz,ptr[1].p,ptr[1].sz,ptr[2].p,ptr[2].sz);
-#endif
- const Uint32 bufferId = subscriberData;
-
- NdbGlobalEventBufferHandle::insertDataL(bufferId,
- sdata, ptr);
-}
/*****************************************************************
* Drop event
@@ -3039,7 +3029,7 @@
UtilBufferWriter w(m_buffer);
- w.add(SimpleProperties::StringValue, evnt.m_externalName.c_str());
+ w.add(SimpleProperties::StringValue, evnt.m_name.c_str());
LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)m_buffer.get_data();
@@ -3053,14 +3043,12 @@
LinearSectionPtr ptr[3], int noLSP)
{
//TODO
- const int noErrCodes = 1;
- int errCodes[noErrCodes] = {DropEvntRef::Busy};
return dictSignal(signal,ptr,noLSP,
1 /*use masternode id*/,
100,
WAIT_CREATE_INDX_REQ /*WAIT_CREATE_EVNT_REQ*/,
-1,
- errCodes,noErrCodes, DropEvntRef::Temporary);
+ NULL,0, -1);
}
void
NdbDictInterface::execDROP_EVNT_CONF(NdbApiSignal * signal,
@@ -3251,6 +3239,65 @@
// last signal has less than full length
m_waiter.signal(NO_WAIT);
}
+}
+
+int
+NdbDictionaryImpl::forceGCPWait()
+{
+ return m_receiver.forceGCPWait();
+}
+
+int
+NdbDictInterface::forceGCPWait()
+{
+ NdbApiSignal tSignal(m_reference);
+ WaitGCPReq* const req = CAST_PTR(WaitGCPReq, tSignal.getDataPtrSend());
+ req->senderRef = m_reference;
+ req->senderData = 0;
+ req->requestType = WaitGCPReq::CompleteForceStart;
+ tSignal.theReceiversBlockNumber = DBDIH;
+ tSignal.theVerId_signalNumber = GSN_WAIT_GCP_REQ;
+ tSignal.theLength = WaitGCPReq::SignalLength;
+
+ const Uint32 RETRIES = 100;
+ for (Uint32 i = 0; i < RETRIES; i++)
+ {
+ m_transporter->lock_mutex();
+ Uint16 aNodeId = m_transporter->get_an_alive_node();
+ if (aNodeId == 0) {
+ m_error.code= 4009;
+ m_transporter->unlock_mutex();
+ return -1;
+ }
+ if (m_transporter->sendSignal(&tSignal, aNodeId) != 0) {
+ m_transporter->unlock_mutex();
+ continue;
+ }
+ m_error.code= 0;
+ m_waiter.m_node = aNodeId;
+ m_waiter.m_state = WAIT_LIST_TABLES_CONF;
+ m_waiter.wait(WAITFOR_RESPONSE_TIMEOUT);
+ m_transporter->unlock_mutex();
+ return 0;
+ }
+ return -1;
+}
+
+void
+NdbDictInterface::execWAIT_GCP_CONF(NdbApiSignal* signal,
+ LinearSectionPtr ptr[3])
+{
+ const WaitGCPConf * const conf=
+ CAST_CONSTPTR(WaitGCPConf, signal->getDataPtr());
+ g_latest_trans_gci= conf->gcp;
+ m_waiter.signal(NO_WAIT);
+}
+
+void
+NdbDictInterface::execWAIT_GCP_REF(NdbApiSignal* signal,
+ LinearSectionPtr ptr[3])
+{
+ m_waiter.signal(NO_WAIT);
}
template class Vector<int>;
--- 1.36/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2005-09-13 13:18:48 +02:00
+++ 1.37/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2005-09-16 10:13:59 +02:00
@@ -105,12 +105,15 @@
void setFrm(const void* data, Uint32 len);
const void * getFrmData() const;
Uint32 getFrmLength() const;
+ const char * getMysqlName() const;
+ void updateMysqlName();
Uint32 m_changeMask;
Uint32 m_tableId;
Uint32 m_primaryTableId;
BaseString m_internalName;
BaseString m_externalName;
+ BaseString m_mysqlName;
BaseString m_newExternalName; // Used for alter table
UtilBuffer m_frm;
UtilBuffer m_newFrm; // Used for alter table
@@ -234,9 +237,9 @@
Uint32 m_eventId;
Uint32 m_eventKey;
Uint32 m_tableId;
+ Uint32 m_tableVersion;
AttributeMask m_attrListBitmask;
- //BaseString m_internalName;
- BaseString m_externalName;
+ BaseString m_name;
Uint32 mi_type;
NdbDictionary::Event::EventDurability m_dur;
@@ -246,10 +249,6 @@
Vector<NdbColumnImpl *> m_columns;
Vector<unsigned> m_attrIds;
- int m_bufferId;
-
- NdbEventOperation *eventOp;
-
static NdbEventImpl & getImpl(NdbDictionary::Event & t);
static NdbEventImpl & getImpl(const NdbDictionary::Event & t);
NdbDictionary::Event * m_facade;
@@ -305,11 +304,8 @@
int dropEvent(const NdbEventImpl &);
int dropEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3], int noLSP);
- int executeSubscribeEvent(class Ndb & ndb, NdbEventImpl &);
- int executeSubscribeEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3]);
-
- int stopSubscribeEvent(class Ndb & ndb, NdbEventImpl &);
- int stopSubscribeEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3]);
+ int executeSubscribeEvent(class Ndb & ndb, NdbEventOperationImpl &);
+ int stopSubscribeEvent(class Ndb & ndb, NdbEventOperationImpl &);
int listObjects(NdbDictionary::Dictionary::List& list, Uint32 requestData, bool fullyQualifiedNames);
int listObjects(NdbApiSignal* signal);
@@ -320,6 +316,8 @@
LinearSectionPtr ptr[3],
Uint32 noOfSections, bool fullyQualifiedNames);
+ int forceGCPWait();
+
static int parseTableInfo(NdbTableImpl ** dst,
const Uint32 * data, Uint32 len,
bool fullyQualifiedNames);
@@ -327,7 +325,7 @@
static int create_index_obj_from_table(NdbIndexImpl ** dst,
NdbTableImpl* index_table,
const NdbTableImpl* primary_table);
-
+ const NdbError &getNdbError() const;
NdbError & m_error;
private:
Uint32 m_reference;
@@ -360,8 +358,6 @@
void execCREATE_EVNT_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
void execSUB_START_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
void execSUB_START_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSUB_TABLE_DATA(NdbApiSignal *, LinearSectionPtr ptr[3]);
- void execSUB_GCP_COMPLETE_REP(NdbApiSignal *, LinearSectionPtr ptr[3]);
void execSUB_STOP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
void execSUB_STOP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
void execDROP_EVNT_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
@@ -371,6 +367,9 @@
void execDROP_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
void execLIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
+ void execWAIT_GCP_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
+ void execWAIT_GCP_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
+
Uint32 m_fragmentId;
UtilBuffer m_buffer;
};
@@ -404,8 +403,10 @@
int createEvent(NdbEventImpl &);
int dropEvent(const char * eventName);
- int executeSubscribeEvent(NdbEventImpl &);
- int stopSubscribeEvent(NdbEventImpl &);
+ int executeSubscribeEvent(NdbEventOperationImpl &);
+ int stopSubscribeEvent(NdbEventOperationImpl &);
+
+ int forceGCPWait();
int listObjects(List& list, NdbDictionary::Object::Type type);
int listIndexes(List& list, Uint32 indexId);
@@ -517,6 +518,13 @@
}
inline
+const char *
+NdbTableImpl::getMysqlName() const
+{
+ return m_mysqlName.c_str();
+}
+
+inline
Uint32
Hash( const char* str ){
Uint32 h = 0;
@@ -650,10 +658,8 @@
get_local_table_info(internal_tabname, true);
if (info == 0)
return 0;
-
if (data)
*data= info->m_local_data;
-
return info->m_table_impl;
}
| Thread |
|---|
| • bk commit into 5.1 tree (mskold:1.1888) | Martin Skold | 16 Sep |