]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PeeringState: Add logs to calc_min_ondisk()
authorMatan Breizman <mbreizma@redhat.com>
Wed, 30 Nov 2022 14:29:54 +0000 (14:29 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 8 Mar 2023 13:23:23 +0000 (13:23 +0000)
Minor refactor

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/osd/PeeringState.cc
src/osd/PeeringState.h

index 8c7c15ee7e2ec72089a3ae5f73e1c2d3a8565ccf..13842189ecdf6d8e12aaa1a95ad279bb505b418e 100644 (file)
@@ -3104,6 +3104,35 @@ void PeeringState::proc_replica_log(
   peer_missing[from].claim(std::move(omissing));
 }
 
+/**
+* Update min_last_complete_ondisk to the minimum
+* last_complete_ondisk version informed by each peer.
+*/
+void PeeringState::calc_min_last_complete_ondisk() {
+  ceph_assert(!acting_recovery_backfill.empty());
+  eversion_t min = last_complete_ondisk;
+  for (const auto& pg_shard : acting_recovery_backfill) {
+    if (pg_shard == get_primary()) {
+      continue;
+    }
+    if (peer_last_complete_ondisk.count(pg_shard) == 0) {
+      psdout(20) << __func__ <<  " no complete info on: "
+                 << pg_shard << dendl;
+      return;
+    }
+    if (peer_last_complete_ondisk[pg_shard] < min) {
+      min = peer_last_complete_ondisk[pg_shard];
+    }
+  }
+  if (min != min_last_complete_ondisk) {
+    psdout(20) << __func__ << " last_complete_ondisk is "
+               << "updated to: " << min
+               << " from: " << min_last_complete_ondisk
+               << dendl;
+    min_last_complete_ondisk = min;
+  }
+}
+
 void PeeringState::fulfill_info(
   pg_shard_t from, const pg_query_t &query,
   pair<pg_shard_t, pg_info_t> &notify_info)
index 45a3c0a9cc3fbba57f45e728cba9792294ceb397..262c493ef7eaf13aa1f20078dc8d17b9ae4a8257 100644 (file)
@@ -1685,24 +1685,7 @@ public:
   void proc_replica_log(pg_info_t &oinfo, const pg_log_t &olog,
                        pg_missing_t&& omissing, pg_shard_t from);
 
-  void calc_min_last_complete_ondisk() {
-    eversion_t min = last_complete_ondisk;
-    ceph_assert(!acting_recovery_backfill.empty());
-    for (std::set<pg_shard_t>::iterator i = acting_recovery_backfill.begin();
-        i != acting_recovery_backfill.end();
-        ++i) {
-      if (*i == get_primary()) continue;
-      if (peer_last_complete_ondisk.count(*i) == 0)
-       return;   // we don't have complete info
-      eversion_t a = peer_last_complete_ondisk[*i];
-      if (a < min)
-       min = a;
-    }
-    if (min == min_last_complete_ondisk)
-      return;
-    min_last_complete_ondisk = min;
-    return;
-  }
+  void calc_min_last_complete_ondisk();
 
   void fulfill_info(
     pg_shard_t from, const pg_query_t &query,