From 0a35d7ef6b9a3f7cb26f0ea90d2c3fb0d46bdd47 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Thu, 27 Jun 2024 01:33:25 +0000 Subject: [PATCH] add self check --- source/libs/stream/src/streamBackendRocksdb.c | 7 +++---- source/libs/stream/src/streamCheckpoint.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 5e8f45e8a2..c12ab68607 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -558,7 +558,6 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId goto _EXIT; } - // int32_t pathLen = strlen(path) + 48; char* checkpointRoot = taosMemoryCalloc(1, pathLen + 48); if (checkpointRoot == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -575,15 +574,15 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId stDebug("%s check local backend dir:%s, checkpointId:%" PRId64 " succ", key, defaultPath, chkptId); - char* chkptPath = taosMemoryCalloc(1, pathLen); + char* chkptPath = taosMemoryCalloc(1, pathLen + 128); if (chkptPath == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; goto _EXIT; } if (chkptId > 0) { - snprintf(chkptPath, pathLen, "%s%s%s%s%s%" PRId64 "", prefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", - chkptId); + snprintf(chkptPath, pathLen + 127, "%s%s%s%s%s%" PRId64 "", prefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP, + "checkpoint", chkptId); code = rebuildFromLocalCheckpoint(key, chkptPath, chkptId, defaultPath, processVer); if (code != 0) { diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index af7e969c07..26df7b1627 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -667,7 +667,7 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) { if (pTask->info.taskLevel != TASK_LEVEL__SINK) { stDebug("s-task:%s level:%d start gen checkpoint, checkpointId:%" PRId64, id, pTask->info.taskLevel, ckId); - int64_t ver = 0; + int64_t ver = pTask->chkInfo.processedVer; code = streamBackendDoCheckpoint(pTask->pBackend, ckId, ver); if (code != TSDB_CODE_SUCCESS) { stError("s-task:%s gen checkpoint:%" PRId64 " failed, code:%s", id, ckId, tstrerror(terrno));