diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index f51fe344dfe6941fd9c887610def664d8a67ceb9..018ac5bb7da3764d2b54b6dfc7995ffe9d9a47d8 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -234,18 +234,17 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR *ppEntry = NULL; - // SWalReadHandle* pWalHandle = walOpenReadHandle(pWal); + int64_t ts1 = taosGetTimestampNs(); + taosThreadMutexLock(&(pData->mutex)); + SWalReader* pWalHandle = pData->pWalHandle; if (pWalHandle == NULL) { terrno = TSDB_CODE_SYN_INTERNAL_ERROR; sError("vgId:%d, wal handle is NULL", pData->pSyncNode->vgId); - + taosThreadMutexUnlock(&(pData->mutex)); return -1; } - int64_t ts1 = taosGetTimestampNs(); - taosThreadMutexLock(&(pData->mutex)); - int64_t ts2 = taosGetTimestampNs(); code = walReadVer(pWalHandle, index); int64_t ts3 = taosGetTimestampNs();