From 872291686d21fe9ac8345e8560c54b0adb1bf2ab Mon Sep 17 00:00:00 2001 From: Shungang Li Date: Mon, 19 Aug 2024 14:02:10 +0800 Subject: [PATCH] enh: ttl add more debug info --- source/dnode/vnode/src/meta/metaTtl.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaTtl.c b/source/dnode/vnode/src/meta/metaTtl.c index b5436af2bf..cd1aa7bcad 100644 --- a/source/dnode/vnode/src/meta/metaTtl.c +++ b/source/dnode/vnode/src/meta/metaTtl.c @@ -254,6 +254,16 @@ static int32_t ttlMgrFindExpiredOneEntry(const void *pKey, int keyLen, const voi return c; } +// static int32_t ttlMgrDumpOneEntry(const void *pKey, int keyLen, const void *pVal, int valLen, void *pDumpCtx) { +// STtlIdxKeyV1 *ttlKey = (STtlIdxKeyV1 *)pKey; +// int64_t *ttlDays = (int64_t *)pVal; + +// metaInfo("ttlMgr dump, ttl: %" PRId64 ", ctime: %" PRId64 ", uid: %" PRId64, *ttlDays, ttlKey->deleteTimeMs, +// ttlKey->uid); + +// TAOS_RETURN(TSDB_CODE_SUCCESS); +// } + static int ttlMgrConvert(TTB *pOldTtlIdx, TTB *pNewTtlIdx, void *pMeta) { SMeta *meta = pMeta; @@ -409,8 +419,8 @@ int32_t ttlMgrFlush(STtlManger *pTtlMgr, TXN *pTxn) { STtlCacheEntry *cacheEntry = taosHashGet(pTtlMgr->pTtlCache, pUid, sizeof(*pUid)); if (cacheEntry == NULL) { - metaInfo("%s, ttlMgr flush failed to get ttl cache, might be restoring, uid: %" PRId64 ", type: %d", - pTtlMgr->logPrefix, *pUid, pEntry->type); + metaInfo("%s, ttlMgr flush failed to get ttl cache, uid: %" PRId64 ", type: %d", pTtlMgr->logPrefix, *pUid, + pEntry->type); code = taosHashRemove(pTtlMgr->pDirtyUids, pUid, sizeof(*pUid)); if (TSDB_CODE_SUCCESS != code) { metaError("%s, ttlMgr flush failed to remove dirty uid since %s", pTtlMgr->logPrefix, tstrerror(code)); @@ -454,6 +464,10 @@ int32_t ttlMgrFlush(STtlManger *pTtlMgr, TXN *pTxn) { goto _out; } + metaDebug("isdel:%d", pEntry->type == ENTRY_TYPE_DELETE); + metaDebug("ttlkey:%" PRId64 ", uid:%" PRId64, ttlKey.deleteTimeMs, ttlKey.uid); + metaDebug("ttlkeyDirty:%" PRId64 ", uid:%" PRId64, ttlKeyDirty.deleteTimeMs, ttlKeyDirty.uid); + code = taosHashRemove(pTtlMgr->pDirtyUids, pUid, sizeof(*pUid)); if (TSDB_CODE_SUCCESS != code) { metaError("%s, ttlMgr flush failed to remove dirty uid since %s", pTtlMgr->logPrefix, tstrerror(code));