提交 9a8895ec 编写于 作者: M Minghao Li

refactor(sync): use taosLRUCacheErase instead of taosLRUCacheRelease

上级 effc38d2
...@@ -38,7 +38,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { ...@@ -38,7 +38,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) {
} }
// pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5); // pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5);
pLogStore->pCache = taosLRUCacheInit(100 * 1024 * 1024, 1, .5); pLogStore->pCache = taosLRUCacheInit(30 * 1024 * 1024, 1, .5);
if (pLogStore->pCache == NULL) { if (pLogStore->pCache == NULL) {
taosMemoryFree(pLogStore); taosMemoryFree(pLogStore);
terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; terrno = TSDB_CODE_WAL_OUT_OF_MEMORY;
...@@ -325,12 +325,15 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn ...@@ -325,12 +325,15 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn
// delete from cache // delete from cache
for (SyncIndex index = fromIndex; index <= wallastVer; ++index) { for (SyncIndex index = fromIndex; index <= wallastVer; ++index) {
SLRUCache* pCache = pData->pSyncNode->pLogStore->pCache; SLRUCache* pCache = pData->pSyncNode->pLogStore->pCache;
taosLRUCacheErase(pData->pSyncNode->pLogStore->pCache, &index, sizeof(index));
#if 0
LRUHandle* h = taosLRUCacheLookup(pCache, &index, sizeof(index)); LRUHandle* h = taosLRUCacheLookup(pCache, &index, sizeof(index));
if (h) { if (h) {
sNTrace(pData->pSyncNode, "cache delete index:%" PRId64, index); sNTrace(pData->pSyncNode, "cache delete index:%" PRId64, index);
taosLRUCacheRelease(pData->pSyncNode->pLogStore->pCache, h, true); taosLRUCacheRelease(pData->pSyncNode->pLogStore->pCache, h, true);
} }
#endif
} }
int32_t code = walRollback(pWal, fromIndex); int32_t code = walRollback(pWal, fromIndex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册