From 8977e08fb14a9c27a141864c2b1b9297b67b5cbc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 18 Feb 2022 14:26:49 +0800 Subject: [PATCH] trans error --- include/util/tdef.h | 2 +- source/dnode/mnode/impl/src/mndTrans.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 1dd4d4b5d8..35655c8eaf 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -216,7 +216,7 @@ do { \ #define TSDB_TRANS_STAGE_LEN 12 #define TSDB_TRANS_TYPE_LEN 16 -#define TSDB_TRANS_ERROR_LEN 128 +#define TSDB_TRANS_ERROR_LEN 64 #define TSDB_STEP_NAME_LEN 32 #define TSDB_STEP_DESC_LEN 128 diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 5190d66920..433aade549 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -805,6 +805,9 @@ void mndTransProcessRsp(SMnodeMsg *pRsp) { if (pAction != NULL) { pAction->msgReceived = 1; pAction->errCode = pRsp->rpcMsg.code; + if (pAction->errCode != 0) { + tstrncpy(pTrans->lastError, tstrerror(pAction->errCode), TSDB_TRANS_ERROR_LEN); + } } mDebug("trans:%d, action:%d response is received, code:0x%x, accept:0x%x", transId, action, pRsp->rpcMsg.code, @@ -1110,6 +1113,7 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) { bool continueExec = true; while (continueExec) { + pTrans->lastExecTime = taosGetTimestampMs(); switch (pTrans->stage) { case TRN_STAGE_PREPARE: continueExec = mndTransPerformPrepareStage(pMnode, pTrans); -- GitLab