]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools/cephfs_mirror: Add crawl-state metric wip-khiremat-mulithread-mirror-66572-debug
authorKotresh HR <khiremat@redhat.com>
Sun, 1 Feb 2026 06:21:01 +0000 (11:51 +0530)
committerKotresh HR <khiremat@redhat.com>
Wed, 4 Feb 2026 08:53:14 +0000 (14:23 +0530)
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/tools/cephfs_mirror/PeerReplayer.cc
src/tools/cephfs_mirror/PeerReplayer.h

index eef0237a4e987c18aacbc815a42dc4dba5d0e2c4..0f1e3656f15f8b74cb251936147698541d202b3d 100644 (file)
@@ -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);
index 94622f41fd6bee70ec712b2520ab90d19c473fe4..f36e34c476e80731e1e0d106865c83a18721f92f 100644 (file)
@@ -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);