From c76f886c91923946d5014cf864b287a7ad029a34 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 24 Apr 2024 09:36:44 +0800 Subject: [PATCH] fix(s3migrate/datas3): init fd of from & to early --- source/dnode/vnode/src/tsdb/tsdbRetention.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 2e0b44f5f8..45c63cb4f1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -553,10 +553,11 @@ _exit: } static int32_t tsdbMigrateDataFileS3(SRTNer *rtner, const STFileObj *fobj, int64_t size, int64_t chunksize) { - int32_t code = 0; - int32_t lino = 0; - STFileOp op = {0}; - int32_t lcn = (size - 1) / chunksize + 1; + int32_t code = 0; + int32_t lino = 0; + STFileOp op = {0}; + int32_t lcn = (size - 1) / chunksize + 1; + TdFilePtr fdFrom = NULL, fdTo = NULL; // remove old op = (STFileOp){ @@ -615,9 +616,8 @@ static int32_t tsdbMigrateDataFileS3(SRTNer *rtner, const STFileObj *fobj, int64 } // copy last chunk - TdFilePtr fdFrom = NULL, fdTo = NULL; - int64_t lc_offset = (int64_t)(lcn - 1) * chunksize; - int64_t lc_size = size - lc_offset; + int64_t lc_offset = (int64_t)(lcn - 1) * chunksize; + int64_t lc_size = size - lc_offset; dot = strchr(object_name, '.'); if (!dot) {