From: Kotresh HR Date: Sun, 1 Feb 2026 06:21:01 +0000 (+0530) Subject: tools/cephfs_mirror: Add crawl-state metric X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=becd6e830638152425bb638844efeaa0e2c8bde4;p=ceph-ci.git tools/cephfs_mirror: Add crawl-state metric Signed-off-by: Kotresh HR --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index eef0237a4e9..0f1e3656f15 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -1403,11 +1403,14 @@ bool PeerReplayer::SyncMechanism::has_pending_work() const { } void PeerReplayer::SyncMechanism::mark_crawl_finished(int ret) { - std::unique_lock lock(sdq_lock); - m_sync_crawl_finished = true; - if (ret < 0) - m_sync_crawl_error = true; - sdq_cv.notify_all(); + { + std::unique_lock lock(sdq_lock); + m_sync_crawl_finished = true; + if (ret < 0) + m_sync_crawl_error = true; + sdq_cv.notify_all(); + } + m_peer_replayer.set_crawl_finished(m_dir_root, true); } // Returns false if there is any error during data sync @@ -2532,6 +2535,10 @@ void PeerReplayer::peer_status(Formatter *f) { f->dump_string("sync-mode", "delta"); else f->dump_string("sync-mode", "full"); + if (sync_stat.crawl_finished) + f->dump_string("crawl-state", "completed"); + else + f->dump_string("crawl-state", "in-progress"); f->open_object_section("current_syncing_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 94622f41fd6..f36e34c476e 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.h +++ b/src/tools/cephfs_mirror/PeerReplayer.h @@ -359,6 +359,7 @@ private: uint64_t files_started = 0; //files picked up for sync counter, independently for each directory sync. uint64_t total_files = 0; //total files counter, independently for each directory sync. bool snapdiff = false; // RemoteSync or Snapdiff + bool crawl_finished = false; // crawl_state - in-progress/completed // actual io accounting uint64_t bytes_read = 0; //actual bytes read counter, independently for each directory sync. uint64_t bytes_written = 0; //actual bytes written counter, independently for each directory sync. @@ -418,6 +419,7 @@ private: sync_stat.files_started = 0; sync_stat.bd_sync_bytes = 0; sync_stat.blockdiff_time_sec = 0; + sync_stat.crawl_finished = false; } void set_current_syncing_snap(const std::string &dir_root, uint64_t snap_id, const std::string &snap_name) { @@ -456,6 +458,11 @@ private: auto &sync_stat = m_snap_sync_stats.at(dir_root); sync_stat.snapdiff = snapdiff; } + void set_crawl_finished(const std::string &dir_root, bool state) { + std::scoped_lock locker(m_lock); + auto &sync_stat = m_snap_sync_stats.at(dir_root); + sync_stat.crawl_finished = state; + } void set_blockdiff_bw(const std::string &dir_root, const uint64_t bd_syncbytes, const double bd_time) { std::scoped_lock locker(m_lock); auto &sync_stat = m_snap_sync_stats.at(dir_root);