diff --git a/src/tsdb/src/tsdbMemTable.c b/src/tsdb/src/tsdbMemTable.c index e928cdc385..2989daad49 100644 --- a/src/tsdb/src/tsdbMemTable.c +++ b/src/tsdb/src/tsdbMemTable.c @@ -222,11 +222,12 @@ int tsdbAsyncCommit(STsdbRepo *pRepo) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } + pRepo->commit = 0; } ASSERT(pRepo->commit == 0); - if (pRepo->appH.notifyStatus) pRepo->appH.notifyStatus(pRepo->appH.appH, TSDB_STATUS_COMMIT_START); if (pRepo->mem != NULL) { + if (pRepo->appH.notifyStatus) pRepo->appH.notifyStatus(pRepo->appH.appH, TSDB_STATUS_COMMIT_START); if (tsdbLockRepo(pRepo) < 0) return -1; pRepo->imem = pRepo->mem; pRepo->mem = NULL; @@ -468,9 +469,6 @@ _err: static void tsdbEndCommit(STsdbRepo *pRepo) { ASSERT(pRepo->commit == 1); - tsdbLockRepo(pRepo); - pRepo->commit = 0; - tsdbUnlockRepo(pRepo); if (pRepo->appH.notifyStatus) pRepo->appH.notifyStatus(pRepo->appH.appH, TSDB_STATUS_COMMIT_OVER); }