refact: add mndTransExecuteActionsSerial
This commit is contained in:
parent
10e9d79201
commit
edcd1b87d8
|
@ -1360,22 +1360,19 @@ static int32_t mndTransExecuteCommitActions(SMnode *pMnode, STrans *pTrans, bool
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans, bool topHalf) {
|
static int32_t mndTransExecuteActionsSerial(SMnode *pMnode, STrans *pTrans, SArray *pActions, bool topHalf) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t numOfActions = taosArrayGetSize(pTrans->redoActions);
|
int32_t numOfActions = taosArrayGetSize(pActions);
|
||||||
if (numOfActions == 0) return code;
|
if (numOfActions == 0) return code;
|
||||||
|
|
||||||
taosThreadMutexLock(&pTrans->mutex);
|
|
||||||
|
|
||||||
if (pTrans->actionPos >= numOfActions) {
|
if (pTrans->actionPos >= numOfActions) {
|
||||||
taosThreadMutexUnlock(&pTrans->mutex);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("trans:%d, execute %d actions serial, current redoAction:%d", pTrans->id, numOfActions, pTrans->actionPos);
|
mInfo("trans:%d, execute %d actions serial, current redoAction:%d", pTrans->id, numOfActions, pTrans->actionPos);
|
||||||
|
|
||||||
for (int32_t action = pTrans->actionPos; action < numOfActions; ++action) {
|
for (int32_t action = pTrans->actionPos; action < numOfActions; ++action) {
|
||||||
STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->actionPos);
|
STransAction *pAction = taosArrayGet(pActions, pTrans->actionPos);
|
||||||
|
|
||||||
code = mndTransExecSingleAction(pMnode, pTrans, pAction, topHalf);
|
code = mndTransExecSingleAction(pMnode, pTrans, pAction, topHalf);
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
|
@ -1442,8 +1439,16 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosThreadMutexUnlock(&pTrans->mutex);
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans, bool topHalf) {
|
||||||
|
int32_t code = 0;
|
||||||
|
taosThreadMutexLock(&pTrans->mutex);
|
||||||
|
if (pTrans->stage == TRN_STAGE_REDO_ACTION) {
|
||||||
|
code = mndTransExecuteActionsSerial(pMnode, pTrans, pTrans->redoActions, topHalf);
|
||||||
|
}
|
||||||
|
taosThreadMutexUnlock(&pTrans->mutex);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue