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-01-13 16:42:03+01:00, pekka@stripped +2 -0
ndb - wl#3600 improve parse interface (better use of impl_req)
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-01-13 16:41:26+01:00,
pekka@stripped +66 -111
wl#3600 improve parse interface (better use of impl_req)
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2007-01-13 16:41:26+01:00,
pekka@stripped +31 -9
wl#3600 improve parse interface (better use of impl_req)
# 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.130/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-01-12 11:37:25 +01:00
+++ 1.131/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-01-13 16:41:26 +01:00
@@ -4143,15 +4143,9 @@
void
Dbdict::createTable_parse(Signal* signal, SchemaTransPtr trans_ptr)
{
+ jam();
D("createTable_parse");
-
- ErrorInfo error;
- parseClientReq<CreateTableData, CreateTabReq>(signal, trans_ptr, error);
- if (hasError(error)) {
- jam();
- schemaTrans_sendRef(signal, trans_ptr, error);
- }
- schemaTrans_sendConf(signal, trans_ptr, 0);
+ parseClientReq<CreateTableData, CreateTabReq>(signal, trans_ptr);
}
void
@@ -4159,16 +4153,15 @@
ErrorInfo& error)
{
D("createTable_parseCommon");
- const CreateTabReq* impl_req =
- (const CreateTabReq*)signal->getDataPtr();
-
- const Uint32 gci = impl_req->gci;
- const Uint32 tableId = impl_req->tableId;
- const Uint32 tableVersion = impl_req->tableVersion;
SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
CreateTableDataPtr createTabPtr;
getOpData(op_ptr, createTabPtr);
+ CreateTabReq* impl_req = &createTabPtr.p->m_request;
+
+ const Uint32 gci = impl_req->gci;
+ const Uint32 tableId = impl_req->tableId;
+ const Uint32 tableVersion = impl_req->tableVersion;
SegmentedSectionPtr tabInfoPtr;
signal->getSection(tabInfoPtr, CreateTabReq::DICT_TAB_INFO);
@@ -4198,16 +4191,6 @@
ndbrequire(parseRecord.errorCode == 0);
}
- // save sections in DICT buffers
- {
- bool ok = saveOpSection(op_ptr, signal, CreateTabReq::DICT_TAB_INFO);
- ndbrequire(ok);
- }
- {
- bool ok = saveOpSection(op_ptr, signal, CreateTabReq::FRAGMENTATION);
- ndbrequire(ok);
- }
-
//createTabPtr.p->m_tabInfoPtrI = tabInfoPtr.i;
//createTabPtr.p->m_fragmentsPtrI = fragPtr.i;
@@ -4226,8 +4209,8 @@
tabEntry.m_gcp = gci;
tabEntry.m_info_words = tabInfoPtr.sz;
tabEntry.m_transKey = trans_ptr.p->trans_key;
- memset(tabEntry.m_unused, 0, sizeof(tabEntry.m_unused));
- D("createTable_parseCommon" << V(tableVersion));
+ tabEntry.zero_unused();
+ D(V(tableVersion));
#if wl3600_todo // move to createTable_prepare
Callback callback;
@@ -5385,7 +5368,8 @@
{
jamEntry();
const Uint32 * theData = signal->getDataPtr();
- CreateFragmentationConf * const conf = (CreateFragmentationConf*)theData;
+ const CreateFragmentationConf* conf =
+ (const CreateFragmentationConf*)theData;
SchemaOpPtr op_ptr;
CreateTableDataPtr createTabPtr;
@@ -5425,7 +5409,6 @@
packTableIntoPages(w, tabPtr);
SegmentedSectionPtr spDataPtr;
- Ptr<SectionSegment> tmpTsPtr;//????
w.getPtr(spDataPtr);
signal->setSection(spDataPtr, CreateTabReq::DICT_TAB_INFO);
@@ -5433,24 +5416,20 @@
createTabPtr.p->m_coordinatorData.m_gsn = GSN_CREATE_TAB_REQ;
- CreateTabReq* impl_req = (CreateTabReq*)theData;
+ CreateTabReq* impl_req = &createTabPtr.p->m_request;
impl_req->senderRef = reference();
impl_req->senderData = op_ptr.p->op_key;
impl_req->requestType = 0;//???
impl_req->gci = 0;
impl_req->tableId = tabPtr.i;
- impl_req->tableVersion = create_obj_inc_schema_version(tabEntry->m_tableVersion);
-
- // wl3600_todo put this in right place
- createTabPtr.p->m_request.tableVersion = impl_req->tableVersion;
+ impl_req->tableVersion =
+ create_obj_inc_schema_version(tabEntry->m_tableVersion);
ErrorInfo error;
createTable_parseCommon(signal, op_ptr, error);
- ndbrequire(!hasError(error));
+ ndbrequire(!hasError(error)); //wl3600_todo catch error
- SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
- trans_ptr.p->m_requestType = SchemaTransImplReq::RT_PARSE;
- schemaTrans_sendReq(signal, trans_ptr, false);
+ schemaTrans_sendParseReq(signal, op_ptr);
#if wl3600_todo //remove
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
@@ -7011,7 +6990,7 @@
parseP->errorCode = CreateTableRef::InvalidArraySize;
parseP->status = status;
parseP->errorKey = it.getKey();
- parseP->errorLine = __LINE__;
+ parseP->errorLine = __LINE__; ndbrequire(false);
return;
}
@@ -7211,14 +7190,16 @@
ErrorInfo error;
do {
SchemaOpPtr op_ptr;
+ DropTableDataPtr dropTabPtr;
checkClientReq<DropTableData, DropTableReq>(signal, op_ptr, error);
if (hasError(error)) {
jam();
break;
}
+ getOpData(op_ptr, dropTabPtr);
- DropTabReq* impl_req = (DropTabReq*)signal->getDataPtrSend();
+ DropTabReq* impl_req = &dropTabPtr.p->m_request;
impl_req->senderRef = reference();
impl_req->senderData = op_ptr.p->op_key;
impl_req->tableId = req->tableId;
@@ -7231,9 +7212,7 @@
break;
}
- SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
- trans_ptr.p->m_requestType = SchemaTransImplReq::RT_PARSE;
- schemaTrans_sendReq(signal, trans_ptr, false);
+ schemaTrans_sendParseReq(signal, op_ptr);
return;
} while (0);
@@ -7262,13 +7241,9 @@
void
Dbdict::dropTable_parse(Signal* signal, SchemaTransPtr trans_ptr)
{
- ErrorInfo error;
- parseClientReq<DropTableData, DropTabReq>(signal, trans_ptr, error);
- if (hasError(error)) {
- jam();
- schemaTrans_sendRef(signal, trans_ptr, error);
- }
- schemaTrans_sendConf(signal, trans_ptr, 0);
+ jam();
+ D("dropTable_parse");
+ parseClientReq<DropTableData, DropTabReq>(signal, trans_ptr);
}
void
@@ -7277,8 +7252,9 @@
{
D("dropTable_parseCommon" << V(op_ptr.i) << *op_ptr.p);
- const DropTabReq* impl_req =
- (const DropTabReq*)signal->getDataPtr();
+ DropTableDataPtr dropTabPtr;
+ getOpData(op_ptr, dropTabPtr);
+ DropTabReq* impl_req = &dropTabPtr.p->m_request;
TableRecordPtr tablePtr;
c_tableRecordPool.getPtr(tablePtr, impl_req->tableId);
@@ -7320,10 +7296,6 @@
return;
}
- DropTableDataPtr dropTabPtr;
- getOpData(op_ptr, dropTabPtr);
-
- dropTabPtr.p->m_request = *impl_req;
dropTabPtr.p->m_errorCode = 0;//
dropTabPtr.p->m_requestType = impl_req->requestType;//
dropTabPtr.p->m_coordinatorRef = impl_req->senderRef;//
@@ -8809,16 +8781,16 @@
ErrorInfo error;
do {
SchemaOpPtr op_ptr;
+ CreateIndexDataPtr createIndexPtr;
checkClientReq<CreateIndexData, CreateIndxReq>(signal, op_ptr, error);
if (hasError(error)) {
jam();
break;
}
+ getOpData(op_ptr, createIndexPtr);
- CreateIndxImplReq* impl_req =
- (CreateIndxImplReq*)signal->getDataPtrSend();
-
+ CreateIndxImplReq* impl_req = &createIndexPtr.p->m_request;
impl_req->senderRef = reference();
impl_req->senderData = op_ptr.p->op_key;
impl_req->requestInfo = 0;
@@ -8835,9 +8807,7 @@
break;
}
- SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
- trans_ptr.p->m_requestType = SchemaTransImplReq::RT_PARSE;
- schemaTrans_sendReq(signal, trans_ptr, false);
+ schemaTrans_sendParseReq(signal, op_ptr);
return;
} while (0);
@@ -8996,13 +8966,7 @@
{
jam();
D("createIndex_parse");
- ErrorInfo error;
- parseClientReq<CreateIndexData, CreateIndxImplReq>(signal, trans_ptr, error);
- if (hasError(error)) {
- jam();
- schemaTrans_sendRef(signal, trans_ptr, error);
- }
- schemaTrans_sendConf(signal, trans_ptr, 0);
+ parseClientReq<CreateIndexData, CreateIndxImplReq>(signal, trans_ptr);
}
void
@@ -9011,18 +8975,13 @@
{
D("createIndex_parseCommon");
- SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
CreateIndexDataPtr createIndexPtr;
getOpData(op_ptr, createIndexPtr);
-
- const CreateIndxImplReq* impl_req =
- (const CreateIndxImplReq*)signal->getDataPtr();
+ CreateIndxImplReq* impl_req = &createIndexPtr.p->m_request;
ndbrequire(impl_req->senderRef == numberToRef(DBDICT, c_masterNodeId));
ndbrequire(impl_req->senderData == op_ptr.p->op_key);
- createIndexPtr.p->m_request = *impl_req;
-
// save attribute list
AttributeList& attrList = createIndexPtr.p->m_attrList;
{
@@ -9060,7 +9019,8 @@
setError(error, CreateIndxRef::InvalidName, __LINE__);
return;
}
- memcpy(createIndexPtr.p->m_indexName, tableDesc.TableName, MAX_TAB_NAME_SIZE);
+ const Uint32 bytesize = sizeof(createIndexPtr.p->m_indexName);
+ memcpy(createIndexPtr.p->m_indexName, tableDesc.TableName, bytesize);
if (tableDesc.TableLoggedFlag) {
jam();
bits |= TableRecord::TR_Logged;
@@ -9074,7 +9034,7 @@
// check primary table
TableRecordPtr tablePtr;
{
- if (! (impl_req->tableId < c_tableRecordPool.getSize())) {
+ if (!(impl_req->tableId < c_tableRecordPool.getSize())) {
jam();
setError(error, CreateIndxRef::InvalidPrimaryTable, __LINE__);
return;
@@ -9086,7 +9046,7 @@
setError(error, CreateIndxRef::InvalidPrimaryTable, __LINE__);
return;
}
- if (! tablePtr.p->isTable()) {
+ if (!tablePtr.p->isTable()) {
jam();
setError(error, CreateIndxRef::InvalidPrimaryTable, __LINE__);
return;
@@ -10126,18 +10086,19 @@
ErrorInfo error;
do {
SchemaOpPtr op_ptr;
+ DropIndexDataPtr dropIndexPtr;
checkClientReq<DropIndexData, DropIndxReq>(signal, op_ptr, error);
if (hasError(error)) {
jam();
break;
}
+ getOpData(op_ptr, dropIndexPtr);
- // wl3600_todo maybe use m_request directly
- DropIndxImplReq* impl_req = (DropIndxImplReq*)signal->getDataPtrSend();
+ DropIndxImplReq* impl_req = &dropIndexPtr.p->m_request;
impl_req->senderRef = reference();
impl_req->senderData = op_ptr.p->op_key;
- impl_req->tableId = 0; // wl3600_todo fill in in parseCommon
+ impl_req->tableId = ~(Uint32)0; // wl3600_todo fill in in parseCommon
impl_req->tableVersion = 0;
impl_req->indexId = req->indexId;
impl_req->indexVersion = req->indexVersion;
@@ -10148,9 +10109,7 @@
break;
}
- SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
- trans_ptr.p->m_requestType = SchemaTransImplReq::RT_PARSE;
- schemaTrans_sendReq(signal, trans_ptr, false);
+ schemaTrans_sendParseReq(signal, op_ptr);
return;
} while (0);
@@ -10289,13 +10248,8 @@
void
Dbdict::dropIndex_parse(Signal* signal, SchemaTransPtr trans_ptr)
{
- ErrorInfo error;
- parseClientReq<DropIndexData, DropIndxImplReq>(signal, trans_ptr, error);
- if (hasError(error)) {
- jam();
- schemaTrans_sendRef(signal, trans_ptr, error);
- }
- schemaTrans_sendConf(signal, trans_ptr, 0);
+ D("dropIndex_parse");
+ parseClientReq<DropIndexData, DropIndxImplReq>(signal, trans_ptr);
}
void
@@ -10304,18 +10258,12 @@
{
D("dropIndex_parseCommon" << V(op_ptr.i) << *op_ptr.p);
- const DropIndxImplReq* impl_req =
- (const DropIndxImplReq*)signal->getDataPtr();
-
DropIndexDataPtr dropIndexPtr;
getOpData(op_ptr, dropIndexPtr);
-
- // wl3600_todo fix interface
- dropIndexPtr.p->m_request = *impl_req;
- impl_req = &dropIndexPtr.p->m_request;
+ DropIndxImplReq* impl_req = &dropIndexPtr.p->m_request;
TableRecordPtr indexPtr;
- if (! (impl_req->indexId < c_tableRecordPool.getSize())) {
+ if (!(impl_req->indexId < c_tableRecordPool.getSize())) {
jam();
setError(error, DropIndxRef::IndexNotFound, __LINE__);
return;
@@ -10329,7 +10277,7 @@
return;
}
- if (! indexPtr.p->isIndex()) {
+ if (!indexPtr.p->isIndex()) {
jam();
setError(error, DropIndxRef::NotAnIndex, __LINE__);
return;
@@ -10347,15 +10295,15 @@
// master sets primary table, participant verifies it agrees
if (reference() == impl_req->senderRef) {
- dropIndexPtr.p->m_request.tableId = tablePtr.p->tableId;
- dropIndexPtr.p->m_request.tableVersion = tablePtr.p->tableVersion;
+ impl_req->tableId = tablePtr.p->tableId;
+ impl_req->tableVersion = tablePtr.p->tableVersion;
} else {
- if (dropIndexPtr.p->m_request.tableId != tablePtr.p->tableId) {
+ if (impl_req->tableId != tablePtr.p->tableId) {
jam(); // wl3600_todo better error code
setError(error, DropIndxRef::InvalidIndexVersion, __LINE__);
return;
}
- if (dropIndexPtr.p->m_request.tableVersion != tablePtr.p->tableVersion) {
+ if (impl_req->tableVersion != tablePtr.p->tableVersion) {
jam(); // wl3600_todo better error code
setError(error, DropIndxRef::InvalidIndexVersion, __LINE__);
return;
@@ -18770,23 +18718,22 @@
Uint32 requestType = trans_ptr.p->m_requestType;
Uint32 gsn = 0;
+ // piggy-backed signal in parse phase
Uint32 extra_length = 0;
if (requestType == SchemaTransImplReq::RT_PARSE) {
jam();
const OpInfo& info = getOpInfo(op_ptr);
gsn = info.m_impl_req_gsn;
+ const Uint32* src = op_ptr.p->m_data_ptr.p->m_impl_req_data;
Uint32* data = signal->getDataPtrSend();
Uint32 skip = SchemaTransImplReq::SignalLength;
- Uint32 length = info.m_impl_req_length;
- ndbrequire(skip + length <= 25);
+ extra_length = info.m_impl_req_length;
+ ndbrequire(skip + extra_length <= 25);
- Uint32 i = length;
- while (i > 0) {
- i--;
- data[skip + i] = data[i];
- }
- extra_length = length;
+ Uint32 i;
+ for (i = 0; i < extra_length; i++)
+ data[skip + i] = src[i];
}
SchemaTransImplReq* req = (SchemaTransImplReq*)signal->getDataPtrSend();
@@ -18824,6 +18771,14 @@
sendSignal(rg, GSN_SCHEMA_TRANS_IMPL_REQ,
signal, SchemaTransImplReq::SignalLength + extra_length, JBB);
+}
+
+void
+Dbdict::schemaTrans_sendParseReq(Signal* signal, SchemaOpPtr op_ptr)
+{
+ SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr;
+ trans_ptr.p->m_requestType = SchemaTransImplReq::RT_PARSE;
+ schemaTrans_sendReq(signal, trans_ptr, 0);
}
void
--- 1.58/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-01-12 11:37:25 +01:00
+++ 1.59/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-01-13 16:41:26 +01:00
@@ -1256,13 +1256,18 @@
// ArrayPool
Uint32 nextPool;
+ // reference to the static member in Data class
const OpInfo& m_opInfo;
+ // pointer to internal signal in Data instance
+ const Uint32* const m_impl_req_data;
+
// DictObject operated on
DictObjectPtr m_obj_ptr;
- OpData(const OpInfo& info) :
- m_opInfo(info) {
+ OpData(const OpInfo& info, const Uint32* impl_req_data) :
+ m_opInfo(info),
+ m_impl_req_data(impl_req_data) {
m_obj_ptr.setNull();
}
};
@@ -1527,6 +1532,7 @@
// master
void schemaTrans_sendReq(Signal*, SchemaTransPtr, bool local);
+ void schemaTrans_sendParseReq(Signal*, SchemaOpPtr);
void schemaTrans_recvReply(Signal*, bool isConf);
void createSubOps(Signal*, SchemaOpPtr);
void abortSchemaTrans(Signal*, SchemaTransPtr);
@@ -1669,11 +1675,13 @@
// OpInfo::m_parse has generic implementation
template <class T, class R>
inline void
- parseClientReq(Signal* signal, SchemaTransPtr trans_ptr, ErrorInfo& error)
+ parseClientReq(Signal* signal, SchemaTransPtr trans_ptr)
{
const R* impl_req = (const R*)signal->getDataPtr();
SchemaOpPtr op_ptr;
Ptr<T> t_ptr;
+
+ ErrorInfo error;
if (impl_req->senderRef == reference()) {
jam();
findSchemaOp(op_ptr, t_ptr, impl_req->senderData);
@@ -1683,12 +1691,26 @@
seizeSchemaOp(op_ptr, t_ptr, impl_req->senderData);
ndbrequire(!op_ptr.isNull());
addSchemaOp(trans_ptr, op_ptr);
+
+ t_ptr.p->m_request = *impl_req;
+
const OpInfo& info = getOpInfo(op_ptr);
- ErrorInfo error;
- // parseCommon cannot be time-sliced
(this->*(info.m_parseCommon))(signal, op_ptr, error);
}
+ if (hasError(error)) {
+ jam();
+ releaseSections(signal);
+ schemaTrans_sendRef(signal, trans_ptr, error);
+ return;
+ }
+
+ ndbrequire(op_ptr.p->m_sections == 0);
+ Uint32 ss_no;
+ for (ss_no = 0; ss_no < signal->getNoOfSections(); ss_no++)
+ saveOpSection(op_ptr, signal, ss_no);
releaseSections(signal);
+
+ schemaTrans_sendConf(signal, trans_ptr, 0);
}
// MODULE: CreateTable
@@ -1705,7 +1727,7 @@
}
CreateTableData() :
- OpData(g_opInfo) {
+ OpData(g_opInfo, (Uint32*)&m_request) {
memset(&m_request, 0, sizeof(m_request));
}
@@ -1830,7 +1852,7 @@
}
DropTableData() :
- OpData(g_opInfo) {
+ OpData(g_opInfo, (Uint32*)&m_request) {
memset(&m_request, 0, sizeof(m_request));
m_coordinatorData.m_gsn = 0;
m_coordinatorData.m_block = 0;
@@ -1919,7 +1941,7 @@
bool m_sub_alter_index;
CreateIndexData() :
- OpData(g_opInfo) {
+ OpData(g_opInfo, (Uint32*)&m_request) {
memset(&m_request, 0, sizeof(m_request));
memset(m_indexName, 0, sizeof(m_indexName));
m_attrList.clear();
@@ -2068,7 +2090,7 @@
bool m_sub_drop_table;
DropIndexData() :
- OpData(g_opInfo) {
+ OpData(g_opInfo, (Uint32*)&m_request) {
memset(&m_request, 0, sizeof(m_request));
m_sub_alter_index = false;
m_sub_drop_table = false;
| Thread |
|---|
| • bk commit into 5.1 tree (pekka:1.2388) | pekka | 13 Jan |