From ca5f813c5e992f5d4121e1d983d9bba0a2cc0367 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 28 Mar 2023 09:27:42 +0000 Subject: [PATCH] add backend --- source/libs/stream/src/streamStateRocksdb.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/libs/stream/src/streamStateRocksdb.c b/source/libs/stream/src/streamStateRocksdb.c index 42aa22bdfa..d9e754f2d0 100644 --- a/source/libs/stream/src/streamStateRocksdb.c +++ b/source/libs/stream/src/streamStateRocksdb.c @@ -17,6 +17,7 @@ #include "rocksdb/c.h" #include "streamBackendRocksdb.h" #include "tcommon.h" +#include "tlog.h" // // SStateKey // |--groupid--|---ts------|--opNum----| @@ -562,18 +563,27 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) { qDebug("streamStateClear_rocksdb"); SStateKey sKey = {.key = {.ts = 0, .groupId = 0}, .opNum = pState->number}; - SStateKey eKey = {.key = {.ts = UINT64_MAX, .groupId = INT64_MAX}, .opNum = pState->number}; + SStateKey eKey = {.key = {.ts = INT64_MAX, .groupId = UINT64_MAX}, .opNum = pState->number}; char sKeyStr[128] = {0}; char eKeyStr[128] = {0}; int sLen = stateKeyEncode(&sKey, sKeyStr); - int eLen = stateKeyEncode(&sKey, eKeyStr); + int eLen = stateKeyEncode(&eKey, eKeyStr); + + char toStringStart[128] = {0}; + char toStringEnd[128] = {0}; + + if (qDebugFlag & DEBUG_TRACE) { + stateKeyToString(&sKey, toStringStart); + stateKeyToString(&eKey, toStringEnd); + } char* err = NULL; rocksdb_delete_range_cf(pState->pTdbState->rocksdb, pState->pTdbState->writeOpts, pState->pTdbState->pHandle[0], sKeyStr, sLen, eKeyStr, eLen, &err); if (err != NULL) { - qWarn("failed to delete range cf(default)"); + qWarn("failed to delete range cf(default) err: %s, start: %s, end:%s", err, toStringStart, toStringEnd); + taosMemoryFree(err); } // batch clear later -- GitLab