Commit af1ddc20 authored by pekka@mysql.com's avatar pekka@mysql.com

ndb - bug#9994 backpatch fixes from 5.0

      IGNORE on merge 4.1->5.0
parent 410043a8
...@@ -6,7 +6,7 @@ Next DBTUP 4013 ...@@ -6,7 +6,7 @@ Next DBTUP 4013
Next DBLQH 5042 Next DBLQH 5042
Next DBDICT 6006 Next DBDICT 6006
Next DBDIH 7174 Next DBDIH 7174
Next DBTC 8035 Next DBTC 8037
Next CMVMI 9000 Next CMVMI 9000
Next BACKUP 10022 Next BACKUP 10022
Next DBUTIL 11002 Next DBUTIL 11002
...@@ -406,8 +406,11 @@ Drop Table/Index: ...@@ -406,8 +406,11 @@ Drop Table/Index:
4001: Crash on REL_TABMEMREQ in TUP 4001: Crash on REL_TABMEMREQ in TUP
4002: Crash on DROP_TABFILEREQ in TUP 4002: Crash on DROP_TABFILEREQ in TUP
4003: Fail next trigger create in TUP 4003: Fail next trigger create in TUP
4004: Fail next trigger drop in TUP
8033: Fail next trigger create in TC 8033: Fail next trigger create in TC
8034: Fail next index create in TC 8034: Fail next index create in TC
8035: Fail next trigger drop in TC
8036: Fail next index drop in TC
System Restart: System Restart:
--------------- ---------------
......
...@@ -6740,14 +6740,16 @@ Dbdict::createIndex_sendReply(Signal* signal, OpCreateIndexPtr opPtr, ...@@ -6740,14 +6740,16 @@ Dbdict::createIndex_sendReply(Signal* signal, OpCreateIndexPtr opPtr,
CreateIndxRef* rep = (CreateIndxRef*)signal->getDataPtrSend(); CreateIndxRef* rep = (CreateIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_CREATE_INDX_CONF; Uint32 gsn = GSN_CREATE_INDX_CONF;
Uint32 length = CreateIndxConf::InternalLength; Uint32 length = CreateIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == CreateIndxReq::RT_DICT_ABORT) if (opPtr.p->m_requestType == CreateIndxReq::RT_DICT_ABORT)
sendRef = false; sendRef = false;
} else { } else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType()); rep->setRequestType(opPtr.p->m_request.getRequestType());
...@@ -6816,11 +6818,8 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) ...@@ -6816,11 +6818,8 @@ Dbdict::execDROP_INDX_REQ(Signal* signal)
goto error; goto error;
} }
if (tmp.p->indexState == TableRecord::IS_DROPPING){ if (tmp.p->indexState != TableRecord::IS_ONLINE)
jam(); req->addRequestFlag(RequestFlag::RF_FORCE);
err = DropIndxRef::IndexNotFound;
goto error;
}
tmp.p->indexState = TableRecord::IS_DROPPING; tmp.p->indexState = TableRecord::IS_DROPPING;
...@@ -7083,14 +7082,16 @@ Dbdict::dropIndex_sendReply(Signal* signal, OpDropIndexPtr opPtr, ...@@ -7083,14 +7082,16 @@ Dbdict::dropIndex_sendReply(Signal* signal, OpDropIndexPtr opPtr,
DropIndxRef* rep = (DropIndxRef*)signal->getDataPtrSend(); DropIndxRef* rep = (DropIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_DROP_INDX_CONF; Uint32 gsn = GSN_DROP_INDX_CONF;
Uint32 length = DropIndxConf::InternalLength; Uint32 length = DropIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == DropIndxReq::RT_DICT_ABORT) if (opPtr.p->m_requestType == DropIndxReq::RT_DICT_ABORT)
sendRef = false; sendRef = false;
} else { } else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType()); rep->setRequestType(opPtr.p->m_request.getRequestType());
...@@ -9607,7 +9608,7 @@ Dbdict::alterIndex_fromCreateTc(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9607,7 +9608,7 @@ Dbdict::alterIndex_fromCreateTc(Signal* signal, OpAlterIndexPtr opPtr)
{ {
jam(); jam();
// mark created in local TC // mark created in local TC
if (! opPtr.p->hasError()) { if (! opPtr.p->hasLastError()) {
TableRecordPtr indexPtr; TableRecordPtr indexPtr;
c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId()); c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId());
indexPtr.p->indexLocal |= TableRecord::IL_CREATED_TC; indexPtr.p->indexLocal |= TableRecord::IL_CREATED_TC;
...@@ -9623,9 +9624,10 @@ Dbdict::alterIndex_toDropTc(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9623,9 +9624,10 @@ Dbdict::alterIndex_toDropTc(Signal* signal, OpAlterIndexPtr opPtr)
jam(); jam();
TableRecordPtr indexPtr; TableRecordPtr indexPtr;
c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId()); c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId());
// broken index // broken index allowed if force
if (! (indexPtr.p->indexLocal & TableRecord::IL_CREATED_TC)) { if (! (indexPtr.p->indexLocal & TableRecord::IL_CREATED_TC)) {
jam(); jam();
ndbrequire(opPtr.p->m_requestFlag & RequestFlag::RF_FORCE);
alterIndex_sendReply(signal, opPtr, false); alterIndex_sendReply(signal, opPtr, false);
return; return;
} }
...@@ -9647,8 +9649,8 @@ Dbdict::alterIndex_fromDropTc(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9647,8 +9649,8 @@ Dbdict::alterIndex_fromDropTc(Signal* signal, OpAlterIndexPtr opPtr)
{ {
jam(); jam();
ndbrequire(opPtr.p->m_requestType == AlterIndxReq::RT_DICT_TC); ndbrequire(opPtr.p->m_requestType == AlterIndxReq::RT_DICT_TC);
if (! opPtr.p->hasError()) { // mark dropped locally
// mark dropped in local TC if (! opPtr.p->hasLastError()) {
TableRecordPtr indexPtr; TableRecordPtr indexPtr;
c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId()); c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId());
indexPtr.p->indexLocal &= ~TableRecord::IL_CREATED_TC; indexPtr.p->indexLocal &= ~TableRecord::IL_CREATED_TC;
...@@ -9786,51 +9788,46 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9786,51 +9788,46 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr)
req->setUserRef(reference()); req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
req->setRequestType(DropTrigReq::RT_ALTER_INDEX); req->setRequestType(DropTrigReq::RT_ALTER_INDEX);
req->addRequestFlag(opPtr.p->m_requestFlag);
req->setTableId(opPtr.p->m_request.getTableId()); req->setTableId(opPtr.p->m_request.getTableId());
req->setIndexId(opPtr.p->m_request.getIndexId()); req->setIndexId(opPtr.p->m_request.getIndexId());
req->setTriggerInfo(0); // not used req->setTriggerInfo(0); // not used
opPtr.p->m_triggerCounter = 0; opPtr.p->m_triggerCounter = 0;
// insert if (indexPtr.p->isHashIndex()) {
if (indexPtr.p->insertTriggerId != RNIL) { // insert
req->setTriggerId(indexPtr.p->insertTriggerId); req->setTriggerId(indexPtr.p->insertTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ, sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB); signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++; opPtr.p->m_triggerCounter++;
} // update
// update
if (indexPtr.p->updateTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->updateTriggerId); req->setTriggerId(indexPtr.p->updateTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ, sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB); signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++; opPtr.p->m_triggerCounter++;
} // delete
// delete
if (indexPtr.p->deleteTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->deleteTriggerId); req->setTriggerId(indexPtr.p->deleteTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ, sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB); signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++; opPtr.p->m_triggerCounter++;
// build
if (indexPtr.p->buildTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->buildTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
}
return;
} }
// custom if (indexPtr.p->isOrderedIndex()) {
if (indexPtr.p->customTriggerId != RNIL) { // custom
req->addRequestFlag(RequestFlag::RF_NOTCTRIGGER);
req->setTriggerId(indexPtr.p->customTriggerId); req->setTriggerId(indexPtr.p->customTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ, sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB); signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++; opPtr.p->m_triggerCounter++;
return;
} }
// build ndbrequire(false);
if (indexPtr.p->buildTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->buildTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
}
if (opPtr.p->m_triggerCounter == 0) {
// drop in each TC
jam();
opPtr.p->m_requestType = AlterIndxReq::RT_DICT_TC;
alterIndex_sendSlaveReq(signal, opPtr);
}
} }
void void
...@@ -9948,14 +9945,16 @@ Dbdict::alterIndex_sendReply(Signal* signal, OpAlterIndexPtr opPtr, ...@@ -9948,14 +9945,16 @@ Dbdict::alterIndex_sendReply(Signal* signal, OpAlterIndexPtr opPtr,
AlterIndxRef* rep = (AlterIndxRef*)signal->getDataPtrSend(); AlterIndxRef* rep = (AlterIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_ALTER_INDX_CONF; Uint32 gsn = GSN_ALTER_INDX_CONF;
Uint32 length = AlterIndxConf::InternalLength; Uint32 length = AlterIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == AlterIndxReq::RT_DICT_ABORT) if (opPtr.p->m_requestType == AlterIndxReq::RT_DICT_ABORT)
sendRef = false; sendRef = false;
} else { } else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType()); rep->setRequestType(opPtr.p->m_request.getRequestType());
...@@ -10368,8 +10367,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr) ...@@ -10368,8 +10367,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr)
req->setUserRef(reference()); req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TC) { if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TC) {
jam();
req->setRequestType(AlterIndxReq::RT_TC); req->setRequestType(AlterIndxReq::RT_TC);
} else if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TUX) { } else if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TUX) {
jam();
req->setRequestType(AlterIndxReq::RT_TUX); req->setRequestType(AlterIndxReq::RT_TUX);
} else { } else {
ndbrequire(false); ndbrequire(false);
...@@ -10380,8 +10381,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr) ...@@ -10380,8 +10381,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr)
req->setOnline(true); req->setOnline(true);
BlockReference blockRef = 0; BlockReference blockRef = 0;
if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TC) { if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TC) {
jam();
blockRef = calcTcBlockRef(getOwnNodeId()); blockRef = calcTcBlockRef(getOwnNodeId());
} else if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TUX) { } else if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TUX) {
jam();
blockRef = calcTuxBlockRef(getOwnNodeId()); blockRef = calcTuxBlockRef(getOwnNodeId());
} else { } else {
ndbrequire(false); ndbrequire(false);
...@@ -10408,15 +10411,14 @@ Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr) ...@@ -10408,15 +10411,14 @@ Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr)
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
req->setRequestType(opPtr.p->m_requestType); req->setRequestType(opPtr.p->m_requestType);
req->addRequestFlag(opPtr.p->m_requestFlag); req->addRequestFlag(opPtr.p->m_requestFlag);
if(opPtr.p->m_requestFlag & RequestFlag::RF_LOCAL) if(opPtr.p->m_requestFlag & RequestFlag::RF_LOCAL) {
{ jam();
opPtr.p->m_signalCounter.clearWaitingFor(); opPtr.p->m_signalCounter.clearWaitingFor();
opPtr.p->m_signalCounter.setWaitingFor(getOwnNodeId()); opPtr.p->m_signalCounter.setWaitingFor(getOwnNodeId());
sendSignal(reference(), GSN_BUILDINDXREQ, sendSignal(reference(), GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB); signal, BuildIndxReq::SignalLength, JBB);
} } else {
else jam();
{
opPtr.p->m_signalCounter = c_aliveNodes; opPtr.p->m_signalCounter = c_aliveNodes;
NodeReceiverGroup rg(DBDICT, c_aliveNodes); NodeReceiverGroup rg(DBDICT, c_aliveNodes);
sendSignal(rg, GSN_BUILDINDXREQ, sendSignal(rg, GSN_BUILDINDXREQ,
...@@ -10431,14 +10433,16 @@ Dbdict::buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr, ...@@ -10431,14 +10433,16 @@ Dbdict::buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr,
BuildIndxRef* rep = (BuildIndxRef*)signal->getDataPtrSend(); BuildIndxRef* rep = (BuildIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_BUILDINDXCONF; Uint32 gsn = GSN_BUILDINDXCONF;
Uint32 length = BuildIndxConf::InternalLength; Uint32 length = BuildIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_ABORT) if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_ABORT)
sendRef = false; sendRef = false;
} else { } else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType()); rep->setRequestType(opPtr.p->m_request.getRequestType());
...@@ -10925,14 +10929,16 @@ Dbdict::createTrigger_sendReply(Signal* signal, OpCreateTriggerPtr opPtr, ...@@ -10925,14 +10929,16 @@ Dbdict::createTrigger_sendReply(Signal* signal, OpCreateTriggerPtr opPtr,
CreateTrigRef* rep = (CreateTrigRef*)signal->getDataPtrSend(); CreateTrigRef* rep = (CreateTrigRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_CREATE_TRIG_CONF; Uint32 gsn = GSN_CREATE_TRIG_CONF;
Uint32 length = CreateTrigConf::InternalLength; Uint32 length = CreateTrigConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == CreateTrigReq::RT_DICT_ABORT) if (opPtr.p->m_requestType == CreateTrigReq::RT_DICT_ABORT)
sendRef = false; sendRef = false;
} else { } else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType()); rep->setRequestType(opPtr.p->m_request.getRequestType());
...@@ -11020,8 +11026,10 @@ Dbdict::execDROP_TRIG_REQ(Signal* signal) ...@@ -11020,8 +11026,10 @@ Dbdict::execDROP_TRIG_REQ(Signal* signal)
OpDropTrigger opBad; OpDropTrigger opBad;
opPtr.p = &opBad; opPtr.p = &opBad;
opPtr.p->save(req); opPtr.p->save(req);
opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound; if (! (req->getRequestFlag() & RequestFlag::RF_FORCE)) {
opPtr.p->m_errorLine = __LINE__; opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound;
opPtr.p->m_errorLine = __LINE__;
}
dropTrigger_sendReply(signal, opPtr, true); dropTrigger_sendReply(signal, opPtr, true);
return; return;
} }
...@@ -11188,6 +11196,7 @@ Dbdict::dropTrigger_toAlterTrigger(Signal* signal, OpDropTriggerPtr opPtr) ...@@ -11188,6 +11196,7 @@ Dbdict::dropTrigger_toAlterTrigger(Signal* signal, OpDropTriggerPtr opPtr)
req->setUserRef(reference()); req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
req->setRequestType(AlterTrigReq::RT_DROP_TRIGGER); req->setRequestType(AlterTrigReq::RT_DROP_TRIGGER);
req->addRequestFlag(opPtr.p->m_requestFlag);
req->setTableId(opPtr.p->m_request.getTableId()); req->setTableId(opPtr.p->m_request.getTableId());
req->setTriggerId(opPtr.p->m_request.getTriggerId()); req->setTriggerId(opPtr.p->m_request.getTriggerId());
req->setTriggerInfo(0); // not used req->setTriggerInfo(0); // not used
...@@ -11283,14 +11292,16 @@ Dbdict::dropTrigger_sendReply(Signal* signal, OpDropTriggerPtr opPtr, ...@@ -11283,14 +11292,16 @@ Dbdict::dropTrigger_sendReply(Signal* signal, OpDropTriggerPtr opPtr,
DropTrigRef* rep = (DropTrigRef*)signal->getDataPtrSend(); DropTrigRef* rep = (DropTrigRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_DROP_TRIG_CONF; Uint32 gsn = GSN_DROP_TRIG_CONF;
Uint32 length = DropTrigConf::InternalLength; Uint32 length = DropTrigConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == DropTrigReq::RT_DICT_ABORT) if (opPtr.p->m_requestType == DropTrigReq::RT_DICT_ABORT)
sendRef = false; sendRef = false;
} else { } else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType()); rep->setRequestType(opPtr.p->m_request.getRequestType());
...@@ -11514,28 +11525,37 @@ Dbdict::alterTrigger_recvReply(Signal* signal, const AlterTrigConf* conf, ...@@ -11514,28 +11525,37 @@ Dbdict::alterTrigger_recvReply(Signal* signal, const AlterTrigConf* conf,
if (! (opPtr.p->m_request.getRequestFlag() & RequestFlag::RF_NOTCTRIGGER)) { if (! (opPtr.p->m_request.getRequestFlag() & RequestFlag::RF_NOTCTRIGGER)) {
if (requestType == AlterTrigReq::RT_DICT_PREPARE) { if (requestType == AlterTrigReq::RT_DICT_PREPARE) {
jam(); jam();
if (opPtr.p->m_request.getOnline()) if (opPtr.p->m_request.getOnline()) {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_TC; opPtr.p->m_requestType = AlterTrigReq::RT_DICT_TC;
else } else {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_LQH; opPtr.p->m_requestType = AlterTrigReq::RT_DICT_LQH;
}
alterTrigger_sendSlaveReq(signal, opPtr); alterTrigger_sendSlaveReq(signal, opPtr);
return; return;
} }
if (requestType == AlterTrigReq::RT_DICT_TC) { if (requestType == AlterTrigReq::RT_DICT_TC) {
jam(); jam();
if (opPtr.p->m_request.getOnline()) if (opPtr.p->m_request.getOnline()) {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_LQH; opPtr.p->m_requestType = AlterTrigReq::RT_DICT_LQH;
else } else {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_COMMIT; opPtr.p->m_requestType = AlterTrigReq::RT_DICT_COMMIT;
}
alterTrigger_sendSlaveReq(signal, opPtr); alterTrigger_sendSlaveReq(signal, opPtr);
return; return;
} }
if (requestType == AlterTrigReq::RT_DICT_LQH) { if (requestType == AlterTrigReq::RT_DICT_LQH) {
jam(); jam();
if (opPtr.p->m_request.getOnline()) if (opPtr.p->m_request.getOnline()) {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_COMMIT; opPtr.p->m_requestType = AlterTrigReq::RT_DICT_COMMIT;
else } else {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_TC; opPtr.p->m_requestType = AlterTrigReq::RT_DICT_TC;
}
alterTrigger_sendSlaveReq(signal, opPtr); alterTrigger_sendSlaveReq(signal, opPtr);
return; return;
} }
...@@ -11595,8 +11615,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11595,8 +11615,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setUserRef(reference()); req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) { if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
req->setRequestType(CreateTrigReq::RT_TC); req->setRequestType(CreateTrigReq::RT_TC);
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) { } else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
req->setRequestType(CreateTrigReq::RT_LQH); req->setRequestType(CreateTrigReq::RT_LQH);
} else { } else {
ndbassert(false); ndbassert(false);
...@@ -11613,8 +11635,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11613,8 +11635,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setReceiverRef(opPtr.p->m_request.getReceiverRef()); req->setReceiverRef(opPtr.p->m_request.getReceiverRef());
BlockReference blockRef = 0; BlockReference blockRef = 0;
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) { if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
blockRef = calcTcBlockRef(getOwnNodeId()); blockRef = calcTcBlockRef(getOwnNodeId());
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) { } else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
blockRef = calcLqhBlockRef(getOwnNodeId()); blockRef = calcLqhBlockRef(getOwnNodeId());
} else { } else {
ndbassert(false); ndbassert(false);
...@@ -11628,13 +11652,15 @@ void ...@@ -11628,13 +11652,15 @@ void
Dbdict::alterTrigger_fromCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr) Dbdict::alterTrigger_fromCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr)
{ {
jam(); jam();
if (! opPtr.p->hasError()) { if (! opPtr.p->hasLastError()) {
// mark created locally // mark created locally
TriggerRecordPtr triggerPtr; TriggerRecordPtr triggerPtr;
c_triggerRecordPool.getPtr(triggerPtr, opPtr.p->m_request.getTriggerId()); c_triggerRecordPool.getPtr(triggerPtr, opPtr.p->m_request.getTriggerId());
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) { if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
triggerPtr.p->triggerLocal |= TriggerRecord::TL_CREATED_TC; triggerPtr.p->triggerLocal |= TriggerRecord::TL_CREATED_TC;
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) { } else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
triggerPtr.p->triggerLocal |= TriggerRecord::TL_CREATED_LQH; triggerPtr.p->triggerLocal |= TriggerRecord::TL_CREATED_LQH;
} else { } else {
ndbrequire(false); ndbrequire(false);
...@@ -11654,17 +11680,21 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11654,17 +11680,21 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setUserRef(reference()); req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key); req->setConnectionPtr(opPtr.p->key);
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) { if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
// broken trigger jam();
// broken trigger allowed if force
if (! (triggerPtr.p->triggerLocal & TriggerRecord::TL_CREATED_TC)) { if (! (triggerPtr.p->triggerLocal & TriggerRecord::TL_CREATED_TC)) {
jam(); jam();
ndbrequire(opPtr.p->m_requestFlag & RequestFlag::RF_FORCE);
alterTrigger_sendReply(signal, opPtr, false); alterTrigger_sendReply(signal, opPtr, false);
return; return;
} }
req->setRequestType(DropTrigReq::RT_TC); req->setRequestType(DropTrigReq::RT_TC);
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) { } else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
// broken trigger jam();
// broken trigger allowed if force
if (! (triggerPtr.p->triggerLocal & TriggerRecord::TL_CREATED_LQH)) { if (! (triggerPtr.p->triggerLocal & TriggerRecord::TL_CREATED_LQH)) {
jam(); jam();
ndbrequire(opPtr.p->m_requestFlag & RequestFlag::RF_FORCE);
alterTrigger_sendReply(signal, opPtr, false); alterTrigger_sendReply(signal, opPtr, false);
return; return;
} }
...@@ -11682,8 +11712,10 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11682,8 +11712,10 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setMonitorAllAttributes(triggerPtr.p->monitorAllAttributes); req->setMonitorAllAttributes(triggerPtr.p->monitorAllAttributes);
BlockReference blockRef = 0; BlockReference blockRef = 0;
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) { if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
blockRef = calcTcBlockRef(getOwnNodeId()); blockRef = calcTcBlockRef(getOwnNodeId());
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) { } else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
blockRef = calcLqhBlockRef(getOwnNodeId()); blockRef = calcLqhBlockRef(getOwnNodeId());
} else { } else {
ndbassert(false); ndbassert(false);
...@@ -11696,13 +11728,15 @@ void ...@@ -11696,13 +11728,15 @@ void
Dbdict::alterTrigger_fromDropLocal(Signal* signal, OpAlterTriggerPtr opPtr) Dbdict::alterTrigger_fromDropLocal(Signal* signal, OpAlterTriggerPtr opPtr)
{ {
jam(); jam();
if (! opPtr.p->hasError()) { if (! opPtr.p->hasLastError()) {
// mark dropped locally // mark dropped locally
TriggerRecordPtr triggerPtr; TriggerRecordPtr triggerPtr;
c_triggerRecordPool.getPtr(triggerPtr, opPtr.p->m_request.getTriggerId()); c_triggerRecordPool.getPtr(triggerPtr, opPtr.p->m_request.getTriggerId());
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) { if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
triggerPtr.p->triggerLocal &= ~TriggerRecord::TL_CREATED_TC; triggerPtr.p->triggerLocal &= ~TriggerRecord::TL_CREATED_TC;
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) { } else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
triggerPtr.p->triggerLocal &= ~TriggerRecord::TL_CREATED_LQH; triggerPtr.p->triggerLocal &= ~TriggerRecord::TL_CREATED_LQH;
} else { } else {
ndbrequire(false); ndbrequire(false);
...@@ -11759,8 +11793,9 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, ...@@ -11759,8 +11793,9 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr,
AlterTrigRef* rep = (AlterTrigRef*)signal->getDataPtrSend(); AlterTrigRef* rep = (AlterTrigRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_ALTER_TRIG_CONF; Uint32 gsn = GSN_ALTER_TRIG_CONF;
Uint32 length = AlterTrigConf::InternalLength; Uint32 length = AlterTrigConf::InternalLength;
bool sendRef = opPtr.p->hasError(); bool sendRef;
if (! toUser) { if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef); rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key); rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType); rep->setRequestType(opPtr.p->m_requestType);
...@@ -11771,6 +11806,7 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, ...@@ -11771,6 +11806,7 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr,
jam(); jam();
} }
} else { } else {
sendRef = opPtr.p->hasError();
jam(); jam();
rep->setUserRef(opPtr.p->m_request.getUserRef()); rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr()); rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
......
...@@ -924,7 +924,8 @@ private: ...@@ -924,7 +924,8 @@ private:
enum { enum {
RF_LOCAL = 1 << 0, // create on local node only RF_LOCAL = 1 << 0, // create on local node only
RF_NOBUILD = 1 << 1, // no need to build index RF_NOBUILD = 1 << 1, // no need to build index
RF_NOTCTRIGGER = 1 << 2 // alter trigger: no trigger in TC RF_NOTCTRIGGER = 1 << 2, // alter trigger: no trigger in TC
RF_FORCE = 1 << 4 // force drop
}; };
}; };
...@@ -944,6 +945,7 @@ private: ...@@ -944,6 +945,7 @@ private:
CreateIndxReq::RequestType m_requestType; CreateIndxReq::RequestType m_requestType;
Uint32 m_requestFlag; Uint32 m_requestFlag;
// error info // error info
CreateIndxRef::ErrorCode m_lastError;
CreateIndxRef::ErrorCode m_errorCode; CreateIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -955,6 +957,7 @@ private: ...@@ -955,6 +957,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = CreateIndxReq::RT_UNDEFINED; m_requestType = CreateIndxReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
m_lastError = CreateIndxRef::NoError;
m_errorCode = CreateIndxRef::NoError; m_errorCode = CreateIndxRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -964,34 +967,49 @@ private: ...@@ -964,34 +967,49 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != CreateIndxRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != CreateIndxRef::NoError; return m_errorCode != CreateIndxRef::NoError;
} }
void setError(const CreateIndxRef* ref) { void setError(const CreateIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = CreateIndxRef::NoError;
m_errorCode = ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const CreateTableRef* ref) { void setError(const CreateTableRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = CreateIndxRef::NoError;
if (ref != 0) {
switch (ref->getErrorCode()) { switch (ref->getErrorCode()) {
case CreateTableRef::TableAlreadyExist: case CreateTableRef::TableAlreadyExist:
m_errorCode = CreateIndxRef::IndexExists; m_lastError = CreateIndxRef::IndexExists;
break; break;
default: default:
m_errorCode = (CreateIndxRef::ErrorCode)ref->getErrorCode(); m_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
break; break;
} }
m_errorLine = ref->getErrorLine(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
}
} }
} }
void setError(const AlterIndxRef* ref) { void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = CreateIndxRef::NoError;
m_errorCode = (CreateIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
}; };
...@@ -1010,6 +1028,7 @@ private: ...@@ -1010,6 +1028,7 @@ private:
DropIndxReq::RequestType m_requestType; DropIndxReq::RequestType m_requestType;
Uint32 m_requestFlag; Uint32 m_requestFlag;
// error info // error info
DropIndxRef::ErrorCode m_lastError;
DropIndxRef::ErrorCode m_errorCode; DropIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -1021,6 +1040,7 @@ private: ...@@ -1021,6 +1040,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = DropIndxReq::RT_UNDEFINED; m_requestType = DropIndxReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
m_lastError = DropIndxRef::NoError;
m_errorCode = DropIndxRef::NoError; m_errorCode = DropIndxRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -1030,44 +1050,59 @@ private: ...@@ -1030,44 +1050,59 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != DropIndxRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != DropIndxRef::NoError; return m_errorCode != DropIndxRef::NoError;
} }
void setError(const DropIndxRef* ref) { void setError(const DropIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = DropIndxRef::NoError;
m_errorCode = ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = ref->getErrorCode();
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const AlterIndxRef* ref) { void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = DropIndxRef::NoError;
m_errorCode = (DropIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (DropIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const DropTableRef* ref) { void setError(const DropTableRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = DropIndxRef::NoError;
switch(ref->errorCode) { if (ref != 0) {
case(DropTableRef::Busy): switch (ref->errorCode) {
m_errorCode = DropIndxRef::Busy; case DropTableRef::Busy:
m_lastError = DropIndxRef::Busy;
break; break;
case(DropTableRef::NoSuchTable): case DropTableRef::NoSuchTable:
m_errorCode = DropIndxRef::IndexNotFound; m_lastError = DropIndxRef::IndexNotFound;
break; break;
case(DropTableRef::DropInProgress): case DropTableRef::DropInProgress:
m_errorCode = DropIndxRef::Busy; m_lastError = DropIndxRef::Busy;
break; break;
case(DropTableRef::NoDropTableRecordAvailable): case DropTableRef::NoDropTableRecordAvailable:
m_errorCode = DropIndxRef::Busy; m_lastError = DropIndxRef::Busy;
break; break;
default: default:
m_errorCode = (DropIndxRef::ErrorCode)ref->errorCode; m_lastError = (DropIndxRef::ErrorCode)ref->errorCode;
break; break;
} }
//m_errorLine = ref->getErrorLine(); if (! hasError()) {
//m_errorNode = ref->getErrorNode(); m_errorCode = m_lastError;
m_errorLine = 0;
m_errorNode = 0;
}
} }
} }
}; };
...@@ -1088,6 +1123,7 @@ private: ...@@ -1088,6 +1123,7 @@ private:
AlterIndxReq::RequestType m_requestType; AlterIndxReq::RequestType m_requestType;
Uint32 m_requestFlag; Uint32 m_requestFlag;
// error info // error info
AlterIndxRef::ErrorCode m_lastError;
AlterIndxRef::ErrorCode m_errorCode; AlterIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -1100,6 +1136,7 @@ private: ...@@ -1100,6 +1136,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = AlterIndxReq::RT_UNDEFINED; m_requestType = AlterIndxReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
m_lastError = AlterIndxRef::NoError;
m_errorCode = AlterIndxRef::NoError; m_errorCode = AlterIndxRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -1110,47 +1147,76 @@ private: ...@@ -1110,47 +1147,76 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != AlterIndxRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != AlterIndxRef::NoError; return m_errorCode != AlterIndxRef::NoError;
} }
void setError(const AlterIndxRef* ref) { void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterIndxRef::NoError;
m_errorCode = ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const CreateIndxRef* ref) { void setError(const CreateIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterIndxRef::NoError;
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const DropIndxRef* ref) { void setError(const DropIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterIndxRef::NoError;
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const BuildIndxRef* ref) { void setError(const BuildIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterIndxRef::NoError;
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = 0;
m_errorNode = 0;
}
} }
} }
void setError(const CreateTrigRef* ref) { void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterIndxRef::NoError;
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const DropTrigRef* ref) { void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterIndxRef::NoError;
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
}; };
...@@ -1172,6 +1238,7 @@ private: ...@@ -1172,6 +1238,7 @@ private:
Uint32 m_requestFlag; Uint32 m_requestFlag;
Uint32 m_constrTriggerId; Uint32 m_constrTriggerId;
// error info // error info
BuildIndxRef::ErrorCode m_lastError;
BuildIndxRef::ErrorCode m_errorCode; BuildIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -1183,7 +1250,7 @@ private: ...@@ -1183,7 +1250,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = BuildIndxReq::RT_UNDEFINED; m_requestType = BuildIndxReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
// Uint32 m_constrTriggerId = RNIL; m_lastError = BuildIndxRef::NoError;
m_errorCode = BuildIndxRef::NoError; m_errorCode = BuildIndxRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -1193,33 +1260,54 @@ private: ...@@ -1193,33 +1260,54 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != BuildIndxRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != BuildIndxRef::NoError; return m_errorCode != BuildIndxRef::NoError;
} }
void setError(const BuildIndxRef* ref) { void setError(const BuildIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = BuildIndxRef::NoError;
m_errorCode = ref->getErrorCode(); if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = 0;
m_errorNode = 0;
}
} }
} }
void setError(const AlterIndxRef* ref) { void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = BuildIndxRef::NoError;
m_errorCode = (BuildIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const CreateTrigRef* ref) { void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = BuildIndxRef::NoError;
m_errorCode = (BuildIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const DropTrigRef* ref) { void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = BuildIndxRef::NoError;
m_errorCode = (BuildIndxRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
}; };
...@@ -1352,6 +1440,7 @@ private: ...@@ -1352,6 +1440,7 @@ private:
CreateTrigReq::RequestType m_requestType; CreateTrigReq::RequestType m_requestType;
Uint32 m_requestFlag; Uint32 m_requestFlag;
// error info // error info
CreateTrigRef::ErrorCode m_lastError;
CreateTrigRef::ErrorCode m_errorCode; CreateTrigRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -1363,6 +1452,7 @@ private: ...@@ -1363,6 +1452,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = CreateTrigReq::RT_UNDEFINED; m_requestType = CreateTrigReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
m_lastError = CreateTrigRef::NoError;
m_errorCode = CreateTrigRef::NoError; m_errorCode = CreateTrigRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -1372,21 +1462,32 @@ private: ...@@ -1372,21 +1462,32 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != CreateTrigRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != CreateTrigRef::NoError; return m_errorCode != CreateTrigRef::NoError;
} }
void setError(const CreateTrigRef* ref) { void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = CreateTrigRef::NoError;
m_errorCode = ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const AlterTrigRef* ref) { void setError(const AlterTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = CreateTrigRef::NoError;
m_errorCode = (CreateTrigRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (CreateTrigRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
}; };
...@@ -1405,6 +1506,7 @@ private: ...@@ -1405,6 +1506,7 @@ private:
DropTrigReq::RequestType m_requestType; DropTrigReq::RequestType m_requestType;
Uint32 m_requestFlag; Uint32 m_requestFlag;
// error info // error info
DropTrigRef::ErrorCode m_lastError;
DropTrigRef::ErrorCode m_errorCode; DropTrigRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -1416,6 +1518,7 @@ private: ...@@ -1416,6 +1518,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = DropTrigReq::RT_UNDEFINED; m_requestType = DropTrigReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
m_lastError = DropTrigRef::NoError;
m_errorCode = DropTrigRef::NoError; m_errorCode = DropTrigRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -1425,21 +1528,32 @@ private: ...@@ -1425,21 +1528,32 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != DropTrigRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != DropTrigRef::NoError; return m_errorCode != DropTrigRef::NoError;
} }
void setError(const DropTrigRef* ref) { void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = DropTrigRef::NoError;
m_errorCode = ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const AlterTrigRef* ref) { void setError(const AlterTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = DropTrigRef::NoError;
m_errorCode = (DropTrigRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (DropTrigRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
}; };
...@@ -1460,6 +1574,7 @@ private: ...@@ -1460,6 +1574,7 @@ private:
AlterTrigReq::RequestType m_requestType; AlterTrigReq::RequestType m_requestType;
Uint32 m_requestFlag; Uint32 m_requestFlag;
// error info // error info
AlterTrigRef::ErrorCode m_lastError;
AlterTrigRef::ErrorCode m_errorCode; AlterTrigRef::ErrorCode m_errorCode;
Uint32 m_errorLine; Uint32 m_errorLine;
Uint32 m_errorNode; Uint32 m_errorNode;
...@@ -1471,6 +1586,7 @@ private: ...@@ -1471,6 +1586,7 @@ private:
m_coordinatorRef = 0; m_coordinatorRef = 0;
m_requestType = AlterTrigReq::RT_UNDEFINED; m_requestType = AlterTrigReq::RT_UNDEFINED;
m_requestFlag = 0; m_requestFlag = 0;
m_lastError = AlterTrigRef::NoError;
m_errorCode = AlterTrigRef::NoError; m_errorCode = AlterTrigRef::NoError;
m_errorLine = 0; m_errorLine = 0;
m_errorNode = 0; m_errorNode = 0;
...@@ -1480,28 +1596,43 @@ private: ...@@ -1480,28 +1596,43 @@ private:
m_requestType = req->getRequestType(); m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag(); m_requestFlag = req->getRequestFlag();
} }
bool hasLastError() {
return m_lastError != AlterTrigRef::NoError;
}
bool hasError() { bool hasError() {
return m_errorCode != AlterTrigRef::NoError; return m_errorCode != AlterTrigRef::NoError;
} }
void setError(const AlterTrigRef* ref) { void setError(const AlterTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterTrigRef::NoError;
m_errorCode = (AlterTrigRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const CreateTrigRef* ref) { void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterTrigRef::NoError;
m_errorCode = (AlterTrigRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
void setError(const DropTrigRef* ref) { void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) { m_lastError = AlterTrigRef::NoError;
m_errorCode = (AlterTrigRef::ErrorCode)ref->getErrorCode(); if (ref != 0) {
m_errorLine = ref->getErrorLine(); m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
m_errorNode = ref->getErrorNode(); if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
} }
} }
}; };
......
...@@ -10833,6 +10833,7 @@ void Dbtc::execCREATE_TRIG_REQ(Signal* signal) ...@@ -10833,6 +10833,7 @@ void Dbtc::execCREATE_TRIG_REQ(Signal* signal)
if (ERROR_INSERTED(8033) || if (ERROR_INSERTED(8033) ||
!c_theDefinedTriggers.seizeId(triggerPtr, !c_theDefinedTriggers.seizeId(triggerPtr,
createTrigReq->getTriggerId())) { createTrigReq->getTriggerId())) {
jam();
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
// Failed to allocate trigger record // Failed to allocate trigger record
CreateTrigRef * const createTrigRef = CreateTrigRef * const createTrigRef =
...@@ -10867,8 +10868,10 @@ void Dbtc::execDROP_TRIG_REQ(Signal* signal) ...@@ -10867,8 +10868,10 @@ void Dbtc::execDROP_TRIG_REQ(Signal* signal)
DropTrigReq * const dropTrigReq = (DropTrigReq *)&signal->theData[0]; DropTrigReq * const dropTrigReq = (DropTrigReq *)&signal->theData[0];
BlockReference sender = signal->senderBlockRef(); BlockReference sender = signal->senderBlockRef();
if ((c_theDefinedTriggers.getPtr(dropTrigReq->getTriggerId())) == NULL) { if (ERROR_INSERTED(8035) ||
(c_theDefinedTriggers.getPtr(dropTrigReq->getTriggerId())) == NULL) {
jam(); jam();
CLEAR_ERROR_INSERT_VALUE;
// Failed to find find trigger record // Failed to find find trigger record
DropTrigRef * const dropTrigRef = (DropTrigRef *)&signal->theData[0]; DropTrigRef * const dropTrigRef = (DropTrigRef *)&signal->theData[0];
...@@ -10900,6 +10903,7 @@ void Dbtc::execCREATE_INDX_REQ(Signal* signal) ...@@ -10900,6 +10903,7 @@ void Dbtc::execCREATE_INDX_REQ(Signal* signal)
if (ERROR_INSERTED(8034) || if (ERROR_INSERTED(8034) ||
!c_theIndexes.seizeId(indexPtr, createIndxReq->getIndexId())) { !c_theIndexes.seizeId(indexPtr, createIndxReq->getIndexId())) {
jam();
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
// Failed to allocate index record // Failed to allocate index record
CreateIndxRef * const createIndxRef = CreateIndxRef * const createIndxRef =
...@@ -11111,8 +11115,10 @@ void Dbtc::execDROP_INDX_REQ(Signal* signal) ...@@ -11111,8 +11115,10 @@ void Dbtc::execDROP_INDX_REQ(Signal* signal)
TcIndexData* indexData; TcIndexData* indexData;
BlockReference sender = signal->senderBlockRef(); BlockReference sender = signal->senderBlockRef();
if ((indexData = c_theIndexes.getPtr(dropIndxReq->getIndexId())) == NULL) { if (ERROR_INSERTED(8036) ||
(indexData = c_theIndexes.getPtr(dropIndxReq->getIndexId())) == NULL) {
jam(); jam();
CLEAR_ERROR_INSERT_VALUE;
// Failed to find index record // Failed to find index record
DropIndxRef * const dropIndxRef = DropIndxRef * const dropIndxRef =
(DropIndxRef *)signal->getDataPtrSend(); (DropIndxRef *)signal->getDataPtrSend();
......
...@@ -305,6 +305,10 @@ Dbtup::primaryKey(Tablerec* const regTabPtr, Uint32 attrId) ...@@ -305,6 +305,10 @@ Dbtup::primaryKey(Tablerec* const regTabPtr, Uint32 attrId)
Uint32 Uint32
Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req) Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req)
{ {
if (ERROR_INSERTED(4004)) {
CLEAR_ERROR_INSERT_VALUE;
return 9999;
}
Uint32 triggerId = req->getTriggerId(); Uint32 triggerId = req->getTriggerId();
TriggerType::Value ttype = req->getTriggerType(); TriggerType::Value ttype = req->getTriggerType();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment