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
Next DBLQH 5042
Next DBDICT 6006
Next DBDIH 7174
Next DBTC 8035
Next DBTC 8037
Next CMVMI 9000
Next BACKUP 10022
Next DBUTIL 11002
......@@ -406,8 +406,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:
---------------
......
......@@ -6740,14 +6740,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());
......@@ -6816,11 +6818,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;
......@@ -7083,14 +7082,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());
......@@ -9607,7 +9608,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;
......@@ -9623,9 +9624,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;
}
......@@ -9647,8 +9649,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;
......@@ -9786,51 +9788,46 @@ 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;
// insert
if (indexPtr.p->insertTriggerId != RNIL) {
if (indexPtr.p->isHashIndex()) {
// insert
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) {
// update
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) {
// delete
req->setTriggerId(indexPtr.p->deleteTriggerId);
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);
sendSignal(reference(), GSN_DROP_TRIG_REQ,
signal, DropTrigReq::SignalLength, JBB);
opPtr.p->m_triggerCounter++;
}
return;
}
// custom
if (indexPtr.p->customTriggerId != RNIL) {
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;
}
// 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++;
}
if (opPtr.p->m_triggerCounter == 0) {
// drop in each TC
jam();
opPtr.p->m_requestType = AlterIndxReq::RT_DICT_TC;
alterIndex_sendSlaveReq(signal, opPtr);
}
ndbrequire(false);
}
void
......@@ -9948,14 +9945,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());
......@@ -10368,8 +10367,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);
......@@ -10380,8 +10381,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);
......@@ -10408,15 +10411,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,
......@@ -10431,14 +10433,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());
......@@ -10925,14 +10929,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());
......@@ -11020,8 +11026,10 @@ Dbdict::execDROP_TRIG_REQ(Signal* signal)
OpDropTrigger opBad;
opPtr.p = &opBad;
opPtr.p->save(req);
opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound;
opPtr.p->m_errorLine = __LINE__;
if (! (req->getRequestFlag() & RequestFlag::RF_FORCE)) {
opPtr.p->m_errorCode = DropTrigRef::TriggerNotFound;
opPtr.p->m_errorLine = __LINE__;
}
dropTrigger_sendReply(signal, opPtr, true);
return;
}
......@@ -11188,6 +11196,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
......@@ -11283,14 +11292,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());
......@@ -11514,28 +11525,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;
}
......@@ -11595,8 +11615,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);
......@@ -11613,8 +11635,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);
......@@ -11628,13 +11652,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);
......@@ -11654,17 +11680,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;
}
......@@ -11682,8 +11712,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);
......@@ -11696,13 +11728,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);
......@@ -11759,8 +11793,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);
......@@ -11771,6 +11806,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());
......
......@@ -924,7 +924,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
};
};
......@@ -944,6 +945,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;
......@@ -955,6 +957,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;
......@@ -964,34 +967,49 @@ 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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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;
}
m_errorLine = ref->getErrorLine();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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();
}
}
}
};
......@@ -1010,6 +1028,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;
......@@ -1021,6 +1040,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;
......@@ -1030,44 +1050,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_errorCode = ref->getErrorCode();
m_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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;
}
}
}
};
......@@ -1088,6 +1123,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;
......@@ -1100,6 +1136,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;
......@@ -1110,47 +1147,76 @@ 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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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();
}
}
}
};
......@@ -1172,6 +1238,7 @@ private:
Uint32 m_requestFlag;
Uint32 m_constrTriggerId;
// error info
BuildIndxRef::ErrorCode m_lastError;
BuildIndxRef::ErrorCode m_errorCode;
Uint32 m_errorLine;
Uint32 m_errorNode;
......@@ -1183,7 +1250,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;
......@@ -1193,33 +1260,54 @@ 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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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();
}
}
}
};
......@@ -1352,6 +1440,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;
......@@ -1363,6 +1452,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;
......@@ -1372,21 +1462,32 @@ 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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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();
}
}
}
};
......@@ -1405,6 +1506,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;
......@@ -1416,6 +1518,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;
......@@ -1425,21 +1528,32 @@ 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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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();
}
}
}
};
......@@ -1460,6 +1574,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;
......@@ -1471,6 +1586,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;
......@@ -1480,28 +1596,43 @@ 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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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_errorLine = ref->getErrorLine();
m_errorNode = ref->getErrorNode();
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();
}
}
}
};
......
......@@ -10833,6 +10833,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 =
......@@ -10867,8 +10868,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];
......@@ -10900,6 +10903,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 =
......@@ -11111,8 +11115,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