From 53588ba45c9186b68787581f28ca641b9b8bd3e6 Mon Sep 17 00:00:00 2001 From: Doodle <13706157+critical27@users.noreply.github.com> Date: Tue, 10 May 2022 17:03:54 +0800 Subject: [PATCH] fix listener can't receive snapshot --- src/kvstore/Listener.cpp | 3 +++ src/kvstore/raftex/SnapshotManager.cpp | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kvstore/Listener.cpp b/src/kvstore/Listener.cpp index 3121031e043..523e733c00b 100644 --- a/src/kvstore/Listener.cpp +++ b/src/kvstore/Listener.cpp @@ -147,6 +147,9 @@ void Listener::doApply() { if (isStopped()) { return; } + if (needToCleanupSnapshot()) { + cleanupSnapshot(); + } // todo(doodle): only put is handled, all remove is ignored for now folly::via(executor_.get(), [this] { SCOPE_EXIT { diff --git a/src/kvstore/raftex/SnapshotManager.cpp b/src/kvstore/raftex/SnapshotManager.cpp index 7589e0b2747..0a38eb93e7b 100644 --- a/src/kvstore/raftex/SnapshotManager.cpp +++ b/src/kvstore/raftex/SnapshotManager.cpp @@ -78,11 +78,10 @@ folly::Future>> SnapshotManager::sendSnapshot( } return true; } else { - VLOG(2) << part->idStr_ << "Sending snapshot failed, we don't retry anymore! " - << "The error code is " + VLOG(2) << part->idStr_ << "Sending snapshot failed, the error code is " << apache::thrift::util::enumNameSafe(resp.get_error_code()); - p.setValue(Status::Error("Send snapshot failed!")); - return false; + sleep(1); + continue; } } catch (const std::exception& e) { VLOG(3) << part->idStr_ << "Send snapshot failed, exception " << e.what()