From 4f471625122ee1c2abd84e36a7491a2a434c5ef2 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 11 Oct 2023 16:36:43 +0800 Subject: [PATCH] refactor backend --- source/libs/stream/src/streamSnapshot.c | 27 +++++++------------------ 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/source/libs/stream/src/streamSnapshot.c b/source/libs/stream/src/streamSnapshot.c index e7bfca8252..25c228e97d 100644 --- a/source/libs/stream/src/streamSnapshot.c +++ b/source/libs/stream/src/streamSnapshot.c @@ -145,14 +145,16 @@ void snapFileDebugInfo(SBackendSnapFile2* pSnapFile) { sprintf(buf, "[current: %s,", pSnapFile->pCurrent); sprintf(buf + strlen(buf), "MANIFEST: %s,", pSnapFile->pMainfest); sprintf(buf + strlen(buf), "options: %s,", pSnapFile->pOptions); - - for (int i = 0; i < taosArrayGetSize(pSnapFile->pSst); i++) { - char* name = taosArrayGetP(pSnapFile->pSst, i); - sprintf(buf + strlen(buf), "%s,", name); + if (pSnapFile->pSst) { + for (int i = 0; i < taosArrayGetSize(pSnapFile->pSst); i++) { + char* name = taosArrayGetP(pSnapFile->pSst, i); + sprintf(buf + strlen(buf), "%s,", name); + } } sprintf(buf + strlen(buf) - 1, "]"); - qInfo("%s get file list: %s", STREAM_STATE_TRANSFER, buf); + qInfo("%s %" PRId64 "-%" PRId64 " get file list: %s", STREAM_STATE_TRANSFER, pSnapFile->snapInfo.streamId, + pSnapFile->snapInfo.taskId, buf); taosMemoryFree(buf); } } @@ -584,21 +586,6 @@ int32_t streamSnapWrite(SStreamSnapWriter* pWriter, uint8_t* pData, uint32_t nDa } int32_t streamSnapWriterClose(SStreamSnapWriter* pWriter, int8_t rollback) { SStreamSnapHandle* handle = &pWriter->handle; - // if (qDebugFlag & DEBUG_DEBUG) { - // char* buf = (char*)taosMemoryMalloc(1024); - // int n = sprintf(buf, "["); - // for (int i = 0; i < taosArrayGetSize(handle->pFileList); i++) { - // SBackendFileItem* item = taosArrayGet(handle->pFileList, i); - // if (i != taosArrayGetSize(handle->pFileList) - 1) { - // n += sprintf(buf + n, "%s %" PRId64 ",", item->name, item->size); - // } else { - // n += sprintf(buf + n, "%s %" PRId64 "]", item->name, item->size); - // } - // } - // qDebug("%s snap get file list, %s", STREAM_STATE_TRANSFER, buf); - // taosMemoryFree(buf); - // } - streamSnapHandleDestroy(handle); taosMemoryFree(pWriter);