From 47d73046ddfcb8c01145f37cfe6bdf24a29dbd7b Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Tue, 13 Feb 2024 19:07:07 +0530 Subject: [PATCH] PeerReplayer: added sync type Signed-off-by: Jos Collin --- src/tools/cephfs_mirror/PeerReplayer.cc | 7 +++++++ src/tools/cephfs_mirror/PeerReplayer.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index bd47046bb1218..f5e18cee303dc 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -1208,6 +1208,12 @@ int PeerReplayer::do_synchronize(const std::string &dir_root, const Snapshot &cu std::stack sync_stack; sync_stack.emplace(SyncEntry(".", tdirp, tstx)); + if (prev) { + set_sync_type(dir_root, "local_scan"); + } else { + set_sync_type(dir_root, "remote_scan"); + } + while (!sync_stack.empty()) { if (should_backoff(dir_root, &r)) { dout(0) << ": backing off r=" << r << dendl; @@ -1546,6 +1552,7 @@ void PeerReplayer::peer_status(Formatter *f) { f->dump_string("state", "idle"); } else { f->dump_string("state", "syncing"); + f->dump_string("sync_type", sync_stat.type); f->open_object_section("current_sycning_snap"); f->dump_unsigned("id", (*sync_stat.current_syncing_snap).first); f->dump_string("name", (*sync_stat.current_syncing_snap).second); diff --git a/src/tools/cephfs_mirror/PeerReplayer.h b/src/tools/cephfs_mirror/PeerReplayer.h index 0511d154a759d..63f5e83086447 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.h +++ b/src/tools/cephfs_mirror/PeerReplayer.h @@ -145,6 +145,7 @@ private: uint64_t nr_failures = 0; // number of consecutive failures boost::optional