未验证 提交 d90b58b5 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #18732 from taosdata/FIX/TD-20920-3.0

fix: synchronize access of pWalHandle with mutex in raftLogGetEntry
...@@ -234,18 +234,17 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR ...@@ -234,18 +234,17 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR
*ppEntry = NULL; *ppEntry = NULL;
// SWalReadHandle* pWalHandle = walOpenReadHandle(pWal); int64_t ts1 = taosGetTimestampNs();
taosThreadMutexLock(&(pData->mutex));
SWalReader* pWalHandle = pData->pWalHandle; SWalReader* pWalHandle = pData->pWalHandle;
if (pWalHandle == NULL) { if (pWalHandle == NULL) {
terrno = TSDB_CODE_SYN_INTERNAL_ERROR; terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
sError("vgId:%d, wal handle is NULL", pData->pSyncNode->vgId); sError("vgId:%d, wal handle is NULL", pData->pSyncNode->vgId);
taosThreadMutexUnlock(&(pData->mutex));
return -1; return -1;
} }
int64_t ts1 = taosGetTimestampNs();
taosThreadMutexLock(&(pData->mutex));
int64_t ts2 = taosGetTimestampNs(); int64_t ts2 = taosGetTimestampNs();
code = walReadVer(pWalHandle, index); code = walReadVer(pWalHandle, index);
int64_t ts3 = taosGetTimestampNs(); int64_t ts3 = taosGetTimestampNs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册