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, 2007-03-16 13:54:29+01:00, pekka@stripped +3 -0
ndb - wl#3600 abort of create table in prepare phase
storage/ndb/src/common/debugger/signaldata/PrepDropTab.cpp@stripped, 2007-03-16
13:53:52+01:00, pekka@stripped +22 -20
wl#3600 abort of create table in prepare phase
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-03-16 13:53:52+01:00,
pekka@stripped +185 -5
wl#3600 abort of create table in prepare phase
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2007-03-16 13:53:52+01:00,
pekka@stripped +13 -0
wl#3600 abort of create table in prepare phase
# 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-a
--- 1.2/storage/ndb/src/common/debugger/signaldata/PrepDropTab.cpp 2005-04-08 02:43:56
+02:00
+++ 1.3/storage/ndb/src/common/debugger/signaldata/PrepDropTab.cpp 2007-03-16 13:53:52
+01:00
@@ -17,34 +17,36 @@
#include <signaldata/PrepDropTab.hpp>
bool
-printPREP_DROP_TAB_REQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16
receiverBlockNo)
+printPREP_DROP_TAB_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16)
{
- const PrepDropTabReq * const sig = (PrepDropTabReq *) theData;
-
- fprintf(output,
- " senderRef: %x senderData: %d TableId: %d\n",
- sig->senderRef, sig->senderData, sig->tableId);
+ const PrepDropTabReq* sig = (const PrepDropTabReq*)theData;
+ fprintf(output, " senderRef: %x", sig->senderRef);
+ fprintf(output, " senderData: %x", sig->senderData);
+ fprintf(output, " requestInfo: %x", sig->requestInfo);
+ fprintf(output, " tableId: %u", sig->tableId);
+ fprintf(output, "\n");
return true;
}
-bool printPREP_DROP_TAB_CONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16
receiverBlockNo)
+bool
+printPREP_DROP_TAB_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
{
- const PrepDropTabConf * const sig = (PrepDropTabConf *) theData;
-
- fprintf(output,
- " senderRef: %x senderData: %d TableId: %d\n",
- sig->senderRef, sig->senderData, sig->tableId);
-
+ const PrepDropTabConf* sig = (const PrepDropTabConf*)theData;
+ fprintf(output, " senderRef: %x", sig->senderRef);
+ fprintf(output, " senderData: %x", sig->senderData);
+ fprintf(output, " tableId: %u", sig->tableId);
+ fprintf(output, "\n");
return true;
}
-bool printPREP_DROP_TAB_REF(FILE * output, const Uint32 * theData, Uint32 len, Uint16
receiverBlockNo)
+bool
+printPREP_DROP_TAB_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16)
{
- const PrepDropTabRef * const sig = (PrepDropTabRef *) theData;
-
- fprintf(output,
- " senderRef: %x senderData: %d TableId: %d errorCode: %d\n",
- sig->senderRef, sig->senderData, sig->tableId, sig->errorCode);
-
+ const PrepDropTabRef* sig = (const PrepDropTabRef*)theData;
+ fprintf(output, " senderRef: %x", sig->senderRef);
+ fprintf(output, " senderData: %x", sig->senderData);
+ fprintf(output, " tableId: %u", sig->tableId);
+ fprintf(output, " errorCode: %u", sig->errorCode);
+ fprintf(output, "\n");
return true;
}
--- 1.157/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-03-15 14:56:39 +01:00
+++ 1.158/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-03-16 13:53:52 +01:00
@@ -1218,6 +1218,7 @@
ok = true;
ndbrequire((oldState == SchemaFile::ADD_PARSED) ||
(oldState == SchemaFile::ADD_STARTED));
+ break;
}
ndbrequire(ok);
@@ -1246,6 +1247,8 @@
void Dbdict::startWriteSchemaFile(Signal* signal)
{
+ D("startWriteSchemaFile");
+
FsConnectRecordPtr fsPtr;
c_fsConnectRecordPool.getPtr(fsPtr, getFsConnRecord());
fsPtr.p->fsState = FsConnectRecord::OPEN_WRITE_SCHEMA;
@@ -4659,6 +4662,11 @@
D("createTable_abortParse" << V(tableId) << *op_ptr.p);
do {
+ if (op_ptr.p->m_abortPrepareDone) {
+ jam();
+ D("abort prepare has done everything");
+ break;
+ }
if (tableId == RNIL) {
jam();
D("no table allocated");
@@ -4666,7 +4674,7 @@
}
if (tableId >= c_tableRecordPool.getSize()) {
jam();
- D("table id too large (config diff)");
+ D("table id too large - config diff");
break;
}
TableRecordPtr tabPtr;
@@ -4685,15 +4693,148 @@
}
} while (0);
- schemaTrans_sendConf(signal, op_ptr.p->m_trans_ptr);
+ schemaTrans_sendConf(signal, trans_ptr);
}
void
Dbdict::createTable_abortPrepare(Signal* signal, SchemaOpPtr op_ptr)
{
+ SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
+ CreateTableDataPtr createTabPtr;
+ getOpData(op_ptr, createTabPtr);
+ const CreateTabReq* impl_req = &createTabPtr.p->m_request;
+ const Uint32 tableId = impl_req->tableId;
+
D("createTable_abortPrepare" << *op_ptr.p);
+
+ // from old createTab_drop
+
+ TableRecordPtr tabPtr;
+ c_tableRecordPool.getPtr(tabPtr, impl_req->tableId);
+ tabPtr.p->tabState = TableRecord::DROPPING;
+
+ // create drop table operation wl3600_todo must pre-allocate
+
+ SchemaOpPtr& extra_op_ptr = op_ptr.p->m_extra_op_ptr;
+ ndbrequire(extra_op_ptr.isNull());
+ DropTableDataPtr dropTabPtr;
+ seizeSchemaOp(extra_op_ptr, dropTabPtr);
+ ndbrequire(!extra_op_ptr.isNull());
+ DropTabReq* aux_impl_req = &dropTabPtr.p->m_request;
+
+ Uint32 requestInfo = 0;
+ DictSignal::setRequestType(requestInfo, DropTabReq::CreateTabDrop);
- // wl3600_todo
+ dropTabPtr.p->m_errorCode = 0;
+ aux_impl_req->senderRef = impl_req->senderRef;
+ aux_impl_req->senderData = impl_req->senderData;
+ aux_impl_req->requestInfo = requestInfo;
+ aux_impl_req->tableId = impl_req->tableId;
+ aux_impl_req->tableVersion = impl_req->tableVersion;
+ dropTabPtr.p->m_coordinatorRef = createTabPtr.p->m_coordinatorRef;
+ dropTabPtr.p->m_participantData.m_gsn = GSN_DROP_TAB_REQ;
+
+ // link other way too
+ extra_op_ptr.p->m_orig_op_ptr = op_ptr;
+
+ dropTabPtr.p->m_participantData.m_block = 0;
+ dropTabPtr.p->m_participantData.m_callback.m_callbackData =
+ extra_op_ptr.p->op_key;
+ dropTabPtr.p->m_participantData.m_callback.m_callbackFunction =
+ safe_cast(&Dbdict::createTable_abortLocalConf);
+
+ // invoke the "commit" phase of drop table
+ dropTab_nextStep(signal, extra_op_ptr);
+
+ if (tabPtr.p->m_tablespace_id != RNIL) {
+ FilegroupPtr ptr;
+ ndbrequire(c_filegroup_hash.find(ptr, tabPtr.p->m_tablespace_id));
+ decrease_ref_count(ptr.p->m_obj_ptr_i);
+ }
+}
+
+void
+Dbdict::createTable_abortLocalConf(Signal* signal, Uint32 extra_op_key, Uint32 ret)
+{
+ jam();
+ D("createTable_abortLocalConf" << V(extra_op_key));
+
+ SchemaOpPtr extra_op_ptr;
+ DropTableDataPtr dropTabPtr;
+ findSchemaOp(extra_op_ptr, dropTabPtr, extra_op_key);
+ ndbrequire(!extra_op_ptr.isNull());
+
+ SchemaOpPtr op_ptr = extra_op_ptr.p->m_orig_op_ptr;
+ CreateTableDataPtr createTabPtr;
+ getOpData(op_ptr, createTabPtr);
+ const CreateTabReq* impl_req = &createTabPtr.p->m_request;
+ Uint32 tableId = impl_req->tableId;
+
+ // write schema file wl3600_todo why not use updateSchemaState
+
+ XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
+ SchemaFile::TableEntry * tableEntry = getTableEntry(xsf, tableId);
+ tableEntry->m_tableState = SchemaFile::DROP_TABLE_COMMITTED;
+ tableEntry->m_transKey = 0;
+ computeChecksum(xsf, tableId / NDB_SF_PAGE_ENTRIES);
+
+ TableRecordPtr tablePtr;
+ c_tableRecordPool.getPtr(tablePtr, tableId);
+ bool savetodisk = !(tablePtr.p->m_bits & TableRecord::TR_Temporary);
+
+ Callback callback = {
+ safe_cast(&Dbdict::createTable_abortWriteSchemaConf),
+ extra_op_ptr.p->op_key
+ };
+
+ // wl3600_todo too much repeated code
+ if (savetodisk) {
+ ndbrequire(c_writeSchemaRecord.inUse == false);
+ c_writeSchemaRecord.inUse = true;
+
+ c_writeSchemaRecord.pageId = c_schemaRecord.schemaPage;
+ c_writeSchemaRecord.firstPage = tableId / NDB_SF_PAGE_ENTRIES;
+ c_writeSchemaRecord.noOfPages = 1;
+ c_writeSchemaRecord.m_callback = callback;
+ startWriteSchemaFile(signal);
+ } else {
+ execute(signal, callback, 0);
+ }
+
+#if wl3600_todo //out
+ CreateTabConf * const conf = (CreateTabConf*)signal->getDataPtr();
+ conf->senderRef = reference();
+ conf->senderData = createTabPtr.p->key;
+ sendSignal(createTabPtr.p->m_coordinatorRef, GSN_CREATE_TAB_CONF,
+ signal, CreateTabConf::SignalLength, JBB);
+
+ if(createTabPtr.p->m_coordinatorRef != reference()){
+ jam();
+ releaseCreateTableOp(signal,createTabPtr);
+ }
+
+ c_opDropTable.release(dropTabPtr);
+#endif
+}
+
+void
+Dbdict::createTable_abortWriteSchemaConf(Signal* signal, Uint32 extra_op_key, Uint32 ret)
+{
+ jam();
+ D("createTable_abortWriteSchemaConf" << V(extra_op_key));
+
+ SchemaOpPtr extra_op_ptr;
+ DropTableDataPtr dropTabPtr;
+ findSchemaOp(extra_op_ptr, dropTabPtr, extra_op_key);
+ ndbrequire(!extra_op_ptr.isNull());
+
+ SchemaOpPtr op_ptr = extra_op_ptr.p->m_orig_op_ptr;
+ CreateTableDataPtr createTabPtr;
+ getOpData(op_ptr, createTabPtr);
+ const CreateTabReq* impl_req = &createTabPtr.p->m_request;
+ Uint32 tableId = impl_req->tableId;
+
+ releaseTableObject(tableId);
schemaTrans_sendConf(signal, op_ptr.p->m_trans_ptr);
}
@@ -9163,7 +9304,8 @@
ndbrequire(dropTabPtr.p->m_participantData.m_gsn == GSN_DROP_TAB_REQ);
Uint32 requestType = DictSignal::getRequestType(impl_req->requestInfo);
- if (requestType == DropTabReq::RestartDropTab) {
+ if (requestType == DropTabReq::CreateTabDrop ||
+ requestType == DropTabReq::RestartDropTab) {
jam();
dropTab_nextStep(signal, op_ptr);
return;
@@ -19362,7 +19504,8 @@
jam();
c_schemaOpHash.add(op_ptr);
op_ptr.p->m_magic = SchemaOp::DICT_MAGIC;
- D("seizeSchemaOp" << V(op_key));
+ const char* opType = info.m_opType;
+ D("seizeSchemaOp" << V(op_key) << V(opType));
return true;
}
c_schemaOpHash.release(op_ptr);
@@ -19408,6 +19551,11 @@
unlinkDictObject(op_ptr);
}
+ if (!op_ptr.p->m_extra_op_ptr.isNull()) {
+ jam();
+ releaseSchemaOp(op_ptr.p->m_extra_op_ptr);
+ }
+
ndbrequire(op_ptr.p->m_magic == SchemaOp::DICT_MAGIC);
op_ptr.p->m_magic = 0;
c_schemaOpHash.release(op_ptr);
@@ -19764,6 +19912,7 @@
SchemaTrans tmp_trans(RNIL);
trans_ptr.p = &tmp_trans;
+ trans_ptr.i = RNIL;
trans_ptr.p->m_clientRef = clientRef;
trans_ptr.p->m_transId = transId;
trans_ptr.p->m_clientGsn = GSN_SCHEMA_TRANS_BEGIN_REQ;
@@ -20510,6 +20659,7 @@
SchemaTrans tmp_trans(trans_key);
trans_ptr.p = &tmp_trans;
+ trans_ptr.i = RNIL;
trans_ptr.p->m_masterRef = senderRef;
setError(trans_ptr.p->m_error, error);
schemaTrans_sendRef(signal, trans_ptr);
@@ -20631,6 +20781,8 @@
break;
case SchemaTransImplReq::RT_PREPARE:
(this->*(info.m_abortPrepare))(signal, op_ptr);
+ // mark it in advance
+ op_ptr.p->m_abortPrepareDone = true;
break;
default:
ndbrequire(false);
@@ -20662,6 +20814,34 @@
Dbdict::schemaTrans_sendRef(Signal* signal, SchemaTransPtr trans_ptr)
{
ndbrequire(hasError(trans_ptr.p->m_error));
+
+ // trans is not defined on RT_BEGIN REF
+ if (trans_ptr.i != RNIL) {
+ const PhaseIterator& it = getIterator(trans_ptr);
+ const PhaseList& pl = it.m_phaseList;
+ ndbrequire(it.m_index < pl.m_count);
+ const PhaseEntry& pe = pl.m_entry[it.m_index];
+
+ const Uint32 abortMode = trans_ptr.p->m_abortMode;
+ D("schemaTrans_sendRef" << V(abortMode) << V(pe.m_requestType));
+
+ if (abortMode == 0) {
+ switch (pe.m_requestType) {
+ case SchemaTransImplReq::RT_COMMIT_BEGIN:
+ case SchemaTransImplReq::RT_COMMIT:
+ case SchemaTransImplReq::RT_COMMIT_END:
+ case SchemaTransImplReq::RT_END:
+ // fail commit must crash
+ ndbrequire(false);
+ break;
+ default:
+ break;
+ }
+ } else {
+ // fail abort must crash
+ ndbrequire(false);
+ }
+ }
SchemaTransImplRef* ref =
(SchemaTransImplRef*)signal->getDataPtrSend();
--- 1.81/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-03-15 14:56:39 +01:00
+++ 1.82/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-03-16 13:53:52 +01:00
@@ -1413,6 +1413,13 @@
// sub-operation tree structure expressed as depth (top level = 0)
Uint32 m_opDepth;
+ // link to an extra "helper" op and link back from it
+ SchemaOpPtr m_extra_op_ptr;
+ SchemaOpPtr m_orig_op_ptr;
+
+ // flag if this op has been aborted in RT_PREPARE phase
+ bool m_abortPrepareDone;
+
// magic is on when record is seized
enum { DICT_MAGIC = 0xd1c70001 };
Uint32 m_magic;
@@ -1428,6 +1435,9 @@
m_callback.m_callbackData = 0;
m_opIndex = ~(Uint32)0;
m_opDepth = 0;
+ m_extra_op_ptr.setNull();
+ m_orig_op_ptr.setNull();
+ m_abortPrepareDone = false;
m_magic = 0;
}
@@ -2028,6 +2038,9 @@
//
void createTable_abortParse(Signal*, SchemaOpPtr);
void createTable_abortPrepare(Signal*, SchemaOpPtr);
+
+ void createTable_abortLocalConf(Signal*, Uint32 aux_op_key, Uint32 ret);
+ void createTable_abortWriteSchemaConf(Signal*, Uint32 aux_op_key, Uint32 ret);
// MODULE: AlterTable
| Thread |
|---|
| • bk commit into 5.1 tree (pekka:1.2415) | pekka | 16 Mar |