add tsma creation/dropping trx conflict check

This commit is contained in:
wangjiaming0909 2024-09-25 11:03:47 +08:00
parent 3312eec628
commit 856cc32f39
3 changed files with 11 additions and 2 deletions

View File

@ -106,6 +106,7 @@ typedef enum {
// TRN_CONFLICT_TOPIC = 4, // TRN_CONFLICT_TOPIC = 4,
// TRN_CONFLICT_TOPIC_INSIDE = 5, // TRN_CONFLICT_TOPIC_INSIDE = 5,
TRN_CONFLICT_ARBGROUP = 6, TRN_CONFLICT_ARBGROUP = 6,
TRN_CONFLICT_TSMA = 7,
} ETrnConflct; } ETrnConflct;
typedef enum { typedef enum {

View File

@ -1692,7 +1692,7 @@ static int32_t mndCreateTSMATxnPrepare(SCreateTSMACxt* pCxt) {
STransAction dropStbUndoAction = {0}; STransAction dropStbUndoAction = {0};
SMDropStbReq dropStbReq = {0}; SMDropStbReq dropStbReq = {0};
STrans *pTrans = STrans *pTrans =
mndTransCreate(pCxt->pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pCxt->pRpcReq, "create-tsma"); mndTransCreate(pCxt->pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_TSMA, pCxt->pRpcReq, "create-tsma");
if (!pTrans) { if (!pTrans) {
code = terrno; code = terrno;
goto _OVER; goto _OVER;
@ -1974,7 +1974,7 @@ _OVER:
static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) { static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
int32_t code = -1; int32_t code = -1;
STransAction dropStreamRedoAction = {0}; STransAction dropStreamRedoAction = {0};
STrans *pTrans = mndTransCreate(pCxt->pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pCxt->pRpcReq, "drop-tsma"); STrans *pTrans = mndTransCreate(pCxt->pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_TSMA, pCxt->pRpcReq, "drop-tsma");
if (!pTrans) { if (!pTrans) {
code = terrno; code = terrno;
goto _OVER; goto _OVER;

View File

@ -902,6 +902,14 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) {
} }
} }
if (pNew->conflict == TRN_CONFLICT_TSMA) {
if (pTrans->conflict == TRN_CONFLICT_GLOBAL || pTrans->conflict == TRN_CONFLICT_TSMA) {
mndTransLogConflict(pNew, pTrans, true, &conflict);
} else {
mndTransLogConflict(pNew, pTrans, false, &conflict);
}
}
sdbRelease(pMnode->pSdb, pTrans); sdbRelease(pMnode->pSdb, pTrans);
} }