From: pekka Date: January 25 2007 12:36pm Subject: bk commit into 5.1 tree (pekka:1.2396) List-Archive: http://lists.mysql.com/commits/18771 Message-Id: <20070125123634.811F01B476@clam.ndb.mysql.com> 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-25 13:36:21+01:00, pekka@stripped +22 -0 ndb - wl#3600 build index hash index build so far outside tx (in commit phase) passes 2-node testOIBasic -case a storage/ndb/include/kernel/GlobalSignalNumbers.h@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +5 -1 wl#3600 build index storage/ndb/include/kernel/signaldata/AlterIndxImpl.hpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +2 -1 wl#3600 build index storage/ndb/include/kernel/signaldata/BuildIndx.hpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +47 -226 wl#3600 build index storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +117 -0 wl#3600 build index storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp@stripped, 2007-01-21 23:09:25+01:00, pekka@stripped +0 -0 BitKeeper file /export/space/pekka/ndb/version/my52-wl3600-b/storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp@stripped, 2007-01-21 23:09:25+01:00, pekka@stripped +0 -0 storage/ndb/include/kernel/signaldata/SignalData.hpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +8 -0 wl#3600 build index storage/ndb/src/common/debugger/signaldata/AlterIndxImpl.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +1 -0 wl#3600 build index storage/ndb/src/common/debugger/signaldata/BuildIndx.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +77 -0 wl#3600 build index storage/ndb/src/common/debugger/signaldata/BuildIndx.cpp@stripped, 2007-01-22 12:15:48+01:00, pekka@stripped +0 -0 BitKeeper file /export/space/pekka/ndb/version/my52-wl3600-b/storage/ndb/src/common/debugger/signaldata/BuildIndx.cpp storage/ndb/src/common/debugger/signaldata/BuildIndx.cpp@stripped, 2007-01-22 12:15:48+01:00, pekka@stripped +0 -0 storage/ndb/src/common/debugger/signaldata/BuildIndxImpl.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +63 -0 wl#3600 build index storage/ndb/src/common/debugger/signaldata/BuildIndxImpl.cpp@stripped, 2007-01-22 12:15:48+01:00, pekka@stripped +0 -0 BitKeeper file /export/space/pekka/ndb/version/my52-wl3600-b/storage/ndb/src/common/debugger/signaldata/BuildIndxImpl.cpp storage/ndb/src/common/debugger/signaldata/BuildIndxImpl.cpp@stripped, 2007-01-22 12:15:48+01:00, pekka@stripped +0 -0 storage/ndb/src/common/debugger/signaldata/Makefile.am@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +3 -1 wl#3600 build index storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +9 -0 wl#3600 build index storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +8 -0 wl#3600 build index storage/ndb/src/common/debugger/signaldata/SignalNames.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +4 -0 wl#3600 build index storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +696 -72 wl#3600 build index storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +77 -35 wl#3600 build index storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp@stripped, 2007-01-25 13:30:51+01:00, pekka@stripped +2 -2 wl#3600 build index storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +2 -2 wl#3600 build index storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +20 -16 wl#3600 build index storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +4 -5 wl#3600 build index storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +1 -1 wl#3600 build index storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +43 -39 wl#3600 build index storage/ndb/src/kernel/blocks/trix/Trix.cpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +134 -116 wl#3600 build index storage/ndb/src/kernel/blocks/trix/Trix.hpp@stripped, 2007-01-25 13:30:52+01:00, pekka@stripped +3 -3 wl#3600 build index # 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-b --- 1.38/storage/ndb/include/kernel/GlobalSignalNumbers.h 2007-01-18 13:18:44 +01:00 +++ 1.39/storage/ndb/include/kernel/GlobalSignalNumbers.h 2007-01-25 13:30:51 +01:00 @@ -23,7 +23,7 @@ * * When adding a new signal, remember to update MAX_GSN and SignalNames.cpp */ -const GlobalSignalNumber MAX_GSN = 757; +const GlobalSignalNumber MAX_GSN = 760; struct GsnName { GlobalSignalNumber gsn; @@ -1018,5 +1018,9 @@ #define GSN_ALTER_TRIG_IMPL_REQ 755 #define GSN_ALTER_TRIG_IMPL_CONF 756 #define GSN_ALTER_TRIG_IMPL_REF 757 + +#define GSN_BUILD_INDX_IMPL_REQ 758 +#define GSN_BUILD_INDX_IMPL_CONF 759 +#define GSN_BUILD_INDX_IMPL_REF 760 #endif --- 1.6/storage/ndb/include/kernel/signaldata/BuildIndx.hpp 2005-04-08 02:43:50 +02:00 +++ 1.7/storage/ndb/include/kernel/signaldata/BuildIndx.hpp 2007-01-25 13:30:51 +01:00 @@ -18,20 +18,11 @@ #define BUILD_INDX_HPP #include "SignalData.hpp" -#include -#include -/** - * BuildIndxReq - * - * This signal is sent by DICT to TRIX(n) - * as a request to build a secondary index - */ -class BuildIndxReq { - friend bool printBUILD_INDX_REQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo); +struct BuildIndxReq { + friend bool printBUILD_INDX_REQ(FILE*, const Uint32*, Uint32, Uint16); -public: - enum RequestType { + enum xxxRequestType { //wl3600_todo out RT_UNDEFINED = 0, RT_USER = 1, RT_ALTER_INDEX = 2, @@ -44,103 +35,36 @@ RT_DICT_ABORT = 0xF << 4, RT_TRIX = 7 << 8 }; - STATIC_CONST( SignalLength = 9 ); + STATIC_CONST( SignalLength = 11 ); STATIC_CONST( INDEX_COLUMNS = 0 ); STATIC_CONST( KEY_COLUMNS = 1 ); STATIC_CONST( NoOfSections = 2 ); -private: - Uint32 m_userRef; // user block reference - Uint32 m_connectionPtr; // user "schema connection" - Uint32 m_requestInfo; - Uint32 m_buildId; // Suma subscription id - Uint32 m_buildKey; // Suma subscription key - Uint32 m_tableId; // table being indexed - Uint32 m_indexType; // from DictTabInfo::TableType - Uint32 m_indexId; // table storing index - Uint32 m_parallelism; // number of parallel insert transactions - // extra - Uint32 m_opKey; + Uint32 clientRef; + Uint32 clientData; + Uint32 transId; + Uint32 transKey; + Uint32 requestType; + Uint32 buildId; // Suma subscription id + Uint32 buildKey; // Suma subscription key + Uint32 tableId; + Uint32 indexId; + Uint32 indexType; + Uint32 parallelism; + +#ifdef wl3600_todo out // Sent data ends here Uint32 m_slack[25 - SignalLength - 1]; Uint32 m_sectionBuffer[MAX_ATTRIBUTES_IN_TABLE * 2]; -public: - Uint32 getUserRef() const { - return m_userRef; - } - void setUserRef(Uint32 val) { - m_userRef = val; - } - Uint32 getConnectionPtr() const { - return m_connectionPtr; - } - void setConnectionPtr(Uint32 val) { - m_connectionPtr = val; - } - BuildIndxReq::RequestType getRequestType() const { - const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 0, 16); - return (BuildIndxReq::RequestType)val; - } - void setRequestType(BuildIndxReq::RequestType val) { - m_requestInfo = (Uint32)val; - } - Uint32 getRequestFlag() const { - const Uint32 val = BitmaskImpl::getField(1, &m_requestInfo, 16, 16); - return (BuildIndxReq::RequestType)val; - }; - void addRequestFlag(Uint32 val) { - val |= BitmaskImpl::getField(1, &m_requestInfo, 16, 16); - BitmaskImpl::setField(1, &m_requestInfo, 16, 16, val); - }; - Uint32 getTableId() const { - return m_tableId; - } - void setTableId(Uint32 val) { - m_tableId = val; - } - Uint32 getBuildId() const { - return m_buildId; - } - void setBuildId(Uint32 val) { - m_buildId = val; - } - Uint32 getBuildKey() const { - return m_buildKey; - } - void setBuildKey(Uint32 val) { - m_buildKey = val; - } - Uint32 getIndexType() const { - return m_indexType; - } - void setIndexType(Uint32 val) { - m_indexType = val; - } - Uint32 getIndexId() const { - return m_indexId; - } - void setIndexId(Uint32 val) { - m_indexId = val; - } - Uint32 getParallelism() const { - return m_parallelism; - } - void setParallelism(Uint32 val) { - m_parallelism = val; - } - Uint32 getOpKey() const { - return m_opKey; - } - void setOpKey(Uint32 val) { - m_opKey = val; - } // Column order void setColumnOrder(Uint32* indexBuf, Uint32 indexLen, Uint32* keyBuf, Uint32 keyLen, struct LinearSectionPtr orderPtr[]); +#endif }; +#ifdef wl3600_todo out inline void BuildIndxReq::setColumnOrder(Uint32* indexBuf, Uint32 indexLen, Uint32* keyBuf, Uint32 keyLen, @@ -156,81 +80,25 @@ orderPtr[KEY_COLUMNS].p = m_sectionBuffer + indexLen; orderPtr[KEY_COLUMNS].sz = keyLen; } +#endif -/** - * BuildIndxConf - * - * This signal is sent back to DICT from TRIX - * as confirmation of succesfull index build - * (BuildIndxReq). - */ -class BuildIndxConf { - friend bool printBUILD_INDX_CONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo); - -public: - STATIC_CONST( InternalLength = 3 ); - STATIC_CONST( SignalLength = 6 ); - -private: - friend class BuildIndxRef; - Uint32 m_userRef; - Uint32 m_connectionPtr; - Uint32 m_requestInfo; - Uint32 m_tableId; - Uint32 m_indexType; - Uint32 m_indexId; - -public: - Uint32 getUserRef() const { - return m_userRef; - } - void setUserRef(Uint32 val) { - m_userRef = val; - } - Uint32 getConnectionPtr() const { - return m_connectionPtr; - } - void setConnectionPtr(Uint32 val) { - m_connectionPtr = val; - } - BuildIndxReq::RequestType getRequestType() const { - return (BuildIndxReq::RequestType)m_requestInfo; - } - void setRequestType(BuildIndxReq::RequestType val) { - m_requestInfo = (Uint32)val; - } - Uint32 getTableId() const { - return m_tableId; - } - void setTableId(Uint32 val) { - m_tableId = val; - } - Uint32 getIndexType() const { - return m_indexType; - } - void setIndexType(Uint32 val) { - m_indexType = val; - } - Uint32 getIndexId() const { - return m_indexId; - } - void setIndexId(Uint32 val) { - m_indexId = val; - } +struct BuildIndxConf { + friend bool printBUILD_INDX_CONF(FILE*, const Uint32*, Uint32, Uint16); + + STATIC_CONST( SignalLength = 7 ); + + Uint32 senderRef; + Uint32 clientData; + Uint32 transId; + Uint32 requestType; + Uint32 tableId; + Uint32 indexId; + Uint32 indexType; }; -/** - * BuildIndxRef - * - * This signal is sent back to API from DICT/TRIX - * as refusal of a failed index creation - * (BuildIndxReq). It is also sent as refusal - * from TC to TRIX and TRIX to DICT. - */ -class BuildIndxRef { - friend bool printBUILD_INDX_REF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo); +struct BuildIndxRef { + friend bool printBUILD_INDX_REF(FILE*, const Uint32*, Uint32, Uint16); -public: enum ErrorCode { NoError = 0, Busy = 701, @@ -240,69 +108,22 @@ InvalidIndexType = 4250, IndexNotUnique = 4251, AllocationFailure = 4252, - InternalError = 4346 + InternalError = 4346, + IndexNotFound = 4243 }; - STATIC_CONST( SignalLength = BuildIndxConf::SignalLength + 2 ); + STATIC_CONST( SignalLength = 11 ); - //Uint32 m_userRef; - //Uint32 m_connectionPtr; - //Uint32 m_requestInfo; - //Uint32 m_tableId; - //Uint32 m_indexType; - //Uint32 m_indexId; - BuildIndxConf m_conf; - Uint32 m_errorCode; + Uint32 senderRef; + Uint32 clientData; + Uint32 transId; + Uint32 requestType; + Uint32 tableId; + Uint32 indexId; + Uint32 indexType; + Uint32 errorCode; + Uint32 errorLine; + Uint32 errorNodeId; Uint32 masterNodeId; - -public: - BuildIndxConf* getConf() { - return &m_conf; - } - const BuildIndxConf* getConf() const { - return &m_conf; - } - Uint32 getUserRef() const { - return m_conf.getUserRef(); - } - void setUserRef(Uint32 val) { - m_conf.setUserRef(val); - } - Uint32 getConnectionPtr() const { - return m_conf.getConnectionPtr(); - } - void setConnectionPtr(Uint32 val) { - m_conf.setConnectionPtr(val); - } - BuildIndxReq::RequestType getRequestType() const { - return m_conf.getRequestType(); - } - void setRequestType(BuildIndxReq::RequestType val) { - m_conf.setRequestType(val); - } - Uint32 getTableId() const { - return m_conf.getTableId(); - } - void setTableId(Uint32 val) { - m_conf.setTableId(val); - } - Uint32 getIndexType() const { - return m_conf.getIndexType(); - } - void setIndexType(Uint32 val) { - m_conf.setIndexType(val); - } - Uint32 getIndexId() const { - return m_conf.getIndexId(); - } - void setIndexId(Uint32 val) { - m_conf.setIndexId(val); - } - BuildIndxRef::ErrorCode getErrorCode() const { - return (BuildIndxRef::ErrorCode)m_errorCode; - } - void setErrorCode(BuildIndxRef::ErrorCode val) { - m_errorCode = (Uint32)val; - } }; #endif --- 1.22/storage/ndb/include/kernel/signaldata/SignalData.hpp 2007-01-18 13:18:45 +01:00 +++ 1.23/storage/ndb/include/kernel/signaldata/SignalData.hpp 2007-01-25 13:30:51 +01:00 @@ -273,4 +273,12 @@ GSN_PRINT_SIGNATURE(printALTER_TRIG_IMPL_CONF); GSN_PRINT_SIGNATURE(printALTER_TRIG_IMPL_REF); +GSN_PRINT_SIGNATURE(printBUILD_INDX_REQ); +GSN_PRINT_SIGNATURE(printBUILD_INDX_CONF); +GSN_PRINT_SIGNATURE(printBUILD_INDX_REF); + +GSN_PRINT_SIGNATURE(printBUILD_INDX_IMPL_REQ); +GSN_PRINT_SIGNATURE(printBUILD_INDX_IMPL_CONF); +GSN_PRINT_SIGNATURE(printBUILD_INDX_IMPL_REF); + #endif --- 1.26/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp 2007-01-18 13:18:45 +01:00 +++ 1.27/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp 2007-01-25 13:30:51 +01:00 @@ -249,6 +249,14 @@ ,{ GSN_ALTER_TRIG_IMPL_CONF, printALTER_TRIG_IMPL_CONF } ,{ GSN_ALTER_TRIG_IMPL_REF, printALTER_TRIG_IMPL_REF } + ,{ GSN_BUILDINDXREQ, printBUILD_INDX_REQ } + ,{ GSN_BUILDINDXCONF, printBUILD_INDX_CONF } + ,{ GSN_BUILDINDXREF, printBUILD_INDX_REF } + + ,{ GSN_BUILD_INDX_IMPL_REQ, printBUILD_INDX_IMPL_REQ } + ,{ GSN_BUILD_INDX_IMPL_CONF, printBUILD_INDX_IMPL_CONF } + ,{ GSN_BUILD_INDX_IMPL_REF, printBUILD_INDX_IMPL_REF } + ,{ 0, 0 } }; --- 1.23/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2007-01-18 13:18:45 +01:00 +++ 1.24/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2007-01-25 13:30:51 +01:00 @@ -672,5 +672,9 @@ ,{ GSN_ALTER_TRIG_IMPL_CONF, "ALTER_TRIG_IMPL_CONF" } ,{ GSN_ALTER_TRIG_IMPL_REF, "ALTER_TRIG_IMPL_REF" } + ,{ GSN_BUILD_INDX_IMPL_REQ, "BUILD_INDX_IMPL_REQ" } + ,{ GSN_BUILD_INDX_IMPL_CONF, "BUILD_INDX_IMPL_CONF" } + ,{ GSN_BUILD_INDX_IMPL_REF, "BUILD_INDX_IMPL_REF" } + }; const unsigned short NO_OF_SIGNAL_NAMES = sizeof(SignalNames)/sizeof(GsnName); --- 1.138/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-01-24 15:53:43 +01:00 +++ 1.139/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2007-01-25 13:30:51 +01:00 @@ -1586,7 +1586,6 @@ c_schemaOpHash(c_schemaOpPool), c_schemaTransHash(c_schemaTransPool), c_opAlterTable(c_opRecordPool), - c_opBuildIndex(c_opRecordPool), c_opCreateEvent(c_opRecordPool), c_opSubEvent(c_opRecordPool), c_opDropEvent(c_opRecordPool), @@ -1635,6 +1634,9 @@ addRecSignal(GSN_ALTER_INDX_REQ, &Dbdict::execALTER_INDX_REQ); addRecSignal(GSN_ALTER_INDX_CONF, &Dbdict::execALTER_INDX_CONF); addRecSignal(GSN_ALTER_INDX_REF, &Dbdict::execALTER_INDX_REF); + // local replies + addRecSignal(GSN_ALTER_INDX_IMPL_CONF, &Dbdict::execALTER_INDX_IMPL_CONF); + addRecSignal(GSN_ALTER_INDX_IMPL_REF, &Dbdict::execALTER_INDX_IMPL_REF); addRecSignal(GSN_CREATE_TABLE_CONF, &Dbdict::execCREATE_TABLE_CONF); addRecSignal(GSN_CREATE_TABLE_REF, &Dbdict::execCREATE_TABLE_REF); @@ -1649,6 +1651,9 @@ addRecSignal(GSN_BUILDINDXREQ, &Dbdict::execBUILDINDXREQ); addRecSignal(GSN_BUILDINDXCONF, &Dbdict::execBUILDINDXCONF); addRecSignal(GSN_BUILDINDXREF, &Dbdict::execBUILDINDXREF); + // internal + addRecSignal(GSN_BUILD_INDX_IMPL_CONF, &Dbdict::execBUILD_INDX_IMPL_CONF); + addRecSignal(GSN_BUILD_INDX_IMPL_REF, &Dbdict::execBUILD_INDX_IMPL_REF); // local replies addRecSignal(GSN_CREATE_INDX_IMPL_CONF, &Dbdict::execCREATE_INDX_IMPL_CONF); @@ -2188,7 +2193,7 @@ c_opSignalUtil.setSize(8); c_dropIndexDataPool.setSize(256); c_alterIndexDataPool.setSize(256); - c_opBuildIndex.setSize(8); + c_buildIndexDataPool.setSize(256); c_createTriggerDataPool.setSize(256); c_dropTriggerDataPool.setSize(256); c_alterTriggerDataPool.setSize(256); @@ -2490,7 +2495,10 @@ } void -Dbdict::rebuildIndexes(Signal* signal, Uint32 i){ +Dbdict::rebuildIndexes(Signal* signal, Uint32 i) +{ + ndbrequire(false); +#if wl3600_todo BuildIndxReq* const req = (BuildIndxReq*)signal->getDataPtrSend(); TableRecordPtr indexPtr; @@ -2526,6 +2534,7 @@ return; } sendNDB_STTORRY(signal); +#endif } @@ -13041,6 +13050,7 @@ impl_req->tableVersion = 0; impl_req->indexId = req->indexId; impl_req->indexVersion = req->indexVersion; + impl_req->indexType = 0; // fill in parse alterIndex_parseCommon(signal, op_ptr, error); if (hasError(error)) { @@ -13257,6 +13267,12 @@ } alterIndexPtr.p->m_triggerNo = 0; // also in ctor + if (reference() == impl_req->senderRef) { + impl_req->indexType = indexPtr.p->tableType; + } else { + ndbrequire(impl_req->indexType == indexPtr.p->tableType); + } + if (indexPtr.p->tableVersion != impl_req->indexVersion) { jam(); setError(error, AlterIndxRef::InvalidIndexVersion, __LINE__); @@ -13343,6 +13359,18 @@ return true; } + if (impl_req->requestType == AlterIndxImplReq::AlterIndexOnline && + !alterIndexPtr.p->m_sub_build_index) { + jam(); + Callback c = { + safe_cast(&Dbdict::alterIndex_fromBuildIndex), + op_ptr.p->op_key + }; + op_ptr.p->m_callback = c; + alterIndex_toBuildIndex(signal, op_ptr); + return true; + } + ndbrequire(alterIndexPtr.p->m_triggerNo == alterIndexPtr.p->m_triggerCount); return false; } @@ -13421,7 +13449,10 @@ ndbrequire(triggerNo < alterIndexPtr.p->m_triggerCount); // connect trigger id to index + TriggerRecordPtr triggerPtr; + c_triggerRecordPool.getPtr(triggerPtr, conf->triggerId); indexPtr.p->indexTriggerId[triggerNo] = conf->triggerId; + triggerPtr.p->indexId = impl_req->indexId; alterIndexPtr.p->m_triggerNo = triggerNo + 1; } else { @@ -13518,6 +13549,99 @@ } void +Dbdict::alterIndex_toBuildIndex(Signal* signal, SchemaOpPtr op_ptr) +{ + D("alterIndex_toBuildIndex"); + + BuildIndxReq* req = (BuildIndxReq*)signal->getDataPtrSend(); + + SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr; + AlterIndexDataPtr alterIndexPtr; + getOpData(op_ptr, alterIndexPtr); + const AlterIndxImplReq* impl_req = &alterIndexPtr.p->m_request; + + req->clientRef = reference(); + req->clientData = op_ptr.p->op_key; + req->transId = trans_ptr.p->m_transId; + req->transKey = trans_ptr.p->trans_key; + req->requestType = 0; + req->buildId = 0; // not used + req->buildKey = 0; // not used + req->tableId = impl_req->tableId; + req->indexId = impl_req->indexId; + req->indexType = impl_req->indexType; + req->parallelism = 16; + + sendSignal(reference(), GSN_BUILDINDXREQ, signal, + BuildIndxReq::SignalLength, JBB); + +#if wl3600_todo + jam(); + // get index and table records + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId()); + TableRecordPtr tablePtr; + c_tableRecordPool.getPtr(tablePtr, indexPtr.p->primaryTableId); + // build request to self (short signal) + BuildIndxReq* const req = (BuildIndxReq*)signal->getDataPtrSend(); + req->setUserRef(reference()); + req->setConnectionPtr(opPtr.p->key); + req->setRequestType(BuildIndxReq::RT_ALTER_INDEX); + req->addRequestFlag(opPtr.p->m_requestFlag); + req->setBuildId(0); // not used + req->setBuildKey(0); // not used + req->setIndexType(indexPtr.p->tableType); + req->setIndexId(indexPtr.i); + req->setTableId(indexPtr.p->primaryTableId); + req->setParallelism(16); + // send + sendSignal(reference(), GSN_BUILDINDXREQ, + signal, BuildIndxReq::SignalLength, JBB); +#endif +} + +void +Dbdict::alterIndex_fromBuildIndex(Signal* signal, Uint32 op_key, Uint32 ret) +{ + jam(); + D("alterIndex_fromBuildIndex"); + + SchemaOpPtr op_ptr; + AlterIndexDataPtr alterIndexPtr; + + findSchemaOp(op_ptr, alterIndexPtr, op_key); + ndbrequire(!op_ptr.isNull()); + SchemaTransPtr trans_ptr = op_ptr.p->m_trans_ptr; + + Uint32 errorCode = 0; + if (ret == 0) { + jam(); + const BuildIndxConf* conf = + (const BuildIndxConf*)signal->getDataPtr(); + + ndbrequire(conf->transId == trans_ptr.p->m_transId); + alterIndexPtr.p->m_sub_build_index = true; + } else { + jam(); + ndbrequire(false); //TODO + } + + createSubOps(signal, op_ptr); + +#if wl3600_todo + jam(); + if (opPtr.p->hasError()) { + jam(); + opPtr.p->m_requestType = AlterIndxReq::RT_DICT_ABORT; + alterIndex_sendSlaveReq(signal, opPtr); + return; + } + opPtr.p->m_requestType = AlterIndxReq::RT_DICT_COMMIT; + alterIndex_sendSlaveReq(signal, opPtr); +#endif +} + +void Dbdict::alterIndex_reply(Signal* signal, SchemaOpPtr op_ptr) { D("alterIndex_reply" << V(op_ptr.i) << *op_ptr.p); @@ -13751,6 +13875,7 @@ Dbdict::alterIndex_commit(Signal* signal, SchemaOpPtr op_ptr, Uint32 repeat) { + jam(); AlterIndexDataPtr alterIndexPtr; getOpData(op_ptr, alterIndexPtr); @@ -13760,6 +13885,41 @@ } void +Dbdict::execALTER_INDX_IMPL_CONF(Signal* signal) +{ + jamEntry(); + ndbrequire(signal->getNoOfSections() == 0); + + const AlterIndxImplConf* conf = + (const AlterIndxImplConf*)signal->getDataPtr(); + + D("execALTER_INDX_IMPL_CONF" << hex << V(conf->senderData)); + + // the main operation e.g. create index + SchemaOpPtr op_ptr; + findSchemaOp(op_ptr, conf->senderData); + execute(signal, op_ptr.p->m_callback, 0); +} + +void +Dbdict::execALTER_INDX_IMPL_REF(Signal* signal) +{ + jamEntry(); + ndbrequire(signal->getNoOfSections() == 0); + + const AlterIndxImplRef* ref = + (const AlterIndxImplRef*)signal->getDataPtr(); + + D("execALTER_INDX_IMPL_REF" << hex << V(ref->senderData) + << dec << V(ref->errorCode)); + + SchemaOpPtr op_ptr; + findSchemaOp(op_ptr, ref->senderData); + ndbrequire(ref->errorCode != 0); + execute(signal, op_ptr.p->m_callback, ref->errorCode); +} + +void Dbdict::execALTER_INDX_CONF(Signal* signal) { jamEntry(); @@ -13828,7 +13988,7 @@ requestType == AlterIndxReq::RT_TUX) { jam(); // part of build index operation - OpBuildIndexPtr opPtr; + BuildIndexDataPtr opPtr; c_opBuildIndex.find(opPtr, key); ndbrequire(! opPtr.isNull()); opPtr.p->setError(ref); @@ -14261,52 +14421,6 @@ #endif void -Dbdict::alterIndex_toBuildIndex(Signal* signal, AlterIndexDataPtr opPtr) -{ - ndbrequire(false); -#if wl3600_todo - jam(); - // get index and table records - TableRecordPtr indexPtr; - c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId()); - TableRecordPtr tablePtr; - c_tableRecordPool.getPtr(tablePtr, indexPtr.p->primaryTableId); - // build request to self (short signal) - BuildIndxReq* const req = (BuildIndxReq*)signal->getDataPtrSend(); - req->setUserRef(reference()); - req->setConnectionPtr(opPtr.p->key); - req->setRequestType(BuildIndxReq::RT_ALTER_INDEX); - req->addRequestFlag(opPtr.p->m_requestFlag); - req->setBuildId(0); // not used - req->setBuildKey(0); // not used - req->setIndexType(indexPtr.p->tableType); - req->setIndexId(indexPtr.i); - req->setTableId(indexPtr.p->primaryTableId); - req->setParallelism(16); - // send - sendSignal(reference(), GSN_BUILDINDXREQ, - signal, BuildIndxReq::SignalLength, JBB); -#endif -} - -void -Dbdict::alterIndex_fromBuildIndex(Signal* signal, AlterIndexDataPtr opPtr) -{ - ndbrequire(false); -#if wl3600_todo - jam(); - if (opPtr.p->hasError()) { - jam(); - opPtr.p->m_requestType = AlterIndxReq::RT_DICT_ABORT; - alterIndex_sendSlaveReq(signal, opPtr); - return; - } - opPtr.p->m_requestType = AlterIndxReq::RT_DICT_COMMIT; - alterIndex_sendSlaveReq(signal, opPtr); -#endif -} - -void Dbdict::alterIndex_slaveCommit(Signal* signal, AlterIndexDataPtr opPtr) { ndbrequire(false); @@ -14415,12 +14529,97 @@ * RT_TRIX - to local TRIX */ +// MODULE: BuildIndex + +const Dbdict::OpInfo +Dbdict::BuildIndexData::g_opInfo = { + GSN_BUILD_INDX_IMPL_REQ, + BuildIndxImplReq::SignalLength, + // + &Dbdict::buildIndex_seize, + &Dbdict::buildIndex_release, + // + &Dbdict::buildIndex_parse, + &Dbdict::buildIndex_parseCommon, + &Dbdict::buildIndex_subOps, + &Dbdict::buildIndex_reply, + // + &Dbdict::buildIndex_prepare, + &Dbdict::buildIndex_commit +}; + +bool +Dbdict::buildIndex_seize(SchemaOpPtr op_ptr) +{ + return seizeOpData(op_ptr); +} + +void +Dbdict::buildIndex_release(SchemaOpPtr op_ptr) +{ + releaseOpData(op_ptr); +} + void Dbdict::execBUILDINDXREQ(Signal* signal) { jamEntry(); + ndbrequire(signal->getNoOfSections() == 0); + + const BuildIndxReq reqData = + *(const BuildIndxReq*)signal->getDataPtr(); + const BuildIndxReq* req = &reqData; + + ErrorInfo error; + do { + SchemaOpPtr op_ptr; + BuildIndexDataPtr buildIndexPtr; + + checkClientReq(signal, op_ptr, error); + if (hasError(error)) { + jam(); + break; + } + getOpData(op_ptr, buildIndexPtr); + + BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + impl_req->senderRef = reference(); + impl_req->senderData = op_ptr.p->op_key; + impl_req->requestType = req->requestType; + impl_req->buildId = req->buildId; //wl3600_todo remove from client sig + impl_req->buildKey = req->buildKey; + impl_req->tableId = req->tableId; + impl_req->indexId = req->indexId; + impl_req->indexType = req->indexType; //wl3600_todo remove from client sig + impl_req->parallelism = req->parallelism; + + buildIndex_parseCommon(signal, op_ptr, error); + if (hasError(error)) { + jam(); + break; + } + + schemaTrans_sendParseReq(signal, op_ptr); + return; + } while (0); + + BuildIndxRef* ref = (BuildIndxRef*)signal->getDataPtrSend(); + ref->senderRef = reference(); + ref->clientData = req->clientData; + ref->transId = req->transId; + ref->requestType = req->requestType; + ref->tableId = req->tableId; + ref->indexId = req->indexId; + ref->indexType = req->indexType; + getError(error, ref); + + sendSignal(req->clientRef, GSN_BUILDINDXREF, signal, + BuildIndxRef::SignalLength, JBB); + +#if wl3600_todo + jamEntry(); BuildIndxReq* const req = (BuildIndxReq*)signal->getDataPtrSend(); - OpBuildIndexPtr opPtr; + BuildIndexDataPtr opPtr; const Uint32 senderRef = signal->senderBlockRef(); const BuildIndxReq::RequestType requestType = req->getRequestType(); if (requestType == BuildIndxReq::RT_USER || @@ -14442,7 +14641,7 @@ jam(); releaseSections(signal); - OpBuildIndex opBad; + BuildIndexData opBad; opPtr.p = &opBad; opPtr.p->save(req); opPtr.p->m_errorCode = BuildIndxRef::NotMaster; @@ -14461,7 +14660,7 @@ // seize operation record ndbrequire(signal->getLength() == BuildIndxReq::SignalLength + 1); const Uint32 opKey = req->getOpKey(); - OpBuildIndex opBusy; + BuildIndexData opBusy; if (! c_opBuildIndex.seize(opPtr)) opPtr.p = &opBusy; opPtr.p->save(req); @@ -14508,12 +14707,338 @@ } jam(); // return to sender - OpBuildIndex opBad; + BuildIndexData opBad; opPtr.p = &opBad; opPtr.p->save(req); opPtr.p->m_errorCode = BuildIndxRef::BadRequestType; opPtr.p->m_errorLine = __LINE__; buildIndex_sendReply(signal, opPtr, true); +#endif +} + +void +Dbdict::buildIndex_parse(Signal* signal, SchemaTransPtr trans_ptr) +{ + jam(); + D("buildIndex_parse"); + parseClientReq(signal, trans_ptr); +} + +void +Dbdict::buildIndex_parseCommon(Signal* signal, SchemaOpPtr op_ptr, + ErrorInfo& error) +{ + D("buildIndex_parseCommon"); + + BuildIndexDataPtr buildIndexPtr; + getOpData(op_ptr, buildIndexPtr); + BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + // get index + TableRecordPtr indexPtr; + if (!(impl_req->indexId < c_tableRecordPool.getSize())) { + jam(); + setError(error, BuildIndxRef::IndexNotFound, __LINE__); + return; + } + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + + ndbrequire(indexPtr.p->primaryTableId == impl_req->tableId); + + // get primary table + TableRecordPtr tablePtr; + if (!(impl_req->tableId < c_tableRecordPool.getSize())) { + jam(); + setError(error, BuildIndxRef::IndexNotFound, __LINE__); + return; + } + c_tableRecordPool.getPtr(tablePtr, impl_req->tableId); + + // get attribute lists + getIndexAttrList(indexPtr, buildIndexPtr.p->m_indexKeyList); + getTableKeyList(tablePtr, buildIndexPtr.p->m_tableKeyList); +} + +bool +Dbdict::buildIndex_subOps(Signal* signal, SchemaOpPtr op_ptr) +{ + D("buildIndex_subOps" << V(op_ptr.i) << *op_ptr.p); + return false; +} + +void +Dbdict::buildIndex_reply(Signal* signal, SchemaOpPtr op_ptr) +{ + const OpInfo& info = getOpInfo(op_ptr); + + SchemaTransPtr& trans_ptr = op_ptr.p->m_trans_ptr; + BuildIndexDataPtr buildIndexPtr; + getOpData(op_ptr, buildIndexPtr); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + + Uint32 requestType; + Uint32 tableId; + Uint32 indexId; + Uint32 indexType; + BuildIndxConf* conf = (BuildIndxConf*)signal->getDataPtrSend(); + conf->senderRef = reference(); + conf->clientData = op_ptr.p->m_clientData; + conf->transId = trans_ptr.p->m_transId; + conf->requestType = impl_req->requestType; + conf->tableId = impl_req->tableId; + conf->indexId = impl_req->indexId; + conf->indexType = impl_req->indexType; + + D("buildIndex_reply" << V(conf->indexId)); + + Uint32 clientRef = op_ptr.p->m_clientRef; + sendSignal(clientRef, GSN_BUILDINDXCONF, signal, + BuildIndxConf::SignalLength, JBB); +} + +/* + * hash index build is not yet transactional and is moved from prepare + * to commit phase. the places affected are marked wl3600_todo-hib + */ + +void +Dbdict::buildIndex_prepare(Signal* signal, SchemaOpPtr op_ptr, + Uint32 repeat) +{ + jam(); + BuildIndexDataPtr buildIndexPtr; + getOpData(op_ptr, buildIndexPtr); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + D("buildIndex_prepare"); + + // wl3600_todo-hib + if (impl_req->indexType == DictTabInfo::UniqueHashIndex) { + jam(); + schemaTrans_sendConf(signal, op_ptr.p->m_trans_ptr, 0); + return; + } + ndbrequire(impl_req->indexType == DictTabInfo::OrderedIndex); + buildIndex_toLocalBuild(signal, op_ptr); +} + +void +Dbdict:: buildIndex_toLocalBuild(Signal* signal, SchemaOpPtr op_ptr) +{ + BuildIndexDataPtr buildIndexPtr; + getOpData(op_ptr, buildIndexPtr); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + + D("buildIndex_toLocalBuild"); + + BuildIndxImplReq* req = (BuildIndxImplReq*)signal->getDataPtrSend(); + + req->senderRef = reference(); + req->senderData = op_ptr.p->op_key; + req->requestType = 0; + req->buildId = impl_req->buildId; + req->buildKey = impl_req->buildKey; + req->tableId = impl_req->tableId; + req->indexId = impl_req->indexId; + req->indexType = indexPtr.p->tableType; + req->parallelism = impl_req->parallelism; + + Callback c = { + safe_cast(&Dbdict::buildIndex_fromLocalBuild), + op_ptr.p->op_key + }; + op_ptr.p->m_callback = c; + + switch (indexPtr.p->tableType) { + case DictTabInfo::UniqueHashIndex: + jam(); + { + LinearSectionPtr ls_ptr[3]; + ls_ptr[0].sz = buildIndexPtr.p->m_indexKeyList.sz; + ls_ptr[0].p = buildIndexPtr.p->m_indexKeyList.id; + ls_ptr[1].sz = buildIndexPtr.p->m_tableKeyList.sz; + ls_ptr[1].p = buildIndexPtr.p->m_tableKeyList.id; + + sendSignal(TRIX_REF, GSN_BUILD_INDX_IMPL_REQ, signal, + BuildIndxImplReq::SignalLength, JBB, ls_ptr, 2); + } + break; + case DictTabInfo::OrderedIndex: + jam(); + { + sendSignal(DBTUP_REF, GSN_BUILD_INDX_IMPL_REQ, signal, + BuildIndxImplReq::SignalLength, JBB); + } + break; + default: + ndbrequire(false); + break; + } +} + +void +Dbdict::buildIndex_fromLocalBuild(Signal* signal, Uint32 op_key, Uint32 ret) +{ + SchemaOpPtr op_ptr; + BuildIndexDataPtr buildIndexPtr; + findSchemaOp(op_ptr, buildIndexPtr, op_key); + ndbrequire(!op_ptr.isNull()); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + D("buildIndex_fromLocalBuild"); + + if (ret == 0) { + jam(); + Uint32 runFlag = 0; + // wl3600_todo-hib + if (impl_req->indexType == DictTabInfo::UniqueHashIndex) { + jam(); + runFlag |= SchemaTransImplConf::RF_REPEAT; + } + schemaTrans_sendConf(signal, op_ptr.p->m_trans_ptr, runFlag); + } else { + //wl3600_todo + ndbrequire(false); + } +} + +void +Dbdict::buildIndex_commit(Signal* signal, SchemaOpPtr op_ptr, + Uint32 repeat) +{ + jam(); + BuildIndexDataPtr buildIndexPtr; + getOpData(op_ptr, buildIndexPtr); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + D("buildIndex_commit" << V(repeat) << *op_ptr.p); + + // wl3600_todo-hib + if (impl_req->indexType == DictTabInfo::UniqueHashIndex && + repeat == 0) { + jam(); + buildIndex_toLocalBuild(signal, op_ptr); + return; + } + + buildIndex_toLocalOnline(signal, op_ptr); +} + +void +Dbdict::buildIndex_toLocalOnline(Signal* signal, SchemaOpPtr op_ptr) +{ + BuildIndexDataPtr buildIndexPtr; + getOpData(op_ptr, buildIndexPtr); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + + D("buildIndex_toLocalOnline"); + + AlterIndxImplReq* req = (AlterIndxImplReq*)signal->getDataPtrSend(); + + req->senderRef = reference(); + req->senderData = op_ptr.p->op_key; + req->requestType = AlterIndxImplReq::AlterIndexOnline; + req->tableId = impl_req->tableId; + req->tableVersion = 0; // not used + req->indexId = impl_req->indexId; + req->indexVersion = 0; // not used + + Callback c = { + safe_cast(&Dbdict::buildIndex_fromLocalOnline), + op_ptr.p->op_key + }; + op_ptr.p->m_callback = c; + + switch (indexPtr.p->tableType) { + case DictTabInfo::UniqueHashIndex: + jam(); + { + sendSignal(DBTC_REF, GSN_ALTER_INDX_IMPL_REQ, signal, + AlterIndxImplReq::SignalLength, JBB); + } + break; + case DictTabInfo::OrderedIndex: + jam(); + { + sendSignal(DBTUX_REF, GSN_ALTER_INDX_IMPL_REQ, signal, + AlterIndxImplReq::SignalLength, JBB); + } + break; + default: + ndbrequire(false); + break; + } +} + +void +Dbdict::buildIndex_fromLocalOnline(Signal* signal, Uint32 op_key, Uint32 ret) +{ + SchemaOpPtr op_ptr; + BuildIndexDataPtr buildIndexPtr; + findSchemaOp(op_ptr, buildIndexPtr, op_key); + ndbrequire(!op_ptr.isNull()); + const BuildIndxImplReq* impl_req = &buildIndexPtr.p->m_request; + + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + + D("buildIndex_fromLocalOnline"); + + if (ret == 0) { + jam(); + + // set index online + indexPtr.p->indexState = TableRecord::IS_ONLINE; + + schemaTrans_sendConf(signal, op_ptr.p->m_trans_ptr, 0); + } else { + //wl3600_todo + ndbrequire(false); + } +} + +void +Dbdict::execBUILD_INDX_IMPL_CONF(Signal* signal) +{ + jamEntry(); + ndbrequire(signal->getNoOfSections() == 0); + + const BuildIndxImplConf* conf = + (const BuildIndxImplConf*)signal->getDataPtr(); + + D("execBUILD_INDX_IMPL_CONF" << hex << V(conf->senderData)); + + // the main operation e.g. create index + SchemaOpPtr op_ptr; + findSchemaOp(op_ptr, conf->senderData); + execute(signal, op_ptr.p->m_callback, 0); +} + +void +Dbdict::execBUILD_INDX_IMPL_REF(Signal* signal) +{ + jamEntry(); + ndbrequire(signal->getNoOfSections() == 0); + + const BuildIndxImplRef* ref = + (const BuildIndxImplRef*)signal->getDataPtr(); + + D("execBUILD_INDX_IMPL_REF" << hex << V(ref->senderData) + << dec << V(ref->errorCode)); + + SchemaOpPtr op_ptr; + findSchemaOp(op_ptr, ref->senderData); + ndbrequire(ref->errorCode != 0); + execute(signal, op_ptr.p->m_callback, ref->errorCode); } void @@ -14521,16 +15046,34 @@ { jamEntry(); ndbrequire(signal->getNoOfSections() == 0); - BuildIndxConf* conf = (BuildIndxConf*)signal->getDataPtrSend(); - buildIndex_recvReply(signal, conf, 0); + + const BuildIndxConf* conf = + (const BuildIndxConf*)signal->getDataPtr(); + + D("execBUILD_INDX_CONF" << hex << V(conf->clientData)); + + // the main operation e.g. create index + SchemaOpPtr op_ptr; + findSchemaOp(op_ptr, conf->clientData); + execute(signal, op_ptr.p->m_callback, 0); } void Dbdict::execBUILDINDXREF(Signal* signal) { jamEntry(); - BuildIndxRef* ref = (BuildIndxRef*)signal->getDataPtrSend(); - buildIndex_recvReply(signal, ref->getConf(), ref); + ndbrequire(signal->getNoOfSections() == 0); + + const BuildIndxRef* ref = + (const BuildIndxRef*)signal->getDataPtr(); + + D("execBUILD_INDX_REF" << hex << V(ref->clientData) + << dec << V(ref->errorCode)); + + SchemaOpPtr op_ptr; + findSchemaOp(op_ptr, ref->clientData); + ndbrequire(ref->errorCode != 0); + execute(signal, op_ptr.p->m_callback, ref->errorCode); } void @@ -14566,7 +15109,7 @@ return; } - OpBuildIndexPtr opPtr; + BuildIndexDataPtr opPtr; c_opBuildIndex.find(opPtr, key); ndbrequire(! opPtr.isNull()); opPtr.p->setError(ref); @@ -14655,7 +15198,7 @@ } void -Dbdict::buildIndex_toCreateConstr(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_toCreateConstr(Signal* signal, BuildIndexDataPtr opPtr) { ndbrequire(false); #if wl3600_todo @@ -14698,8 +15241,10 @@ } void -Dbdict::buildIndex_fromCreateConstr(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_fromCreateConstr(Signal* signal, BuildIndexDataPtr opPtr) { + ndbrequire(false); +#if wl3600_todo jam(); if (opPtr.p->hasError()) { jam(); @@ -14709,11 +15254,14 @@ } opPtr.p->m_requestType = BuildIndxReq::RT_DICT_TRIX; buildIndex_sendSlaveReq(signal, opPtr); +#endif } void -Dbdict::buildIndex_buildTrix(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_buildTrix(Signal* signal, BuildIndexDataPtr opPtr) { + ndbrequire(false); +#if wl3600_todo jam(); TableRecordPtr indexPtr; c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId()); @@ -14751,10 +15299,11 @@ return; } ndbrequire(false); +#endif } void -Dbdict::buildIndex_toDropConstr(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_toDropConstr(Signal* signal, BuildIndexDataPtr opPtr) { ndbrequire(false); #if wl3600_todo @@ -14777,8 +15326,10 @@ } void -Dbdict::buildIndex_fromDropConstr(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_fromDropConstr(Signal* signal, BuildIndexDataPtr opPtr) { + ndbrequire(false); +#if wl3600_todo jam(); if (opPtr.p->hasError()) { jam(); @@ -14788,10 +15339,11 @@ } opPtr.p->m_requestType = BuildIndxReq::RT_DICT_TC; buildIndex_sendSlaveReq(signal, opPtr); +#endif } void -Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_toOnline(Signal* signal, BuildIndexDataPtr opPtr) { ndbrequire(false); #if wl3600_todo @@ -14834,7 +15386,7 @@ } void -Dbdict::buildIndex_fromOnline(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_fromOnline(Signal* signal, BuildIndexDataPtr opPtr) { jam(); // forward to master @@ -14842,8 +15394,10 @@ } void -Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr) +Dbdict::buildIndex_sendSlaveReq(Signal* signal, BuildIndexDataPtr opPtr) { + ndbrequire(false); +#if wl3600_todo BuildIndxReq* const req = (BuildIndxReq*)signal->getDataPtrSend(); *req = opPtr.p->m_request; req->setUserRef(opPtr.p->m_coordinatorRef); @@ -14863,12 +15417,15 @@ sendSignal(rg, GSN_BUILDINDXREQ, signal, BuildIndxReq::SignalLength, JBB); } +#endif } void -Dbdict::buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr, +Dbdict::buildIndex_sendReply(Signal* signal, BuildIndexDataPtr opPtr, bool toUser) { + ndbrequire(false); +#if wl3600_todo BuildIndxRef* rep = (BuildIndxRef*)signal->getDataPtrSend(); Uint32 gsn = GSN_BUILDINDXCONF; Uint32 length = BuildIndxConf::InternalLength; @@ -14897,6 +15454,7 @@ length = BuildIndxRef::SignalLength; } sendSignal(rep->getUserRef(), gsn, signal, length, JBB); +#endif } /** @@ -15276,6 +15834,28 @@ obj_ptr.p->m_type = TriggerInfo::getTriggerType(triggerPtr.p->triggerInfo); triggerPtr.p->m_obj_ptr_i = obj_ptr.i; } + + // wl3600_todo XXX this is the worst solution (sub-op fix for parent) + Uint32 triggerType = TriggerInfo::getTriggerType(impl_req->triggerInfo); + Uint32 triggerEvent = TriggerInfo::getTriggerEvent(impl_req->triggerInfo); + if (triggerType == TriggerType::SECONDARY_INDEX) { + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + if (triggerEvent == TriggerEvent::TE_INSERT) + indexPtr.p->indexTriggerId[0] = triggerPtr.p->triggerId; + if (triggerEvent == TriggerEvent::TE_DELETE) + indexPtr.p->indexTriggerId[1] = triggerPtr.p->triggerId; + if (triggerEvent == TriggerEvent::TE_UPDATE) + indexPtr.p->indexTriggerId[2] = triggerPtr.p->triggerId; + triggerPtr.p->indexId = impl_req->indexId; + } + if (triggerType == TriggerType::ORDERED_INDEX) { + TableRecordPtr indexPtr; + c_tableRecordPool.getPtr(indexPtr, impl_req->indexId); + if (triggerEvent == TriggerEvent::TE_CUSTOM) + indexPtr.p->indexTriggerId[0] = triggerPtr.p->triggerId; + triggerPtr.p->indexId = impl_req->indexId; + } } bool @@ -15415,6 +15995,50 @@ Uint32 repeat) { jam(); + CreateTriggerDataPtr createTriggerPtr; + getOpData(op_ptr, createTriggerPtr); + const CreateTrigImplReq* impl_req = &createTriggerPtr.p->m_request; + + TriggerRecordPtr triggerPtr; + c_triggerRecordPool.getPtr(triggerPtr, impl_req->triggerId); + + // wl3600_todo remove consistency check later + + ndbrequire(triggerPtr.i == triggerPtr.p->triggerId); + const Uint32 triggerId = triggerPtr.p->triggerId; + + ndbrequire(triggerPtr.p->triggerInfo == impl_req->triggerInfo); + const Uint32 ti = impl_req->triggerInfo; + const Uint32 triggerType = TriggerInfo::getTriggerType(ti); + const Uint32 triggerEvent = TriggerInfo::getTriggerEvent(ti); + + if (triggerType == TriggerType::SECONDARY_INDEX) { + TableRecordPtr indexPtr; + ndbrequire(triggerPtr.p->indexId != RNIL); + c_tableRecordPool.getPtr(indexPtr, triggerPtr.p->indexId); + switch (triggerEvent) { + case TriggerEvent::TE_INSERT: + ndbrequire(indexPtr.p->indexTriggerId[0] == triggerId); + break; + case TriggerEvent::TE_DELETE: + ndbrequire(indexPtr.p->indexTriggerId[1] == triggerId); + break; + case TriggerEvent::TE_UPDATE: + ndbrequire(indexPtr.p->indexTriggerId[2] == triggerId); + break; + default: + ndbrequire(false); + break; + } + } + if (triggerType == TriggerType::ORDERED_INDEX) { + TableRecordPtr indexPtr; + ndbrequire(triggerPtr.p->indexId != RNIL); + c_tableRecordPool.getPtr(indexPtr, triggerPtr.p->indexId); + ndbrequire(triggerEvent == TriggerEvent::TE_CUSTOM); + ndbrequire(indexPtr.p->indexTriggerId[0] == triggerId); + } + D("createTrigger_prepare"); schemaTrans_sendConf(signal, op_ptr.p->m_trans_ptr, 0); @@ -15488,7 +16112,7 @@ if (requestType == CreateTrigReq::RT_BUILD_INDEX) { jam(); // part of build index operation - OpBuildIndexPtr opPtr; + BuildIndexDataPtr opPtr; c_opBuildIndex.find(opPtr, key); ndbrequire(! opPtr.isNull()); opPtr.p->setError(ref); @@ -16343,7 +16967,7 @@ if (requestType == DropTrigReq::RT_BUILD_INDEX) { jam(); // part of build index operation - OpBuildIndexPtr opPtr; + BuildIndexDataPtr opPtr; c_opBuildIndex.find(opPtr, key); ndbrequire(! opPtr.isNull()); opPtr.p->setError(ref); @@ -17524,8 +18148,7 @@ */ void -Dbdict::getTableKeyList(TableRecordPtr tablePtr, - Id_array& list) +Dbdict::getTableKeyList(TableRecordPtr tablePtr, FragAttributeList& list) { jam(); list.sz = 0; @@ -20353,6 +20976,7 @@ &Dbdict::CreateIndexData::g_opInfo, &Dbdict::DropIndexData::g_opInfo, &Dbdict::AlterIndexData::g_opInfo, + &Dbdict::BuildIndexData::g_opInfo, &Dbdict::CreateTriggerData::g_opInfo, &Dbdict::DropTriggerData::g_opInfo, &Dbdict::AlterTriggerData::g_opInfo, --- 1.66/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-01-24 15:53:43 +01:00 +++ 1.67/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2007-01-25 13:30:51 +01:00 @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include //wl3600_todo client sigs not used in .hpp @@ -757,6 +758,9 @@ void execALTER_INDX_REQ(Signal* signal); void execALTER_INDX_CONF(Signal* signal); void execALTER_INDX_REF(Signal* signal); + // local replies + void execALTER_INDX_IMPL_CONF(Signal* signal); + void execALTER_INDX_IMPL_REF(Signal* signal); void execCREATE_TABLE_CONF(Signal* signal); void execCREATE_TABLE_REF(Signal* signal); @@ -771,6 +775,9 @@ void execBUILDINDXREQ(Signal* signal); void execBUILDINDXCONF(Signal* signal); void execBUILDINDXREF(Signal* signal); + // internal + void execBUILD_INDX_IMPL_CONF(Signal* signal); + void execBUILD_INDX_IMPL_REF(Signal* signal); // local replies void execCREATE_INDX_IMPL_CONF(Signal* signal); @@ -2310,6 +2317,7 @@ const TriggerTmpl* m_triggerTmpl; Uint32 m_triggerCount; // 3 or 1 Uint32 m_triggerNo; + bool m_sub_build_index; AlterIndexData() : OpData(g_opInfo, (Uint32*)&m_request) { @@ -2319,6 +2327,7 @@ m_triggerTmpl = 0; m_triggerCount = 0; m_triggerNo = 0; + m_sub_build_index = false; } #ifdef VM_TRACE @@ -2474,25 +2483,48 @@ void alterIndex_fromCreateTrigger(Signal*, Uint32 op_key, Uint32 ret); void alterIndex_toDropTrigger(Signal*, SchemaOpPtr); void alterIndex_fromDropTrigger(Signal*, Uint32 op_key, Uint32 ret); + void alterIndex_toBuildIndex(Signal*, SchemaOpPtr); + void alterIndex_fromBuildIndex(Signal*, Uint32 op_key, Uint32 ret); // prepare phase void alterIndex_toCreateLocal(Signal*, SchemaOpPtr); void alterIndex_toDropLocal(Signal*, SchemaOpPtr); void alterIndex_fromLocal(Signal*, Uint32 op_key, Uint32 ret); - /** - * Operation record for build index. - */ - struct OpBuildIndex : OpRecordCommon { + // MODULE: BuildIndex + + // this prepends 1 column used for FRAGMENT in hash index table key + typedef Id_array<1 + MAX_ATTRIBUTES_IN_INDEX> FragAttributeList; + + struct BuildIndexData : public OpData { + BuildIndxImplReq m_request; + AttributeList m_indexKeyList; + FragAttributeList m_tableKeyList; + + // reflection + static const OpInfo g_opInfo; + + static ArrayPool& + getPool(Dbdict* dict) { + return dict->c_buildIndexDataPool; + } + + BuildIndexData() : + OpData(g_opInfo, (Uint32*)&m_request) { + memset(&m_request, 0, sizeof(m_request)); + m_indexKeyList.clear(); + m_tableKeyList.clear(); + } + + // wl3600_todo rest out + // original request plus buffer for attribute lists - BuildIndxReq m_request; - AttributeList m_attrList; - Id_array m_tableKeyList; + //BuildIndxReq m_request; // coordinator DICT Uint32 m_coordinatorRef; bool m_isMaster; // state info - BuildIndxReq::RequestType m_requestType; + //BuildIndxReq::RequestType m_requestType; Uint32 m_requestFlag; Uint32 m_constrTriggerId; // error info @@ -2503,20 +2535,12 @@ // counters SignalCounter m_signalCounter; // ctor - OpBuildIndex() { - memset(&m_request, 0, sizeof(m_request)); - m_coordinatorRef = 0; - m_requestType = BuildIndxReq::RT_UNDEFINED; - m_requestFlag = 0; - m_lastError = BuildIndxRef::NoError; - m_errorCode = BuildIndxRef::NoError; - m_errorLine = 0; - m_errorNode = 0; - } void save(const BuildIndxReq* req) { +#if wl3600_todo m_request = *req; m_requestType = req->getRequestType(); m_requestFlag = req->getRequestFlag(); +#endif } bool hasLastError() { return m_lastError != BuildIndxRef::NoError; @@ -2525,6 +2549,7 @@ return m_errorCode != BuildIndxRef::NoError; } void setError(const BuildIndxRef* ref) { +#if wl3600_todo m_lastError = BuildIndxRef::NoError; if (ref != 0) { m_lastError = ref->getErrorCode(); @@ -2534,6 +2559,7 @@ m_errorNode = 0; } } +#endif } void setError(const AlterIndxRef* ref) { #if wl3600_todo @@ -2575,7 +2601,29 @@ #endif } }; - typedef Ptr OpBuildIndexPtr; + + typedef Ptr BuildIndexDataPtr; + ArrayPool c_buildIndexDataPool; + + // OpInfo + bool buildIndex_seize(SchemaOpPtr); + void buildIndex_release(SchemaOpPtr); + // + void buildIndex_parse(Signal*, SchemaTransPtr); + void buildIndex_parseCommon(Signal*, SchemaOpPtr, ErrorInfo&); + bool buildIndex_subOps(Signal*, SchemaOpPtr); + void buildIndex_reply(Signal*, SchemaOpPtr); + // + void buildIndex_prepare(Signal*, SchemaOpPtr, Uint32 repeat); + void buildIndex_commit(Signal*, SchemaOpPtr, Uint32 repeat); + + // prepare phase + void buildIndex_toLocalBuild(Signal*, SchemaOpPtr); + void buildIndex_fromLocalBuild(Signal*, Uint32 op_key, Uint32 ret); + + // commit phase + void buildIndex_toLocalOnline(Signal*, SchemaOpPtr); + void buildIndex_fromLocalOnline(Signal*, Uint32 op_key, Uint32 ret); /** * Operation record for Util Signals. @@ -3105,7 +3153,6 @@ // Common operation record pool public: STATIC_CONST( opAlterTableSize = sizeof(AlterTableRecord) ); - STATIC_CONST( opBuildIndexSize = sizeof(OpBuildIndex) ); STATIC_CONST( opCreateEventSize = sizeof(OpCreateEvent) ); STATIC_CONST( opSubEventSize = sizeof(OpSubEvent) ); STATIC_CONST( opDropEventSize = sizeof(OpDropEvent) ); @@ -3119,7 +3166,6 @@ Uint32 u_opSubEvent [PTR_ALIGN(opSubEventSize)]; Uint32 u_opDropEvent [PTR_ALIGN(opDropEventSize)]; Uint32 u_opSignalUtil [PTR_ALIGN(opSignalUtilSize)]; - Uint32 u_opBuildIndex [PTR_ALIGN(opBuildIndexSize)]; Uint32 u_opCreateObj [PTR_ALIGN(opCreateObjSize)]; Uint32 nextPool; }; @@ -3127,7 +3173,6 @@ // Operation records KeyTable2 c_opAlterTable; - KeyTable2 c_opBuildIndex; KeyTable2C c_opCreateEvent; KeyTable2C c_opSubEvent; KeyTable2C c_opDropEvent; @@ -3379,8 +3424,6 @@ void alterIndex_fromCreateTc(Signal* signal, AlterIndexDataPtr opPtr); void alterIndex_toDropTc(Signal* signal, AlterIndexDataPtr opPtr); void alterIndex_fromDropTc(Signal* signal, AlterIndexDataPtr opPtr); - void alterIndex_toBuildIndex(Signal* signal, AlterIndexDataPtr opPtr); - void alterIndex_fromBuildIndex(Signal* signal, AlterIndexDataPtr opPtr); void alterIndex_slaveCommit(Signal* signal, AlterIndexDataPtr opPtr); void alterIndex_slaveAbort(Signal* signal, AlterIndexDataPtr opPtr); void alterIndex_sendSlaveReq(Signal* signal, AlterIndexDataPtr opPtr); @@ -3388,15 +3431,15 @@ // build index void buildIndex_recvReply(Signal* signal, const BuildIndxConf* conf, const BuildIndxRef* ref); - void buildIndex_toCreateConstr(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_fromCreateConstr(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_buildTrix(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_toDropConstr(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_fromDropConstr(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_fromOnline(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr); - void buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr, bool); + void buildIndex_toCreateConstr(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_fromCreateConstr(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_buildTrix(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_toDropConstr(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_fromDropConstr(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_toOnline(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_fromOnline(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_sendSlaveReq(Signal* signal, BuildIndexDataPtr opPtr); + void buildIndex_sendReply(Signal* signal, BuildIndexDataPtr opPtr, bool); // Events void @@ -3520,8 +3563,7 @@ void alterTrigger_sendSlaveReq(Signal* signal, AlterTriggerDataPtr opPtr); void alterTrigger_sendReply(Signal* signal, AlterTriggerDataPtr opPtr, bool); // support - void getTableKeyList(TableRecordPtr, - Id_array& list); + void getTableKeyList(TableRecordPtr, FragAttributeList& list); void getIndexAttr(TableRecordPtr indexPtr, Uint32 itAttr, Uint32* id); void getIndexAttrList(TableRecordPtr indexPtr, AttributeList& list); void getIndexAttrMask(TableRecordPtr indexPtr, AttributeMask& mask); --- 1.58/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp 2007-01-17 15:21:24 +01:00 +++ 1.59/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp 2007-01-25 13:30:51 +01:00 @@ -2102,8 +2102,8 @@ void execREAD_PSEUDO_REQ(Signal* signal); void build_acc(Signal*, Uint32 fragPtrI); - void execBUILDINDXREF(Signal*signal); - void execBUILDINDXCONF(Signal*signal); + void execBUILD_INDX_IMPL_REF(Signal*signal); + void execBUILD_INDX_IMPL_CONF(Signal*signal); void execDUMP_STATE_ORD(Signal* signal); void execACC_ABORTCONF(Signal* signal); --- 1.23/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp 2007-01-17 15:21:24 +01:00 +++ 1.24/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp 2007-01-25 13:30:52 +01:00 @@ -290,8 +290,8 @@ addRecSignal(GSN_READ_PSEUDO_REQ, &Dblqh::execREAD_PSEUDO_REQ); - addRecSignal(GSN_BUILDINDXREF, &Dblqh::execBUILDINDXREF); - addRecSignal(GSN_BUILDINDXCONF, &Dblqh::execBUILDINDXCONF); + addRecSignal(GSN_BUILD_INDX_IMPL_REF, &Dblqh::execBUILD_INDX_IMPL_REF); + addRecSignal(GSN_BUILD_INDX_IMPL_CONF, &Dblqh::execBUILD_INDX_IMPL_CONF); addRecSignal(GSN_DEFINE_BACKUP_REF, &Dblqh::execDEFINE_BACKUP_REF); addRecSignal(GSN_DEFINE_BACKUP_CONF, &Dblqh::execDEFINE_BACKUP_CONF); --- 1.130/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2007-01-17 15:21:24 +01:00 +++ 1.131/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2007-01-25 13:30:52 +01:00 @@ -64,6 +64,8 @@ #include #include +#include + // Use DEBUG to print messages that should be // seen only when we debug the product #ifdef VM_TRACE @@ -14101,19 +14103,20 @@ continue; } - BuildIndxReq* const req = (BuildIndxReq*)signal->getDataPtrSend(); - req->setUserRef(reference()); - req->setConnectionPtr(fragptr.i); - req->setRequestType(BuildIndxReq::RT_SYSTEMRESTART); - req->setBuildId(0); // not used - req->setBuildKey(0); // not used - req->setIndexType(RNIL); - req->setIndexId(RNIL); - req->setTableId(tabptr.i); - req->setParallelism(0); + // wl3600_todo note this is unreachable + BuildIndxImplReq* const req = (BuildIndxImplReq*)signal->getDataPtrSend(); + req->senderRef = reference(); + req->senderData = fragptr.i; + req->requestType = BuildIndxImplReq::RT_SYSTEMRESTART;//wl3600_todo + req->buildId = 0; // not used + req->buildKey = 0; // not used + req->tableId = tabptr.i; + req->indexId = RNIL; + req->indexType = 0; + req->parallelism = 0; - sendSignal(DBTUP_REF, GSN_BUILDINDXREQ, signal, - BuildIndxReq::SignalLength, JBB); + sendSignal(DBTUP_REF, GSN_BUILD_INDX_IMPL_REQ, signal, + BuildIndxImplReq::SignalLength, JBB); return; } @@ -14121,16 +14124,17 @@ } void -Dblqh::execBUILDINDXREF(Signal* signal) +Dblqh::execBUILD_INDX_IMPL_REF(Signal* signal) { ndbrequire(false); } void -Dblqh::execBUILDINDXCONF(Signal* signal) +Dblqh::execBUILD_INDX_IMPL_CONF(Signal* signal) { - BuildIndxConf* conf = (BuildIndxConf*)signal->getDataPtrSend(); - Uint32 fragPtrI = conf->getConnectionPtr(); + const BuildIndxImplConf* conf = + (const BuildIndxImplConf*)signal->getDataPtrSend(); + Uint32 fragPtrI = conf->senderData; fragptr.i = fragPtrI; c_fragment_pool.getPtr(fragptr); --- 1.55/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2007-01-17 15:21:24 +01:00 +++ 1.56/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2007-01-25 13:30:52 +01:00 @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "Undo_buffer.hpp" #include "tuppage.hpp" #include <../pgman.hpp> @@ -1182,15 +1182,14 @@ * Build index operation record. */ struct BuildIndexRec { - // request cannot use signal class due to extra members - Uint32 m_request[BuildIndxReq::SignalLength]; + BuildIndxImplReq m_request; Uint8 m_build_vs; // varsize pages Uint32 m_indexId; // the index Uint32 m_fragNo; // fragment number under Tablerec Uint32 m_pageId; // logical fragment page id Uint32 m_tupleNo; // tuple number on page Uint32 m_buildRef; // Where to send tuples - BuildIndxRef::ErrorCode m_errorCode; + BuildIndxImplRef::ErrorCode m_errorCode; union { Uint32 nextPool; Uint32 nextList; @@ -1481,7 +1480,7 @@ void execTUP_WRITELOG_REQ(Signal* signal); // Ordered index related - void execBUILDINDXREQ(Signal* signal); + void execBUILD_INDX_IMPL_REQ(Signal* signal); void buildIndex(Signal* signal, Uint32 buildPtrI); void buildIndexReply(Signal* signal, const BuildIndexRec* buildRec); --- 1.36/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp 2007-01-17 15:21:24 +01:00 +++ 1.37/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp 2007-01-25 13:30:52 +01:00 @@ -93,7 +93,7 @@ addRecSignal(GSN_TUP_WRITELOG_REQ, &Dbtup::execTUP_WRITELOG_REQ); // Ordered index related - addRecSignal(GSN_BUILDINDXREQ, &Dbtup::execBUILDINDXREQ); + addRecSignal(GSN_BUILD_INDX_IMPL_REQ, &Dbtup::execBUILD_INDX_IMPL_REQ); // Tup scan addRecSignal(GSN_ACC_SCANREQ, &Dbtup::execACC_SCANREQ); --- 1.20/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp 2006-06-19 10:47:22 +02:00 +++ 1.21/storage/ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp 2007-01-25 13:30:52 +01:00 @@ -377,7 +377,7 @@ Uint32 number_events; #endif void -Dbtup::execBUILDINDXREQ(Signal* signal) +Dbtup::execBUILD_INDX_IMPL_REQ(Signal* signal) { ljamEntry(); #ifdef TIME_MEASUREMENT @@ -385,40 +385,40 @@ tot_time_passed= 0; number_events= 1; #endif + const BuildIndxImplReq* req = + (const BuildIndxImplReq*)signal->getDataPtr(); // get new operation BuildIndexPtr buildPtr; if (! c_buildIndexList.seize(buildPtr)) { ljam(); BuildIndexRec buildRec; - memcpy(buildRec.m_request, signal->theData, sizeof(buildRec.m_request)); - buildRec.m_errorCode= BuildIndxRef::Busy; + buildRec.m_request = *req; + buildRec.m_errorCode= BuildIndxImplRef::Busy; buildIndexReply(signal, &buildRec); return; } - memcpy(buildPtr.p->m_request, - signal->theData, - sizeof(buildPtr.p->m_request)); + buildPtr.p->m_request = *req; // check - buildPtr.p->m_errorCode= BuildIndxRef::NoError; + buildPtr.p->m_errorCode= BuildIndxImplRef::NoError; do { - const BuildIndxReq* buildReq= (const BuildIndxReq*)buildPtr.p->m_request; - if (buildReq->getTableId() >= cnoOfTablerec) { + const BuildIndxImplReq* buildReq = &buildPtr.p->m_request; + if (buildReq->tableId >= cnoOfTablerec) { ljam(); - buildPtr.p->m_errorCode= BuildIndxRef::InvalidPrimaryTable; + buildPtr.p->m_errorCode= BuildIndxImplRef::InvalidPrimaryTable; break; } TablerecPtr tablePtr; - tablePtr.i= buildReq->getTableId(); + tablePtr.i= buildReq->tableId; ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec); if (tablePtr.p->tableStatus != DEFINED) { ljam(); - buildPtr.p->m_errorCode= BuildIndxRef::InvalidPrimaryTable; + buildPtr.p->m_errorCode = BuildIndxImplRef::InvalidPrimaryTable; break; } // memory page format buildPtr.p->m_build_vs = tablePtr.p->m_attributes[MM].m_no_of_varsize > 0; - if (DictTabInfo::isOrderedIndex(buildReq->getIndexType())) { + if (DictTabInfo::isOrderedIndex(buildReq->indexType)) { ljam(); const DLList& triggerList = tablePtr.p->tuxCustomTriggers; @@ -426,7 +426,7 @@ TriggerPtr triggerPtr; triggerList.first(triggerPtr); while (triggerPtr.i != RNIL) { - if (triggerPtr.p->indexId == buildReq->getIndexId()) { + if (triggerPtr.p->indexId == buildReq->indexId) { ljam(); break; } @@ -435,19 +435,19 @@ if (triggerPtr.i == RNIL) { ljam(); // trigger was not created - buildPtr.p->m_errorCode = BuildIndxRef::InternalError; + buildPtr.p->m_errorCode = BuildIndxImplRef::InternalError; break; } - buildPtr.p->m_indexId = buildReq->getIndexId(); + buildPtr.p->m_indexId = buildReq->indexId; buildPtr.p->m_buildRef = DBTUX; - } else if(buildReq->getIndexId() == RNIL) { + } else if(buildReq->indexId == RNIL) { ljam(); // REBUILD of acc buildPtr.p->m_indexId = RNIL; buildPtr.p->m_buildRef = DBACC; } else { ljam(); - buildPtr.p->m_errorCode = BuildIndxRef::InvalidIndexType; + buildPtr.p->m_errorCode = BuildIndxImplRef::InvalidIndexType; break; } @@ -472,10 +472,10 @@ BuildIndexPtr buildPtr; buildPtr.i= buildPtrI; c_buildIndexList.getPtr(buildPtr); - const BuildIndxReq* buildReq= (const BuildIndxReq*)buildPtr.p->m_request; + const BuildIndxImplReq* buildReq = &buildPtr.p->m_request; // get table TablerecPtr tablePtr; - tablePtr.i= buildReq->getTableId(); + tablePtr.i= buildReq->tableId; ptrCheckGuard(tablePtr, cnoOfTablerec, tablerec); const Uint32 firstTupleNo = 0; @@ -616,7 +616,7 @@ switch (req->errorCode) { case TuxMaintReq::NoMemError: ljam(); - buildPtr.p->m_errorCode= BuildIndxRef::AllocationFailure; + buildPtr.p->m_errorCode= BuildIndxImplRef::AllocationFailure; break; default: ndbrequire(false); @@ -655,25 +655,29 @@ void Dbtup::buildIndexReply(Signal* signal, const BuildIndexRec* buildPtrP) { - const BuildIndxReq* const buildReq= - (const BuildIndxReq*)buildPtrP->m_request; - // conf is subset of ref - BuildIndxRef* rep= (BuildIndxRef*)signal->getDataPtr(); - rep->setUserRef(buildReq->getUserRef()); - rep->setConnectionPtr(buildReq->getConnectionPtr()); - rep->setRequestType(buildReq->getRequestType()); - rep->setTableId(buildReq->getTableId()); - rep->setIndexType(buildReq->getIndexType()); - rep->setIndexId(buildReq->getIndexId()); - // conf - if (buildPtrP->m_errorCode == BuildIndxRef::NoError) { + const BuildIndxImplReq* buildReq = &buildPtrP->m_request; + + if (buildPtrP->m_errorCode == BuildIndxImplRef::NoError) { ljam(); - sendSignal(rep->getUserRef(), GSN_BUILDINDXCONF, - signal, BuildIndxConf::SignalLength, JBB); + + BuildIndxImplConf* conf = + (BuildIndxImplConf*)signal->getDataPtrSend(); + conf->senderRef = reference(); + conf->senderData = buildReq->senderData; + conf->requestType = buildReq->requestType; + + sendSignal(buildReq->senderRef, GSN_BUILD_INDX_IMPL_CONF, signal, + BuildIndxImplConf::SignalLength, JBB); return; } - // ref - rep->setErrorCode(buildPtrP->m_errorCode); - sendSignal(rep->getUserRef(), GSN_BUILDINDXREF, - signal, BuildIndxRef::SignalLength, JBB); + + BuildIndxImplRef* ref = + (BuildIndxImplRef*)signal->getDataPtrSend(); + ref->senderRef = reference(); + ref->senderData = buildReq->senderData; + ref->requestType = buildReq->requestType; + ref->errorCode = buildPtrP->m_errorCode; + + sendSignal(buildReq->senderRef, GSN_BUILD_INDX_IMPL_REF, signal, + BuildIndxImplRef::SignalLength, JBB); } --- 1.12/storage/ndb/src/kernel/blocks/trix/Trix.cpp 2006-02-13 13:12:43 +01:00 +++ 1.13/storage/ndb/src/kernel/blocks/trix/Trix.cpp 2007-01-25 13:30:52 +01:00 @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -62,10 +62,10 @@ addRecSignal(GSN_DUMP_STATE_ORD, &Trix::execDUMP_STATE_ORD); // Index build - addRecSignal(GSN_BUILDINDXREQ, &Trix::execBUILDINDXREQ); + addRecSignal(GSN_BUILD_INDX_IMPL_REQ, &Trix::execBUILD_INDX_IMPL_REQ); // Dump testing - addRecSignal(GSN_BUILDINDXCONF, &Trix::execBUILDINDXCONF); - addRecSignal(GSN_BUILDINDXREF, &Trix::execBUILDINDXREF); + addRecSignal(GSN_BUILD_INDX_IMPL_CONF, &Trix::execBUILD_INDX_IMPL_CONF); + addRecSignal(GSN_BUILD_INDX_IMPL_REF, &Trix::execBUILD_INDX_IMPL_REF); addRecSignal(GSN_UTIL_PREPARE_CONF, &Trix::execUTIL_PREPARE_CONF); @@ -292,144 +292,150 @@ // index2 -T; index2 -I -n10000; index2 -c // all dump 300 0 0 0 0 0 4 2 // select_count INDEX0000 - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtrSend(); + BuildIndxImplReq * buildIndxReq = (BuildIndxImplReq *)signal->getDataPtrSend(); MEMCOPY_NO_WORDS(buildIndxReq, signal->theData + 1, - BuildIndxReq::SignalLength); - buildIndxReq->setUserRef(reference()); // return to me - buildIndxReq->setParallelism(10); + BuildIndxImplReq::SignalLength); + buildIndxReq->senderRef = reference(); // return to me + buildIndxReq->parallelism = 10; Uint32 indexColumns[1] = {1}; Uint32 keyColumns[1] = {0}; - struct LinearSectionPtr orderPtr[2]; - buildIndxReq->setColumnOrder(indexColumns, 1, keyColumns, 1, orderPtr); + struct LinearSectionPtr ls_ptr[3]; + ls_ptr[0].p = indexColumns; + ls_ptr[0].sz = 1; + ls_ptr[1].p = keyColumns; + ls_ptr[1].sz = 1; sendSignal(reference(), - GSN_BUILDINDXREQ, + GSN_BUILD_INDX_IMPL_REQ, signal, - BuildIndxReq::SignalLength, - JBB, - orderPtr, - BuildIndxReq::NoOfSections); + BuildIndxImplReq::SignalLength, + JBB, ls_ptr, 2); break; } case(301): { // ok // index2 -T; index2 -I -n10000; index2 -c -p // all dump 301 0 0 0 0 0 4 2 // select_count INDEX0000 - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtrSend(); + BuildIndxImplReq * buildIndxReq = (BuildIndxImplReq *)signal->getDataPtrSend(); MEMCOPY_NO_WORDS(buildIndxReq, signal->theData + 1, - BuildIndxReq::SignalLength); - buildIndxReq->setUserRef(reference()); // return to me - buildIndxReq->setParallelism(10); + BuildIndxImplReq::SignalLength); + buildIndxReq->senderRef = reference(); // return to me + buildIndxReq->parallelism = 10; Uint32 indexColumns[2] = {0, 1}; Uint32 keyColumns[1] = {0}; - struct LinearSectionPtr orderPtr[2]; - buildIndxReq->setColumnOrder(indexColumns, 2, keyColumns, 1, orderPtr); + struct LinearSectionPtr ls_ptr[3]; + ls_ptr[0].p = indexColumns; + ls_ptr[0].sz = 2; + ls_ptr[1].p = keyColumns; + ls_ptr[1].sz = 1; sendSignal(reference(), - GSN_BUILDINDXREQ, + GSN_BUILD_INDX_IMPL_REQ, signal, - BuildIndxReq::SignalLength, - JBB, - orderPtr, - BuildIndxReq::NoOfSections); + BuildIndxImplReq::SignalLength, + JBB, ls_ptr, 2); break; } case(302): { // ok // index -T; index -I -n1000; index -c -p // all dump 302 0 0 0 0 0 4 2 // select_count PNUMINDEX0000 - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtrSend(); + BuildIndxImplReq * buildIndxReq = (BuildIndxImplReq *)signal->getDataPtrSend(); MEMCOPY_NO_WORDS(buildIndxReq, signal->theData + 1, - BuildIndxReq::SignalLength); - buildIndxReq->setUserRef(reference()); // return to me - buildIndxReq->setParallelism(10); + BuildIndxImplReq::SignalLength); + buildIndxReq->senderRef = reference(); // return to me + buildIndxReq->parallelism = 10; Uint32 indexColumns[3] = {0, 3, 5}; Uint32 keyColumns[1] = {0}; - struct LinearSectionPtr orderPtr[2]; - buildIndxReq->setColumnOrder(indexColumns, 3, keyColumns, 1, orderPtr); + struct LinearSectionPtr ls_ptr[3]; + ls_ptr[0].p = indexColumns; + ls_ptr[0].sz = 3; + ls_ptr[1].p = keyColumns; + ls_ptr[1].sz = 1; sendSignal(reference(), - GSN_BUILDINDXREQ, + GSN_BUILD_INDX_IMPL_REQ, signal, - BuildIndxReq::SignalLength, - JBB, - orderPtr, - BuildIndxReq::NoOfSections); + BuildIndxImplReq::SignalLength, + JBB, ls_ptr, 2); break; } case(303): { // ok // index -T -2; index -I -2 -n1000; index -c -p // all dump 303 0 0 0 0 0 4 2 // select_count PNUMINDEX0000 - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtrSend(); + BuildIndxImplReq * buildIndxReq = (BuildIndxImplReq *)signal->getDataPtrSend(); MEMCOPY_NO_WORDS(buildIndxReq, signal->theData + 1, - BuildIndxReq::SignalLength); - buildIndxReq->setUserRef(reference()); // return to me - buildIndxReq->setParallelism(10); + BuildIndxImplReq::SignalLength); + buildIndxReq->senderRef = reference(); // return to me + buildIndxReq->parallelism = 10; Uint32 indexColumns[3] = {0, 3, 5}; Uint32 keyColumns[2] = {0, 1}; - struct LinearSectionPtr orderPtr[2]; - buildIndxReq->setColumnOrder(indexColumns, 3, keyColumns, 2, orderPtr); + struct LinearSectionPtr ls_ptr[3]; + ls_ptr[0].p = indexColumns; + ls_ptr[0].sz = 3; + ls_ptr[1].p = keyColumns; + ls_ptr[1].sz = 2; sendSignal(reference(), - GSN_BUILDINDXREQ, + GSN_BUILD_INDX_IMPL_REQ, signal, - BuildIndxReq::SignalLength, - JBB, - orderPtr, - BuildIndxReq::NoOfSections); + BuildIndxImplReq::SignalLength, + JBB, ls_ptr, 2); break; } case(304): { // ok // index -T -L; index -I -L -n1000; index -c -p // all dump 304 0 0 0 0 0 4 2 // select_count PNUMINDEX0000 - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtrSend(); + BuildIndxImplReq * buildIndxReq = (BuildIndxImplReq *)signal->getDataPtrSend(); MEMCOPY_NO_WORDS(buildIndxReq, signal->theData + 1, - BuildIndxReq::SignalLength); - buildIndxReq->setUserRef(reference()); // return to me - buildIndxReq->setParallelism(10); + BuildIndxImplReq::SignalLength); + buildIndxReq->senderRef = reference(); // return to me + buildIndxReq->parallelism = 10; Uint32 indexColumns[3] = {0, 3, 5}; Uint32 keyColumns[1] = {0}; - struct LinearSectionPtr orderPtr[2]; - buildIndxReq->setColumnOrder(indexColumns, 3, keyColumns, 1, orderPtr); + struct LinearSectionPtr ls_ptr[3]; + ls_ptr[0].p = indexColumns; + ls_ptr[0].sz = 3; + ls_ptr[1].p = keyColumns; + ls_ptr[1].sz = 1; sendSignal(reference(), - GSN_BUILDINDXREQ, + GSN_BUILD_INDX_IMPL_REQ, signal, - BuildIndxReq::SignalLength, - JBB, - orderPtr, - BuildIndxReq::NoOfSections); + BuildIndxImplReq::SignalLength, + JBB, ls_ptr, 2); break; } case(305): { // ok // index -T -2 -L; index -I -2 -L -n1000; index -c -p // all dump 305 0 0 0 0 0 4 2 // select_count PNUMINDEX0000 - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtrSend(); + BuildIndxImplReq * buildIndxReq = (BuildIndxImplReq *)signal->getDataPtrSend(); MEMCOPY_NO_WORDS(buildIndxReq, signal->theData + 1, - BuildIndxReq::SignalLength); - buildIndxReq->setUserRef(reference()); // return to me - buildIndxReq->setParallelism(10); + BuildIndxImplReq::SignalLength); + buildIndxReq->senderRef = reference(); // return to me + buildIndxReq->parallelism = 10; Uint32 indexColumns[3] = {0, 3, 5}; Uint32 keyColumns[2] = {0, 1}; - struct LinearSectionPtr orderPtr[2]; - buildIndxReq->setColumnOrder(indexColumns, 3, keyColumns, 2, orderPtr); + struct LinearSectionPtr ls_ptr[3]; + ls_ptr[0].p = indexColumns; + ls_ptr[0].sz = 3; + ls_ptr[1].p = keyColumns; + ls_ptr[1].sz = 2; sendSignal(reference(), - GSN_BUILDINDXREQ, + GSN_BUILD_INDX_IMPL_REQ, signal, - BuildIndxReq::SignalLength, - JBB, - orderPtr, - BuildIndxReq::NoOfSections); + BuildIndxImplReq::SignalLength, + JBB, ls_ptr, 2); break; } default: { @@ -439,40 +445,41 @@ } // Build index -/** - * - */ -void Trix:: execBUILDINDXREQ(Signal* signal) +void Trix:: execBUILD_INDX_IMPL_REQ(Signal* signal) { jamEntry(); - DBUG_ENTER("Trix:: execBUILDINDXREQ"); + DBUG_ENTER("Trix:: execBUILD_INDX_IMPL_REQ"); - BuildIndxReq * buildIndxReq = (BuildIndxReq *)signal->getDataPtr(); + const BuildIndxImplReq + buildIndxReqData = *(const BuildIndxImplReq*)signal->getDataPtr(), + *buildIndxReq = &buildIndxReqData; // Seize a subscription record SubscriptionRecPtr subRecPtr; SubscriptionRecord* subRec; - if (!c_theSubscriptions.seizeId(subRecPtr, buildIndxReq->getBuildId())) { + if (!c_theSubscriptions.seizeId(subRecPtr, buildIndxReq->buildId)) { + jam(); // Failed to allocate subscription record - BuildIndxRef * buildIndxRef = (BuildIndxRef *)signal->getDataPtrSend(); + BuildIndxRef* buildIndxRef = (BuildIndxRef*)signal->getDataPtrSend(); - buildIndxRef->setErrorCode(BuildIndxRef::AllocationFailure); + buildIndxRef->errorCode = BuildIndxRef::AllocationFailure; releaseSections(signal); - sendSignal(buildIndxReq->getUserRef(), - GSN_BUILDINDXREF, signal, BuildIndxRef::SignalLength, JBB); + sendSignal(buildIndxReq->senderRef, GSN_BUILD_INDX_IMPL_REF, signal, + BuildIndxRef::SignalLength, JBB); DBUG_VOID_RETURN; } + subRec = subRecPtr.p; subRec->errorCode = BuildIndxRef::NoError; - subRec->userReference = buildIndxReq->getUserRef(); - subRec->connectionPtr = buildIndxReq->getConnectionPtr(); - subRec->subscriptionId = buildIndxReq->getBuildId(); - subRec->subscriptionKey = buildIndxReq->getBuildKey(); - subRec->indexType = buildIndxReq->getIndexType(); - subRec->sourceTableId = buildIndxReq->getTableId(); - subRec->targetTableId = buildIndxReq->getIndexId(); - subRec->parallelism = buildIndxReq->getParallelism(); + subRec->userReference = buildIndxReq->senderRef; + subRec->connectionPtr = buildIndxReq->senderData; + subRec->subscriptionId = buildIndxReq->buildId; + subRec->subscriptionKey = buildIndxReq->buildKey; + subRec->indexType = buildIndxReq->indexType; + subRec->sourceTableId = buildIndxReq->tableId; + subRec->targetTableId = buildIndxReq->indexId; + subRec->parallelism = buildIndxReq->parallelism; subRec->expectedConf = 0; subRec->subscriptionCreated = false; subRec->pendingSubSyncContinueConf = false; @@ -480,36 +487,40 @@ // Get column order segments Uint32 noOfSections = signal->getNoOfSections(); - if(noOfSections > 0) { + if (noOfSections > 0) { + jam(); SegmentedSectionPtr ptr; - signal->getSection(ptr, BuildIndxReq::INDEX_COLUMNS); + signal->getSection(ptr, BuildIndxImplReq::INDEX_COLUMNS); append(subRec->attributeOrder, ptr, getSectionSegmentPool()); subRec->noOfIndexColumns = ptr.sz; } - if(noOfSections > 1) { + if (noOfSections > 1) { + jam(); SegmentedSectionPtr ptr; - signal->getSection(ptr, BuildIndxReq::KEY_COLUMNS); + signal->getSection(ptr, BuildIndxImplReq::KEY_COLUMNS); append(subRec->attributeOrder, ptr, getSectionSegmentPool()); subRec->noOfKeyColumns = ptr.sz; } + #if 0 // Debugging - printf("Trix:: execBUILDINDXREQ: Attribute order:\n"); + printf("Trix:: execBUILD_INDX_IMPL_REQ: Attribute order:\n"); subRec->attributeOrder.print(stdout); #endif + releaseSections(signal); prepareInsertTransactions(signal, subRecPtr); DBUG_VOID_RETURN; } -void Trix:: execBUILDINDXCONF(Signal* signal) +void Trix:: execBUILD_INDX_IMPL_CONF(Signal* signal) { - printf("Trix:: execBUILDINDXCONF\n"); + printf("Trix:: execBUILD_INDX_IMPL_CONF\n"); } -void Trix:: execBUILDINDXREF(Signal* signal) +void Trix:: execBUILD_INDX_IMPL_REF(Signal* signal) { - printf("Trix:: execBUILDINDXREF\n"); + printf("Trix:: execBUILD_INDX_IMPL_REF\n"); } void Trix::execUTIL_PREPARE_CONF(Signal* signal) @@ -946,30 +957,37 @@ SubscriptionRecPtr subRecPtr; c_theSubscriptions.getPtr(subRecPtr, conf->senderData); - if(subRecPtr.p->errorCode == BuildIndxRef::NoError){ + if (subRecPtr.p->errorCode == BuildIndxRef::NoError) { + jam(); // Build is complete, reply to original sender - BuildIndxConf * buildIndxConf = (BuildIndxConf *)signal->getDataPtrSend(); - buildIndxConf->setUserRef(subRecPtr.p->userReference); - buildIndxConf->setConnectionPtr(subRecPtr.p->connectionPtr); - buildIndxConf->setRequestType(BuildIndxReq::RT_TRIX); - buildIndxConf->setIndexType(subRecPtr.p->indexType); - buildIndxConf->setTableId(subRecPtr.p->sourceTableId); - buildIndxConf->setIndexId(subRecPtr.p->targetTableId); + BuildIndxImplConf* buildIndxConf = + (BuildIndxImplConf*)signal->getDataPtrSend(); + buildIndxConf->senderRef = reference();//wl3600_todo always ok? + buildIndxConf->senderData = subRecPtr.p->connectionPtr; + buildIndxConf->requestType= BuildIndxImplReq::RT_TRIX;//wl3600_todo + // wl3600_todo out + //buildIndxConf->tableId = subRecPtr.p->sourceTableId; + //buildIndxConf->indexId = subRecPtr.p->targetTableId; + //buildIndxConf->indexType = subRecPtr.p->indexType; - sendSignal(subRecPtr.p->userReference, GSN_BUILDINDXCONF, signal, + sendSignal(subRecPtr.p->userReference, GSN_BUILD_INDX_IMPL_CONF, signal, BuildIndxConf::SignalLength , JBB); } else { + jam(); // Build failed, reply to original sender - BuildIndxRef * buildIndxRef = (BuildIndxRef *)signal->getDataPtrSend(); - buildIndxRef->setUserRef(subRecPtr.p->userReference); - buildIndxRef->setConnectionPtr(subRecPtr.p->connectionPtr); - buildIndxRef->setRequestType(BuildIndxReq::RT_TRIX); - buildIndxRef->setIndexType(subRecPtr.p->indexType); - buildIndxRef->setTableId(subRecPtr.p->sourceTableId); - buildIndxRef->setIndexId(subRecPtr.p->targetTableId); - buildIndxRef->setErrorCode(subRecPtr.p->errorCode); + BuildIndxImplRef* buildIndxRef = + (BuildIndxImplRef*)signal->getDataPtrSend(); + buildIndxRef->senderRef = subRecPtr.p->userReference; + buildIndxRef->senderData = subRecPtr.p->connectionPtr; + buildIndxRef->requestType = BuildIndxImplReq::RT_TRIX;//wl3600_todo + // wl3600_todo out + //buildIndxRef->tableId = subRecPtr.p->sourceTableId; + //buildIndxRef->indexId = subRecPtr.p->targetTableId; + //buildIndxRef->indexType = subRecPtr.p->indexType; + buildIndxRef->errorCode = subRecPtr.p->errorCode; + buildIndxRef->errorLine = __LINE__; - sendSignal(subRecPtr.p->userReference, GSN_BUILDINDXREF, signal, + sendSignal(subRecPtr.p->userReference, GSN_BUILD_INDX_IMPL_REF, signal, BuildIndxRef::SignalLength , JBB); } --- 1.7/storage/ndb/src/kernel/blocks/trix/Trix.hpp 2006-02-13 13:12:43 +01:00 +++ 1.8/storage/ndb/src/kernel/blocks/trix/Trix.hpp 2007-01-25 13:30:52 +01:00 @@ -151,9 +151,9 @@ void execDUMP_STATE_ORD(Signal* signal); // Build index - void execBUILDINDXREQ(Signal* signal); - void execBUILDINDXCONF(Signal* signal); - void execBUILDINDXREF(Signal* signal); + void execBUILD_INDX_IMPL_REQ(Signal* signal); + void execBUILD_INDX_IMPL_CONF(Signal* signal); + void execBUILD_INDX_IMPL_REF(Signal* signal); void execUTIL_PREPARE_CONF(Signal* signal); void execUTIL_PREPARE_REF(Signal* signal); --- 1.3/storage/ndb/include/kernel/signaldata/AlterIndxImpl.hpp 2007-01-16 12:39:53 +01:00 +++ 1.4/storage/ndb/include/kernel/signaldata/AlterIndxImpl.hpp 2007-01-25 13:30:51 +01:00 @@ -28,7 +28,7 @@ AlterIndexOffline = 2 }; - STATIC_CONST( SignalLength = 7 ); + STATIC_CONST( SignalLength = 8 ); Uint32 senderRef; Uint32 senderData; @@ -37,6 +37,7 @@ Uint32 tableVersion; Uint32 indexId; Uint32 indexVersion; + Uint32 indexType; }; struct AlterIndxImplConf { --- New file --- +++ storage/ndb/include/kernel/signaldata/BuildIndxImpl.hpp 07/01/21 23:09:25 /* 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 BUILD_INDX_IMPL_HPP #define BUILD_INDX_IMPL_HPP #include "SignalData.hpp" struct BuildIndxImplReq { friend bool printBUILD_INDX_IMPL_REQ(FILE*, const Uint32*, Uint32, Uint16); enum xxxRequestType { //wl3600_todo out RT_UNDEFINED = 0, RT_USER = 1, RT_ALTER_INDEX = 2, RT_SYSTEMRESTART = 3, RT_DICT_PREPARE = 1 << 4, RT_DICT_TC = 5 << 4, RT_DICT_TRIX = 7 << 4, RT_DICT_TUX = 8 << 4, RT_DICT_COMMIT = 0xC << 4, RT_DICT_ABORT = 0xF << 4, RT_TRIX = 7 << 8 }; STATIC_CONST( SignalLength = 9 ); STATIC_CONST( INDEX_COLUMNS = 0 ); STATIC_CONST( KEY_COLUMNS = 1 ); STATIC_CONST( NoOfSections = 2 ); Uint32 senderRef; Uint32 senderData; Uint32 requestType; Uint32 buildId; // Suma subscription id Uint32 buildKey; // Suma subscription key Uint32 tableId; Uint32 indexId; Uint32 indexType; Uint32 parallelism; #if wl3600_todo //out // Sent data ends here wl3600_todo removeski Uint32 m_slack[25 - SignalLength - 1]; Uint32 m_sectionBuffer[MAX_ATTRIBUTES_IN_TABLE * 2]; // Column order void setColumnOrder(Uint32* indexBuf, Uint32 indexLen, Uint32* keyBuf, Uint32 keyLen, struct LinearSectionPtr orderPtr[]); #endif }; #if wl3600_todo //out inline void BuildIndxImplReq::setColumnOrder(Uint32* indexBuf, Uint32 indexLen, Uint32* keyBuf, Uint32 keyLen, struct LinearSectionPtr orderPtr[]) { printf("BuildIndxImplReq::setColumnOrder: indexLen %u, keyLen %u\n", indexLen, keyLen); // Copy buffers MEMCOPY_NO_WORDS(m_sectionBuffer, indexBuf, indexLen); MEMCOPY_NO_WORDS(m_sectionBuffer + indexLen, keyBuf, keyLen); orderPtr[INDEX_COLUMNS].p = m_sectionBuffer; orderPtr[INDEX_COLUMNS].sz = indexLen; orderPtr[KEY_COLUMNS].p = m_sectionBuffer + indexLen; orderPtr[KEY_COLUMNS].sz = keyLen; } #endif struct BuildIndxImplConf { friend bool printBUILD_INDX_IMPL_CONF(FILE*, const Uint32*, Uint32, Uint16); STATIC_CONST( SignalLength = 3 ); Uint32 senderRef; Uint32 senderData; Uint32 requestType; }; struct BuildIndxImplRef { friend bool printBUILD_INDX_IMPL_REF(FILE*, const Uint32*, Uint32, Uint16); enum ErrorCode { NoError = 0, Busy = 701, NotMaster = 702, BadRequestType = 4247, InvalidPrimaryTable = 4249, InvalidIndexType = 4250, IndexNotUnique = 4251, AllocationFailure = 4252, InternalError = 4346 }; STATIC_CONST( SignalLength = 7 ); Uint32 senderRef; Uint32 senderData; Uint32 requestType; Uint32 errorCode; Uint32 errorLine; //wl3600_todo remove these from internal sigs Uint32 errorNodeId; //wl3600_todo or else add even errorBlockId ..... Uint32 masterNodeId; }; #endif --- 1.2/storage/ndb/src/common/debugger/signaldata/AlterIndxImpl.cpp 2007-01-14 12:39:54 +01:00 +++ 1.3/storage/ndb/src/common/debugger/signaldata/AlterIndxImpl.cpp 2007-01-25 13:30:51 +01:00 @@ -29,6 +29,7 @@ fprintf(output, "\n"); fprintf(output, " indexId: %x", sig->indexId); fprintf(output, " indexVersion: %x", sig->indexVersion); + fprintf(output, " indexType: %x", sig->indexType); fprintf(output, "\n"); return true; } --- New file --- +++ storage/ndb/src/common/debugger/signaldata/BuildIndx.cpp 07/01/22 12:15:48 /* 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 bool printBUILD_INDX_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn) { const BuildIndxReq* sig = (const BuildIndxReq*)theData; fprintf(output, " clientRef: %x", sig->clientRef); fprintf(output, " clientData: %x", sig->clientData); fprintf(output, "\n"); fprintf(output, " transId: %x", sig->transId); fprintf(output, " transKey: %x", sig->transKey); fprintf(output, " requestType: %x", sig->requestType); fprintf(output, "\n"); fprintf(output, " buildId: %x", sig->buildId); fprintf(output, " buildKey: %x", sig->buildKey); fprintf(output, "\n"); fprintf(output, " tableId: %x", sig->tableId); fprintf(output, " indexId: %x", sig->indexId); fprintf(output, " indexType: %x", sig->indexType); fprintf(output, " parallelism: %x", sig->parallelism); fprintf(output, "\n"); return true; } bool printBUILD_INDX_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn) { const BuildIndxConf* sig = (const BuildIndxConf*)theData; fprintf(output, " senderRef: %x", sig->senderRef); fprintf(output, " clientData: %x", sig->clientData); fprintf(output, "\n"); fprintf(output, " transId: %x", sig->transId); fprintf(output, " requestType: %x", sig->requestType); fprintf(output, "\n"); fprintf(output, " tableId: %x", sig->tableId); fprintf(output, " indexId: %x", sig->indexId); fprintf(output, " indexType: %x", sig->indexType); fprintf(output, "\n"); return true; } bool printBUILD_INDX_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn) { const BuildIndxRef* sig = (const BuildIndxRef*)theData; fprintf(output, " senderRef: %x", sig->senderRef); fprintf(output, " clientData: %x", sig->clientData); fprintf(output, "\n"); fprintf(output, " transId: %x", sig->transId); fprintf(output, " requestType: %x", sig->requestType); fprintf(output, "\n"); fprintf(output, " tableId: %x", sig->tableId); fprintf(output, " indexType: %x", sig->indexType); fprintf(output, " indexId: %x", sig->indexId); fprintf(output, "\n"); fprintf(output, " errorCode: %u", sig->errorCode); fprintf(output, " errorLine: %u", sig->errorLine); fprintf(output, " errorNodeId: %u", sig->errorNodeId); fprintf(output, " masterNodeId: %u", sig->masterNodeId); fprintf(output, "\n"); return true; } --- New file --- +++ storage/ndb/src/common/debugger/signaldata/BuildIndxImpl.cpp 07/01/22 12:15:48 /* 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 bool printBUILD_INDX_IMPL_REQ(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn) { const BuildIndxImplReq* sig = (const BuildIndxImplReq*)theData; fprintf(output, " senderRef: %x", sig->senderRef); fprintf(output, " senderData: %x", sig->senderData); fprintf(output, "\n"); fprintf(output, " requestType: %x", sig->requestType); fprintf(output, " buildId: %x", sig->buildId); fprintf(output, " buildKey: %x", sig->buildKey); fprintf(output, "\n"); fprintf(output, " tableId: %x", sig->tableId); fprintf(output, " indexId: %x", sig->indexId); fprintf(output, " indexType: %x", sig->indexType); fprintf(output, "\n"); fprintf(output, " parallelism: %x", sig->parallelism); fprintf(output, "\n"); return true; } bool printBUILD_INDX_IMPL_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn) { const BuildIndxImplConf* sig = (const BuildIndxImplConf*)theData; fprintf(output, " senderRef: %x", sig->senderRef); fprintf(output, " senderData: %x", sig->senderData); fprintf(output, " requestType: %x", sig->requestType); fprintf(output, "\n"); return true; } bool printBUILD_INDX_IMPL_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn) { const BuildIndxImplRef* sig = (const BuildIndxImplRef*)theData; fprintf(output, " senderRef: %x", sig->senderRef); fprintf(output, " senderData: %x", sig->senderData); fprintf(output, " requestType: %x", sig->requestType); fprintf(output, "\n"); fprintf(output, " errorCode: %u", sig->errorCode); fprintf(output, " errorLine: %u", sig->errorLine); fprintf(output, " errorNodeId: %u", sig->errorNodeId); fprintf(output, " masterNodeId: %u", sig->masterNodeId); fprintf(output, "\n"); return true; } --- 1.11/storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp 2007-01-24 15:53:43 +01:00 +++ 1.12/storage/ndb/src/common/debugger/signaldata/SchemaTransImpl.cpp 2007-01-25 13:30:51 +01:00 @@ -80,8 +80,17 @@ case GSN_ALTER_INDX_IMPL_REQ: printALTER_INDX_IMPL_REQ(output, pb_data, pb_len, rbn); break; + case GSN_BUILD_INDX_IMPL_REQ: + printBUILD_INDX_IMPL_REQ(output, pb_data, pb_len, rbn); + break; case GSN_CREATE_TRIG_IMPL_REQ: printCREATE_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn); + break; + case GSN_DROP_TRIG_IMPL_REQ: + printDROP_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn); + break; + case GSN_ALTER_TRIG_IMPL_REQ: + printALTER_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn); break; default: { --- 1.19/storage/ndb/src/common/debugger/signaldata/Makefile.am 2007-01-18 13:18:45 +01:00 +++ 1.20/storage/ndb/src/common/debugger/signaldata/Makefile.am 2007-01-25 13:30:51 +01:00 @@ -28,7 +28,8 @@ SchemaTrans.cpp SchemaTransImpl.cpp \ GetTabInfo.cpp CreateTab.cpp DropTable.cpp \ CreateIndxImpl.cpp DropIndxImpl.cpp AlterIndxImpl.cpp \ - CreateTrigImpl.cpp DropTrigImpl.cpp AlterTrigImpl.cpp + CreateTrigImpl.cpp DropTrigImpl.cpp AlterTrigImpl.cpp \ + BuildIndx.cpp BuildIndxImpl.cpp include $(top_srcdir)/storage/ndb/config/common.mk.am include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am @@ -49,6 +50,7 @@ @$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES) @$(top_srcdir)/storage/ndb/config/win-sources $@ $(libsignaldataprint_la_SOURCES) @$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(LDADD) +