Commit 8cb9f0ef authored by pekka@mysql.com's avatar pekka@mysql.com

ndb - bug#11355 some fixes to index drop etc

parent 30feab4c
...@@ -408,10 +408,11 @@ Drop Table/Index: ...@@ -408,10 +408,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:
--------------- ---------------
......
...@@ -6781,14 +6781,16 @@ Dbdict::createIndex_sendReply(Signal* signal, OpCreateIndexPtr opPtr, ...@@ -6781,14 +6781,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());
...@@ -6857,11 +6859,8 @@ Dbdict::execDROP_INDX_REQ(Signal* signal) ...@@ -6857,11 +6859,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;
...@@ -7124,14 +7123,16 @@ Dbdict::dropIndex_sendReply(Signal* signal, OpDropIndexPtr opPtr, ...@@ -7124,14 +7123,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());
...@@ -9648,7 +9649,7 @@ Dbdict::alterIndex_fromCreateTc(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9648,7 +9649,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;
...@@ -9664,9 +9665,10 @@ Dbdict::alterIndex_toDropTc(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9664,9 +9665,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;
} }
...@@ -9688,8 +9690,8 @@ Dbdict::alterIndex_fromDropTc(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9688,8 +9690,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;
...@@ -9827,38 +9829,27 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9827,38 +9829,27 @@ 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;
if (indexPtr.p->isHashIndex()) {
// insert // insert
if (indexPtr.p->insertTriggerId != RNIL) {
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++;
}
// custom
if (indexPtr.p->customTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->customTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
}
// build // build
if (indexPtr.p->buildTriggerId != RNIL) { if (indexPtr.p->buildTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->buildTriggerId); req->setTriggerId(indexPtr.p->buildTriggerId);
...@@ -9866,12 +9857,18 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr) ...@@ -9866,12 +9857,18 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr)
signal, DropTrigReq::SignalLength, JBB); signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++; opPtr.p->m_triggerCounter++;
} }
if (opPtr.p->m_triggerCounter == 0) { return;
// drop in each TC }
jam(); if (indexPtr.p->isOrderedIndex()) {
opPtr.p->m_requestType = AlterIndxReq::RT_DICT_TC; // custom
alterIndex_sendSlaveReq(signal, opPtr); req->addRequestFlag(RequestFlag::RF_NOTCTRIGGER);
req->setTriggerId(indexPtr.p->customTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
return;
} }
ndbrequire(false);
} }
void void
...@@ -9989,14 +9986,16 @@ Dbdict::alterIndex_sendReply(Signal* signal, OpAlterIndexPtr opPtr, ...@@ -9989,14 +9986,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());
...@@ -10409,8 +10408,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr) ...@@ -10409,8 +10408,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);
...@@ -10421,8 +10422,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr) ...@@ -10421,8 +10422,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);
...@@ -10449,15 +10452,14 @@ Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr) ...@@ -10449,15 +10452,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,
...@@ -10472,14 +10474,16 @@ Dbdict::buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr, ...@@ -10472,14 +10474,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());
...@@ -10965,14 +10969,16 @@ Dbdict::createTrigger_sendReply(Signal* signal, OpCreateTriggerPtr opPtr, ...@@ -10965,14 +10969,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());
...@@ -11060,8 +11066,10 @@ Dbdict::execDROP_TRIG_REQ(Signal* signal) ...@@ -11060,8 +11066,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);
if (! (req->getRequestFlag() & RequestFlag::RF_FORCE)) {
opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound; opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound;
opPtr.p->m_errorLine = __LINE__; opPtr.p->m_errorLine = __LINE__;
}
dropTrigger_sendReply(signal, opPtr, true); dropTrigger_sendReply(signal, opPtr, true);
return; return;
} }
...@@ -11228,6 +11236,7 @@ Dbdict::dropTrigger_toAlterTrigger(Signal* signal, OpDropTriggerPtr opPtr) ...@@ -11228,6 +11236,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
...@@ -11323,14 +11332,16 @@ Dbdict::dropTrigger_sendReply(Signal* signal, OpDropTriggerPtr opPtr, ...@@ -11323,14 +11332,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());
...@@ -11554,28 +11565,37 @@ Dbdict::alterTrigger_recvReply(Signal* signal, const AlterTrigConf* conf, ...@@ -11554,28 +11565,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;
} }
...@@ -11630,8 +11650,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11630,8 +11650,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);
...@@ -11648,8 +11670,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11648,8 +11670,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);
...@@ -11663,13 +11687,15 @@ void ...@@ -11663,13 +11687,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);
...@@ -11689,17 +11715,21 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11689,17 +11715,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;
} }
...@@ -11717,8 +11747,10 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr) ...@@ -11717,8 +11747,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);
...@@ -11731,13 +11763,15 @@ void ...@@ -11731,13 +11763,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);
...@@ -11794,8 +11828,9 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, ...@@ -11794,8 +11828,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);
...@@ -11806,6 +11841,7 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr, ...@@ -11806,6 +11841,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());
......
...@@ -953,7 +953,8 @@ private: ...@@ -953,7 +953,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
}; };
}; };
...@@ -973,6 +974,7 @@ private: ...@@ -973,6 +974,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;
...@@ -984,6 +986,7 @@ private: ...@@ -984,6 +986,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;
...@@ -993,36 +996,51 @@ private: ...@@ -993,36 +996,51 @@ 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_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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;
} }
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); 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_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); m_errorNode = ref->getErrorNode();
} }
} }
}
}; };
typedef Ptr<OpCreateIndex> OpCreateIndexPtr; typedef Ptr<OpCreateIndex> OpCreateIndexPtr;
...@@ -1039,6 +1057,7 @@ private: ...@@ -1039,6 +1057,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;
...@@ -1050,6 +1069,7 @@ private: ...@@ -1050,6 +1069,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;
...@@ -1059,44 +1079,59 @@ private: ...@@ -1059,44 +1079,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;
if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = ref->getErrorCode(); m_errorCode = ref->getErrorCode();
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (DropIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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;
}
} }
} }
}; };
...@@ -1117,6 +1152,7 @@ private: ...@@ -1117,6 +1152,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;
...@@ -1129,6 +1165,7 @@ private: ...@@ -1129,6 +1165,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;
...@@ -1139,49 +1176,78 @@ private: ...@@ -1139,49 +1176,78 @@ 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_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); m_errorNode = ref->getErrorNode();
} }
} }
}
}; };
typedef Ptr<OpAlterIndex> OpAlterIndexPtr; typedef Ptr<OpAlterIndex> OpAlterIndexPtr;
...@@ -1201,6 +1267,7 @@ private: ...@@ -1201,6 +1267,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;
...@@ -1212,7 +1279,7 @@ private: ...@@ -1212,7 +1279,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;
...@@ -1222,35 +1289,56 @@ private: ...@@ -1222,35 +1289,56 @@ 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_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); m_errorNode = ref->getErrorNode();
} }
} }
}
}; };
typedef Ptr<OpBuildIndex> OpBuildIndexPtr; typedef Ptr<OpBuildIndex> OpBuildIndexPtr;
...@@ -1381,6 +1469,7 @@ private: ...@@ -1381,6 +1469,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;
...@@ -1392,6 +1481,7 @@ private: ...@@ -1392,6 +1481,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;
...@@ -1401,23 +1491,34 @@ private: ...@@ -1401,23 +1491,34 @@ 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_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (CreateTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); m_errorNode = ref->getErrorNode();
} }
} }
}
}; };
typedef Ptr<OpCreateTrigger> OpCreateTriggerPtr; typedef Ptr<OpCreateTrigger> OpCreateTriggerPtr;
...@@ -1434,6 +1535,7 @@ private: ...@@ -1434,6 +1535,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;
...@@ -1445,6 +1547,7 @@ private: ...@@ -1445,6 +1547,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;
...@@ -1454,23 +1557,34 @@ private: ...@@ -1454,23 +1557,34 @@ 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_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (DropTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); m_errorNode = ref->getErrorNode();
} }
} }
}
}; };
typedef Ptr<OpDropTrigger> OpDropTriggerPtr; typedef Ptr<OpDropTrigger> OpDropTriggerPtr;
...@@ -1489,6 +1603,7 @@ private: ...@@ -1489,6 +1603,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;
...@@ -1500,6 +1615,7 @@ private: ...@@ -1500,6 +1615,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;
...@@ -1509,30 +1625,45 @@ private: ...@@ -1509,30 +1625,45 @@ 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_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); 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_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine(); m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode(); m_errorNode = ref->getErrorNode();
} }
} }
}
}; };
typedef Ptr<OpAlterTrigger> OpAlterTriggerPtr; typedef Ptr<OpAlterTrigger> OpAlterTriggerPtr;
......
...@@ -11043,6 +11043,7 @@ void Dbtc::execCREATE_TRIG_REQ(Signal* signal) ...@@ -11043,6 +11043,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 =
...@@ -11077,8 +11078,10 @@ void Dbtc::execDROP_TRIG_REQ(Signal* signal) ...@@ -11077,8 +11078,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];
...@@ -11110,6 +11113,7 @@ void Dbtc::execCREATE_INDX_REQ(Signal* signal) ...@@ -11110,6 +11113,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 =
...@@ -11321,8 +11325,10 @@ void Dbtc::execDROP_INDX_REQ(Signal* signal) ...@@ -11321,8 +11325,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