From 73dbcd675ba89860803b74ccbf2572209cddef0b Mon Sep 17 00:00:00 2001 From: Chengyu Liu Date: Mon, 15 Jan 2024 21:03:51 +0800 Subject: [PATCH] fix: duplicate closing files(#2304) (#2311) Co-authored-by: liuchengyu --- src/rsync_client.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/rsync_client.cc b/src/rsync_client.cc index 09c6313b86..8a8c049a4f 100644 --- a/src/rsync_client.cc +++ b/src/rsync_client.cc @@ -166,7 +166,7 @@ Status RsyncClient::CopyRemoteFile(const std::string& filename, int index) { while (retries < max_retries_) { if (state_.load() != RUNNING) { break; - } + } size_t copy_file_begin_time = pstd::NowMicros(); size_t count = Throttle::GetInstance().ThrottledByThroughput(kBytesPerRequest); if (count == 0) { @@ -227,12 +227,7 @@ Status RsyncClient::CopyRemoteFile(const std::string& filename, int index) { s = writer->Fsync(); if (!s.ok()) { return s; - } - s = writer->Close(); - if (!s.ok()) { - return s; - } - writer.reset(); + } mu_.lock(); meta_table_[filename] = ""; mu_.unlock();