From 968e3cf1eaed47ece69a22c75c043c7f59395f73 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 16 Jun 2023 10:00:17 +0800 Subject: [PATCH] lru/applyF: fix ret value --- source/dnode/vnode/src/tsdb/tsdbCache.c | 9 +++++++-- source/util/src/tlrucache.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index b334f90edd..a739140200 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -235,6 +235,7 @@ static void rocksMayWrite(STsdb *pTsdb, bool force, bool read, bool lock) { tsdbError("vgId:%d, %s failed at line %d, count: %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, count, err); rocksdb_free(err); + // pTsdb->flushState.flush_count = 0; } rocksdb_writebatch_clear(wb); @@ -485,7 +486,9 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow } } - pLastCol->dirty = 1; + if (!pLastCol->dirty) { + pLastCol->dirty = 1; + } /* char *value = NULL; size_t vlen = 0; @@ -530,7 +533,9 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow } } - pLastCol->dirty = 1; + if (!pLastCol->dirty) { + pLastCol->dirty = 1; + } /* char *value = NULL; size_t vlen = 0; diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 1e31ce052e..3de159797f 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -156,7 +156,7 @@ static int taosLRUEntryTableApplyF(SLRUEntryTable *table, _taos_lru_functor_t fu SLRUEntry *n = h->nextHash; ASSERT(TAOS_LRU_ENTRY_IN_CACHE(h)); ret = functor(h->keyData, h->keyLength, h->value, ud); - if (!ret) { + if (ret) { return ret; } h = n; @@ -758,7 +758,7 @@ void taosLRUCacheErase(SLRUCache *cache, const void *key, size_t keyLen) { void taosLRUCacheApply(SLRUCache *cache, _taos_lru_functor_t functor, void *ud) { int numShards = cache->numShards; for (int i = 0; i < numShards; ++i) { - if (0 != taosLRUCacheShardApply(&cache->shards[i], functor, ud)) { + if (taosLRUCacheShardApply(&cache->shards[i], functor, ud)) { break; } }