From 1b317ae5789c1d6bc1fcdfcae1988d6b2378c8c3 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao> Date: Thu, 20 Jun 2024 11:06:09 +0800 Subject: [PATCH] adj sream tbname cache --- source/libs/stream/src/streamState.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index cac0e8b662..31bf1b67a4 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -1112,11 +1112,12 @@ int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal #ifdef USE_ROCKSDB void* pStr = tSimpleHashGet(pState->parNameMap, &groupId, sizeof(int64_t)); if (!pStr) { - if (onlyCache) { + bool isFull = (tSimpleHashGetSize(pState->parNameMap) >= MAX_TABLE_NAME_NUM); + if (onlyCache && isFull) { return TSDB_CODE_FAILED; } int32_t code = streamStateGetParName_rocksdb(pState, groupId, pVal); - if (code == TSDB_CODE_SUCCESS && tSimpleHashGetSize(pState->parNameMap) < MAX_TABLE_NAME_NUM) { + if (code == TSDB_CODE_SUCCESS && isFull) { tSimpleHashPut(pState->parNameMap, &groupId, sizeof(int64_t), *pVal, TSDB_TABLE_NAME_LEN); } return code;