fix: race condition issue

This commit is contained in:
dapan1121 2024-11-15 18:15:50 +08:00
parent 15e26827db
commit ce2b2bb024
1 changed files with 4 additions and 3 deletions

View File

@ -1064,9 +1064,6 @@ void mptCheckPoolUsedSize(int32_t jobNum) {
for (int32_t i = 0; i < jobNum; ++i) { for (int32_t i = 0; i < jobNum; ++i) {
SMPTestJobCtx* pJobCtx = &mptCtx.jobCtxs[i]; SMPTestJobCtx* pJobCtx = &mptCtx.jobCtxs[i];
if (NULL == pJobCtx->pJob) {
continue;
}
sleepTimes = 0; sleepTimes = 0;
while (taosRTryLockLatch(&pJobCtx->jobExecLock)) { while (taosRTryLockLatch(&pJobCtx->jobExecLock)) {
@ -1081,6 +1078,10 @@ void mptCheckPoolUsedSize(int32_t jobNum) {
break; break;
} }
if (NULL == pJobCtx->pJob) {
continue;
}
int64_t jobUsedSize = 0; int64_t jobUsedSize = 0;
for (int32_t m = 0; m < pJobCtx->taskNum; ++m) { for (int32_t m = 0; m < pJobCtx->taskNum; ++m) {
if (!pJobCtx->taskCtxs[m].destoryed) { if (!pJobCtx->taskCtxs[m].destoryed) {