提交 9dd5922d 编写于 作者: S Shengliang Guan

error returned when trans rollback

上级 ad965dbc
...@@ -64,10 +64,10 @@ typedef enum { ...@@ -64,10 +64,10 @@ typedef enum {
TRN_STAGE_PREPARE = 0, TRN_STAGE_PREPARE = 0,
TRN_STAGE_REDO_LOG = 1, TRN_STAGE_REDO_LOG = 1,
TRN_STAGE_REDO_ACTION = 2, TRN_STAGE_REDO_ACTION = 2,
TRN_STAGE_UNDO_LOG = 3, TRN_STAGE_COMMIT_LOG = 3,
TRN_STAGE_UNDO_ACTION = 4, TRN_STAGE_COMMIT = 4,
TRN_STAGE_COMMIT_LOG = 5, TRN_STAGE_UNDO_ACTION = 5,
TRN_STAGE_COMMIT = 6, TRN_STAGE_UNDO_LOG = 6,
TRN_STAGE_ROLLBACK = 7, TRN_STAGE_ROLLBACK = 7,
TRN_STAGE_FINISHED = 8 TRN_STAGE_FINISHED = 8
} ETrnStage; } ETrnStage;
......
...@@ -496,10 +496,15 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) { ...@@ -496,10 +496,15 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) {
} }
static void mndTransSendRpcRsp(STrans *pTrans) { static void mndTransSendRpcRsp(STrans *pTrans) {
if (pTrans->stage == TRN_STAGE_FINISHED || pTrans->stage == TRN_STAGE_UNDO_LOG ||
pTrans->stage == TRN_STAGE_UNDO_ACTION || pTrans->stage == TRN_STAGE_ROLLBACK) {
if (pTrans->rpcHandle != NULL) { if (pTrans->rpcHandle != NULL) {
mDebug("trans:%d, send rsp, ahandle:%p code:0x%x", pTrans->id, pTrans->rpcAHandle, pTrans->code & 0xFFFF); mDebug("trans:%d, send rsp, code:0x%x stage:%d app:%p", pTrans->id, pTrans->code & 0xFFFF, pTrans->stage,
pTrans->rpcAHandle);
SRpcMsg rspMsg = {.handle = pTrans->rpcHandle, .code = pTrans->code, .ahandle = pTrans->rpcAHandle}; SRpcMsg rspMsg = {.handle = pTrans->rpcHandle, .code = pTrans->code, .ahandle = pTrans->rpcAHandle};
rpcSendResponse(&rspMsg); rpcSendResponse(&rspMsg);
pTrans->rpcHandle = NULL;
}
} }
} }
...@@ -764,7 +769,6 @@ static bool mndTransPerformCommitLogStage(SMnode *pMnode, STrans *pTrans) { ...@@ -764,7 +769,6 @@ static bool mndTransPerformCommitLogStage(SMnode *pMnode, STrans *pTrans) {
pTrans->failedTimes++; pTrans->failedTimes++;
mError("trans:%d, stage keep on commitLog since %s", pTrans->id, terrstr()); mError("trans:%d, stage keep on commitLog since %s", pTrans->id, terrstr());
continueExec = false; continueExec = false;
;
} }
return continueExec; return continueExec;
...@@ -791,7 +795,7 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) { ...@@ -791,7 +795,7 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) {
int32_t code = mndTransExecuteUndoActions(pMnode, pTrans); int32_t code = mndTransExecuteUndoActions(pMnode, pTrans);
if (code == 0) { if (code == 0) {
pTrans->stage = TRN_STAGE_REDO_LOG; pTrans->stage = TRN_STAGE_UNDO_LOG;
mDebug("trans:%d, stage from undoAction to undoLog", pTrans->id); mDebug("trans:%d, stage from undoAction to undoLog", pTrans->id);
continueExec = true; continueExec = true;
} else if (code == TSDB_CODE_MND_ACTION_IN_PROGRESS) { } else if (code == TSDB_CODE_MND_ACTION_IN_PROGRESS) {
...@@ -814,7 +818,6 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) { ...@@ -814,7 +818,6 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) {
pTrans->stage = TRN_STAGE_FINISHED; pTrans->stage = TRN_STAGE_FINISHED;
mDebug("trans:%d, stage from rollback to finished", pTrans->id); mDebug("trans:%d, stage from rollback to finished", pTrans->id);
continueExec = true; continueExec = true;
;
} else { } else {
pTrans->failedTimes++; pTrans->failedTimes++;
mError("trans:%d, stage keep on rollback since %s", pTrans->id, terrstr()); mError("trans:%d, stage keep on rollback since %s", pTrans->id, terrstr());
...@@ -880,9 +883,7 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) { ...@@ -880,9 +883,7 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
} }
} }
if (pTrans->stage == TRN_STAGE_FINISHED) {
mndTransSendRpcRsp(pTrans); mndTransSendRpcRsp(pTrans);
}
} }
static int32_t mndProcessTransMsg(SMnodeMsg *pMsg) { static int32_t mndProcessTransMsg(SMnodeMsg *pMsg) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册