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:
4001: Crash on REL_TABMEMREQ in TUP
4002: Crash on DROP_TABFILEREQ in TUP
4003: Fail next trigger create in TUP
4004: Fail next trigger drop in TUP
8033: Fail next trigger 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:
---------------
......
......@@ -6781,14 +6781,16 @@ Dbdict::createIndex_sendReply(Signal* signal, OpCreateIndexPtr opPtr,
CreateIndxRef* rep = (CreateIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_CREATE_INDX_CONF;
Uint32 length = CreateIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == CreateIndxReq::RT_DICT_ABORT)
sendRef = false;
} else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType());
......@@ -6857,11 +6859,8 @@ Dbdict::execDROP_INDX_REQ(Signal* signal)
goto error;
}
if (tmp.p->indexState == TableRecord::IS_DROPPING){
jam();
err = DropIndxRef::IndexNotFound;
goto error;
}
if (tmp.p->indexState != TableRecord::IS_ONLINE)
req->addRequestFlag(RequestFlag::RF_FORCE);
tmp.p->indexState = TableRecord::IS_DROPPING;
......@@ -7124,14 +7123,16 @@ Dbdict::dropIndex_sendReply(Signal* signal, OpDropIndexPtr opPtr,
DropIndxRef* rep = (DropIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_DROP_INDX_CONF;
Uint32 length = DropIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == DropIndxReq::RT_DICT_ABORT)
sendRef = false;
} else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType());
......@@ -9648,7 +9649,7 @@ Dbdict::alterIndex_fromCreateTc(Signal* signal, OpAlterIndexPtr opPtr)
{
jam();
// mark created in local TC
if (! opPtr.p->hasError()) {
if (! opPtr.p->hasLastError()) {
TableRecordPtr indexPtr;
c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId());
indexPtr.p->indexLocal |= TableRecord::IL_CREATED_TC;
......@@ -9664,9 +9665,10 @@ Dbdict::alterIndex_toDropTc(Signal* signal, OpAlterIndexPtr opPtr)
jam();
TableRecordPtr indexPtr;
c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId());
// broken index
// broken index allowed if force
if (! (indexPtr.p->indexLocal & TableRecord::IL_CREATED_TC)) {
jam();
ndbrequire(opPtr.p->m_requestFlag & RequestFlag::RF_FORCE);
alterIndex_sendReply(signal, opPtr, false);
return;
}
......@@ -9688,8 +9690,8 @@ Dbdict::alterIndex_fromDropTc(Signal* signal, OpAlterIndexPtr opPtr)
{
jam();
ndbrequire(opPtr.p->m_requestType == AlterIndxReq::RT_DICT_TC);
if (! opPtr.p->hasError()) {
// mark dropped in local TC
// mark dropped locally
if (! opPtr.p->hasLastError()) {
TableRecordPtr indexPtr;
c_tableRecordPool.getPtr(indexPtr, opPtr.p->m_request.getIndexId());
indexPtr.p->indexLocal &= ~TableRecord::IL_CREATED_TC;
......@@ -9827,38 +9829,27 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr)
req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key);
req->setRequestType(DropTrigReq::RT_ALTER_INDEX);
req->addRequestFlag(opPtr.p->m_requestFlag);
req->setTableId(opPtr.p->m_request.getTableId());
req->setIndexId(opPtr.p->m_request.getIndexId());
req->setTriggerInfo(0); // not used
opPtr.p->m_triggerCounter = 0;
if (indexPtr.p->isHashIndex()) {
// insert
if (indexPtr.p->insertTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->insertTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
}
// update
if (indexPtr.p->updateTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->updateTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
}
// delete
if (indexPtr.p->deleteTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->deleteTriggerId);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
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
if (indexPtr.p->buildTriggerId != RNIL) {
req->setTriggerId(indexPtr.p->buildTriggerId);
......@@ -9866,12 +9857,18 @@ Dbdict::alterIndex_toDropTrigger(Signal* signal, OpAlterIndexPtr opPtr)
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);
return;
}
if (indexPtr.p->isOrderedIndex()) {
// custom
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
......@@ -9989,14 +9986,16 @@ Dbdict::alterIndex_sendReply(Signal* signal, OpAlterIndexPtr opPtr,
AlterIndxRef* rep = (AlterIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_ALTER_INDX_CONF;
Uint32 length = AlterIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == AlterIndxReq::RT_DICT_ABORT)
sendRef = false;
} else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType());
......@@ -10409,8 +10408,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr)
req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key);
if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TC) {
jam();
req->setRequestType(AlterIndxReq::RT_TC);
} else if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TUX) {
jam();
req->setRequestType(AlterIndxReq::RT_TUX);
} else {
ndbrequire(false);
......@@ -10421,8 +10422,10 @@ Dbdict::buildIndex_toOnline(Signal* signal, OpBuildIndexPtr opPtr)
req->setOnline(true);
BlockReference blockRef = 0;
if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TC) {
jam();
blockRef = calcTcBlockRef(getOwnNodeId());
} else if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_TUX) {
jam();
blockRef = calcTuxBlockRef(getOwnNodeId());
} else {
ndbrequire(false);
......@@ -10449,15 +10452,14 @@ Dbdict::buildIndex_sendSlaveReq(Signal* signal, OpBuildIndexPtr opPtr)
req->setConnectionPtr(opPtr.p->key);
req->setRequestType(opPtr.p->m_requestType);
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.setWaitingFor(getOwnNodeId());
sendSignal(reference(), GSN_BUILDINDXREQ,
signal, BuildIndxReq::SignalLength, JBB);
}
else
{
} else {
jam();
opPtr.p->m_signalCounter = c_aliveNodes;
NodeReceiverGroup rg(DBDICT, c_aliveNodes);
sendSignal(rg, GSN_BUILDINDXREQ,
......@@ -10472,14 +10474,16 @@ Dbdict::buildIndex_sendReply(Signal* signal, OpBuildIndexPtr opPtr,
BuildIndxRef* rep = (BuildIndxRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_BUILDINDXCONF;
Uint32 length = BuildIndxConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == BuildIndxReq::RT_DICT_ABORT)
sendRef = false;
} else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType());
......@@ -10965,14 +10969,16 @@ Dbdict::createTrigger_sendReply(Signal* signal, OpCreateTriggerPtr opPtr,
CreateTrigRef* rep = (CreateTrigRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_CREATE_TRIG_CONF;
Uint32 length = CreateTrigConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == CreateTrigReq::RT_DICT_ABORT)
sendRef = false;
} else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType());
......@@ -11060,8 +11066,10 @@ Dbdict::execDROP_TRIG_REQ(Signal* signal)
OpDropTrigger opBad;
opPtr.p = &opBad;
opPtr.p->save(req);
if (! (req->getRequestFlag() & RequestFlag::RF_FORCE)) {
opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound;
opPtr.p->m_errorLine = __LINE__;
}
dropTrigger_sendReply(signal, opPtr, true);
return;
}
......@@ -11228,6 +11236,7 @@ Dbdict::dropTrigger_toAlterTrigger(Signal* signal, OpDropTriggerPtr opPtr)
req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key);
req->setRequestType(AlterTrigReq::RT_DROP_TRIGGER);
req->addRequestFlag(opPtr.p->m_requestFlag);
req->setTableId(opPtr.p->m_request.getTableId());
req->setTriggerId(opPtr.p->m_request.getTriggerId());
req->setTriggerInfo(0); // not used
......@@ -11323,14 +11332,16 @@ Dbdict::dropTrigger_sendReply(Signal* signal, OpDropTriggerPtr opPtr,
DropTrigRef* rep = (DropTrigRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_DROP_TRIG_CONF;
Uint32 length = DropTrigConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
if (opPtr.p->m_requestType == DropTrigReq::RT_DICT_ABORT)
sendRef = false;
} else {
sendRef = opPtr.p->hasError();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
rep->setRequestType(opPtr.p->m_request.getRequestType());
......@@ -11554,28 +11565,37 @@ Dbdict::alterTrigger_recvReply(Signal* signal, const AlterTrigConf* conf,
if (! (opPtr.p->m_request.getRequestFlag() & RequestFlag::RF_NOTCTRIGGER)) {
if (requestType == AlterTrigReq::RT_DICT_PREPARE) {
jam();
if (opPtr.p->m_request.getOnline())
if (opPtr.p->m_request.getOnline()) {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_TC;
else
} else {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_LQH;
}
alterTrigger_sendSlaveReq(signal, opPtr);
return;
}
if (requestType == AlterTrigReq::RT_DICT_TC) {
jam();
if (opPtr.p->m_request.getOnline())
if (opPtr.p->m_request.getOnline()) {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_LQH;
else
} else {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_COMMIT;
}
alterTrigger_sendSlaveReq(signal, opPtr);
return;
}
if (requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
if (opPtr.p->m_request.getOnline())
if (opPtr.p->m_request.getOnline()) {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_COMMIT;
else
} else {
jam();
opPtr.p->m_requestType = AlterTrigReq::RT_DICT_TC;
}
alterTrigger_sendSlaveReq(signal, opPtr);
return;
}
......@@ -11630,8 +11650,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key);
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
req->setRequestType(CreateTrigReq::RT_TC);
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
req->setRequestType(CreateTrigReq::RT_LQH);
} else {
ndbassert(false);
......@@ -11648,8 +11670,10 @@ Dbdict::alterTrigger_toCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setReceiverRef(opPtr.p->m_request.getReceiverRef());
BlockReference blockRef = 0;
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
blockRef = calcTcBlockRef(getOwnNodeId());
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
blockRef = calcLqhBlockRef(getOwnNodeId());
} else {
ndbassert(false);
......@@ -11663,13 +11687,15 @@ void
Dbdict::alterTrigger_fromCreateLocal(Signal* signal, OpAlterTriggerPtr opPtr)
{
jam();
if (! opPtr.p->hasError()) {
if (! opPtr.p->hasLastError()) {
// mark created locally
TriggerRecordPtr triggerPtr;
c_triggerRecordPool.getPtr(triggerPtr, opPtr.p->m_request.getTriggerId());
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
triggerPtr.p->triggerLocal |= TriggerRecord::TL_CREATED_TC;
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
triggerPtr.p->triggerLocal |= TriggerRecord::TL_CREATED_LQH;
} else {
ndbrequire(false);
......@@ -11689,17 +11715,21 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setUserRef(reference());
req->setConnectionPtr(opPtr.p->key);
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)) {
jam();
ndbrequire(opPtr.p->m_requestFlag & RequestFlag::RF_FORCE);
alterTrigger_sendReply(signal, opPtr, false);
return;
}
req->setRequestType(DropTrigReq::RT_TC);
} 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)) {
jam();
ndbrequire(opPtr.p->m_requestFlag & RequestFlag::RF_FORCE);
alterTrigger_sendReply(signal, opPtr, false);
return;
}
......@@ -11717,8 +11747,10 @@ Dbdict::alterTrigger_toDropLocal(Signal* signal, OpAlterTriggerPtr opPtr)
req->setMonitorAllAttributes(triggerPtr.p->monitorAllAttributes);
BlockReference blockRef = 0;
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
blockRef = calcTcBlockRef(getOwnNodeId());
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
blockRef = calcLqhBlockRef(getOwnNodeId());
} else {
ndbassert(false);
......@@ -11731,13 +11763,15 @@ void
Dbdict::alterTrigger_fromDropLocal(Signal* signal, OpAlterTriggerPtr opPtr)
{
jam();
if (! opPtr.p->hasError()) {
if (! opPtr.p->hasLastError()) {
// mark dropped locally
TriggerRecordPtr triggerPtr;
c_triggerRecordPool.getPtr(triggerPtr, opPtr.p->m_request.getTriggerId());
if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_TC) {
jam();
triggerPtr.p->triggerLocal &= ~TriggerRecord::TL_CREATED_TC;
} else if (opPtr.p->m_requestType == AlterTrigReq::RT_DICT_LQH) {
jam();
triggerPtr.p->triggerLocal &= ~TriggerRecord::TL_CREATED_LQH;
} else {
ndbrequire(false);
......@@ -11794,8 +11828,9 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr,
AlterTrigRef* rep = (AlterTrigRef*)signal->getDataPtrSend();
Uint32 gsn = GSN_ALTER_TRIG_CONF;
Uint32 length = AlterTrigConf::InternalLength;
bool sendRef = opPtr.p->hasError();
bool sendRef;
if (! toUser) {
sendRef = opPtr.p->hasLastError();
rep->setUserRef(opPtr.p->m_coordinatorRef);
rep->setConnectionPtr(opPtr.p->key);
rep->setRequestType(opPtr.p->m_requestType);
......@@ -11806,6 +11841,7 @@ Dbdict::alterTrigger_sendReply(Signal* signal, OpAlterTriggerPtr opPtr,
jam();
}
} else {
sendRef = opPtr.p->hasError();
jam();
rep->setUserRef(opPtr.p->m_request.getUserRef());
rep->setConnectionPtr(opPtr.p->m_request.getConnectionPtr());
......
......@@ -953,7 +953,8 @@ private:
enum {
RF_LOCAL = 1 << 0, // create on local node only
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:
CreateIndxReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
CreateIndxRef::ErrorCode m_lastError;
CreateIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -984,6 +986,7 @@ private:
m_coordinatorRef = 0;
m_requestType = CreateIndxReq::RT_UNDEFINED;
m_requestFlag = 0;
m_lastError = CreateIndxRef::NoError;
m_errorCode = CreateIndxRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -993,36 +996,51 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != CreateIndxRef::NoError;
}
bool hasError() {
return m_errorCode != CreateIndxRef::NoError;
}
void setError(const CreateIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = ref->getErrorCode();
m_lastError = CreateIndxRef::NoError;
if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const CreateTableRef* ref) {
if (ref != 0 && ! hasError()) {
m_lastError = CreateIndxRef::NoError;
if (ref != 0) {
switch (ref->getErrorCode()) {
case CreateTableRef::TableAlreadyExist:
m_errorCode = CreateIndxRef::IndexExists;
m_lastError = CreateIndxRef::IndexExists;
break;
default:
m_errorCode = (CreateIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
break;
}
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
}
}
}
void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (CreateIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = CreateIndxRef::NoError;
if (ref != 0) {
m_lastError = (CreateIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
};
typedef Ptr<OpCreateIndex> OpCreateIndexPtr;
......@@ -1039,6 +1057,7 @@ private:
DropIndxReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
DropIndxRef::ErrorCode m_lastError;
DropIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1050,6 +1069,7 @@ private:
m_coordinatorRef = 0;
m_requestType = DropIndxReq::RT_UNDEFINED;
m_requestFlag = 0;
m_lastError = DropIndxRef::NoError;
m_errorCode = DropIndxRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -1059,44 +1079,59 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != DropIndxRef::NoError;
}
bool hasError() {
return m_errorCode != DropIndxRef::NoError;
}
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (DropIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = DropIndxRef::NoError;
if (ref != 0) {
m_lastError = (DropIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const DropTableRef* ref) {
if (ref != 0 && ! hasError()) {
switch(ref->errorCode) {
case(DropTableRef::Busy):
m_errorCode = DropIndxRef::Busy;
m_lastError = DropIndxRef::NoError;
if (ref != 0) {
switch (ref->errorCode) {
case DropTableRef::Busy:
m_lastError = DropIndxRef::Busy;
break;
case(DropTableRef::NoSuchTable):
m_errorCode = DropIndxRef::IndexNotFound;
case DropTableRef::NoSuchTable:
m_lastError = DropIndxRef::IndexNotFound;
break;
case(DropTableRef::DropInProgress):
m_errorCode = DropIndxRef::Busy;
case DropTableRef::DropInProgress:
m_lastError = DropIndxRef::Busy;
break;
case(DropTableRef::NoDropTableRecordAvailable):
m_errorCode = DropIndxRef::Busy;
case DropTableRef::NoDropTableRecordAvailable:
m_lastError = DropIndxRef::Busy;
break;
default:
m_errorCode = (DropIndxRef::ErrorCode)ref->errorCode;
m_lastError = (DropIndxRef::ErrorCode)ref->errorCode;
break;
}
//m_errorLine = ref->getErrorLine();
//m_errorNode = ref->getErrorNode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = 0;
m_errorNode = 0;
}
}
}
};
......@@ -1117,6 +1152,7 @@ private:
AlterIndxReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
AlterIndxRef::ErrorCode m_lastError;
AlterIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1129,6 +1165,7 @@ private:
m_coordinatorRef = 0;
m_requestType = AlterIndxReq::RT_UNDEFINED;
m_requestFlag = 0;
m_lastError = AlterIndxRef::NoError;
m_errorCode = AlterIndxRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -1139,49 +1176,78 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != AlterIndxRef::NoError;
}
bool hasError() {
return m_errorCode != AlterIndxRef::NoError;
}
void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = ref->getErrorCode();
m_lastError = AlterIndxRef::NoError;
if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const CreateIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterIndxRef::NoError;
if (ref != 0) {
m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const DropIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterIndxRef::NoError;
if (ref != 0) {
m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const BuildIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterIndxRef::NoError;
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) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterIndxRef::NoError;
if (ref != 0) {
m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterIndxRef::NoError;
if (ref != 0) {
m_lastError = (AlterIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
};
typedef Ptr<OpAlterIndex> OpAlterIndexPtr;
......@@ -1201,6 +1267,7 @@ private:
Uint32 m_requestFlag;
Uint32 m_constrTriggerId;
// error info
BuildIndxRef::ErrorCode m_lastError;
BuildIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1212,7 +1279,7 @@ private:
m_coordinatorRef = 0;
m_requestType = BuildIndxReq::RT_UNDEFINED;
m_requestFlag = 0;
// Uint32 m_constrTriggerId = RNIL;
m_lastError = BuildIndxRef::NoError;
m_errorCode = BuildIndxRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -1222,35 +1289,56 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != BuildIndxRef::NoError;
}
bool hasError() {
return m_errorCode != BuildIndxRef::NoError;
}
void setError(const BuildIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = ref->getErrorCode();
m_lastError = BuildIndxRef::NoError;
if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = 0;
m_errorNode = 0;
}
}
}
void setError(const AlterIndxRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (BuildIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = BuildIndxRef::NoError;
if (ref != 0) {
m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (BuildIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = BuildIndxRef::NoError;
if (ref != 0) {
m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (BuildIndxRef::ErrorCode)ref->getErrorCode();
m_lastError = BuildIndxRef::NoError;
if (ref != 0) {
m_lastError = (BuildIndxRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
};
typedef Ptr<OpBuildIndex> OpBuildIndexPtr;
......@@ -1381,6 +1469,7 @@ private:
CreateTrigReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
CreateTrigRef::ErrorCode m_lastError;
CreateTrigRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1392,6 +1481,7 @@ private:
m_coordinatorRef = 0;
m_requestType = CreateTrigReq::RT_UNDEFINED;
m_requestFlag = 0;
m_lastError = CreateTrigRef::NoError;
m_errorCode = CreateTrigRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -1401,23 +1491,34 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != CreateTrigRef::NoError;
}
bool hasError() {
return m_errorCode != CreateTrigRef::NoError;
}
void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = ref->getErrorCode();
m_lastError = CreateTrigRef::NoError;
if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const AlterTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (CreateTrigRef::ErrorCode)ref->getErrorCode();
m_lastError = CreateTrigRef::NoError;
if (ref != 0) {
m_lastError = (CreateTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
};
typedef Ptr<OpCreateTrigger> OpCreateTriggerPtr;
......@@ -1434,6 +1535,7 @@ private:
DropTrigReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
DropTrigRef::ErrorCode m_lastError;
DropTrigRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1445,6 +1547,7 @@ private:
m_coordinatorRef = 0;
m_requestType = DropTrigReq::RT_UNDEFINED;
m_requestFlag = 0;
m_lastError = DropTrigRef::NoError;
m_errorCode = DropTrigRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -1454,23 +1557,34 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != DropTrigRef::NoError;
}
bool hasError() {
return m_errorCode != DropTrigRef::NoError;
}
void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = ref->getErrorCode();
m_lastError = DropTrigRef::NoError;
if (ref != 0) {
m_lastError = ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const AlterTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (DropTrigRef::ErrorCode)ref->getErrorCode();
m_lastError = DropTrigRef::NoError;
if (ref != 0) {
m_lastError = (DropTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
};
typedef Ptr<OpDropTrigger> OpDropTriggerPtr;
......@@ -1489,6 +1603,7 @@ private:
AlterTrigReq::RequestType m_requestType;
Uint32 m_requestFlag;
// error info
AlterTrigRef::ErrorCode m_lastError;
AlterTrigRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1500,6 +1615,7 @@ private:
m_coordinatorRef = 0;
m_requestType = AlterTrigReq::RT_UNDEFINED;
m_requestFlag = 0;
m_lastError = AlterTrigRef::NoError;
m_errorCode = AlterTrigRef::NoError;
m_errorLine = 0;
m_errorNode = 0;
......@@ -1509,30 +1625,45 @@ private:
m_requestType = req->getRequestType();
m_requestFlag = req->getRequestFlag();
}
bool hasLastError() {
return m_lastError != AlterTrigRef::NoError;
}
bool hasError() {
return m_errorCode != AlterTrigRef::NoError;
}
void setError(const AlterTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterTrigRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterTrigRef::NoError;
if (ref != 0) {
m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const CreateTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterTrigRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterTrigRef::NoError;
if (ref != 0) {
m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
void setError(const DropTrigRef* ref) {
if (ref != 0 && ! hasError()) {
m_errorCode = (AlterTrigRef::ErrorCode)ref->getErrorCode();
m_lastError = AlterTrigRef::NoError;
if (ref != 0) {
m_lastError = (AlterTrigRef::ErrorCode)ref->getErrorCode();
if (! hasError()) {
m_errorCode = m_lastError;
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
}
}
}
};
typedef Ptr<OpAlterTrigger> OpAlterTriggerPtr;
......
......@@ -11043,6 +11043,7 @@ void Dbtc::execCREATE_TRIG_REQ(Signal* signal)
if (ERROR_INSERTED(8033) ||
!c_theDefinedTriggers.seizeId(triggerPtr,
createTrigReq->getTriggerId())) {
jam();
CLEAR_ERROR_INSERT_VALUE;
// Failed to allocate trigger record
CreateTrigRef * const createTrigRef =
......@@ -11077,8 +11078,10 @@ void Dbtc::execDROP_TRIG_REQ(Signal* signal)
DropTrigReq * const dropTrigReq = (DropTrigReq *)&signal->theData[0];
BlockReference sender = signal->senderBlockRef();
if ((c_theDefinedTriggers.getPtr(dropTrigReq->getTriggerId())) == NULL) {
if (ERROR_INSERTED(8035) ||
(c_theDefinedTriggers.getPtr(dropTrigReq->getTriggerId())) == NULL) {
jam();
CLEAR_ERROR_INSERT_VALUE;
// Failed to find find trigger record
DropTrigRef * const dropTrigRef = (DropTrigRef *)&signal->theData[0];
......@@ -11110,6 +11113,7 @@ void Dbtc::execCREATE_INDX_REQ(Signal* signal)
if (ERROR_INSERTED(8034) ||
!c_theIndexes.seizeId(indexPtr, createIndxReq->getIndexId())) {
jam();
CLEAR_ERROR_INSERT_VALUE;
// Failed to allocate index record
CreateIndxRef * const createIndxRef =
......@@ -11321,8 +11325,10 @@ void Dbtc::execDROP_INDX_REQ(Signal* signal)
TcIndexData* indexData;
BlockReference sender = signal->senderBlockRef();
if ((indexData = c_theIndexes.getPtr(dropIndxReq->getIndexId())) == NULL) {
if (ERROR_INSERTED(8036) ||
(indexData = c_theIndexes.getPtr(dropIndxReq->getIndexId())) == NULL) {
jam();
CLEAR_ERROR_INSERT_VALUE;
// Failed to find index record
DropIndxRef * const dropIndxRef =
(DropIndxRef *)signal->getDataPtrSend();
......
......@@ -305,6 +305,10 @@ Dbtup::primaryKey(Tablerec* const regTabPtr, Uint32 attrId)
Uint32
Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req)
{
if (ERROR_INSERTED(4004)) {
CLEAR_ERROR_INSERT_VALUE;
return 9999;
}
Uint32 triggerId = req->getTriggerId();
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