]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: fix the condition in the loop of BackfillState::Enqueuing. 36118/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 19 Nov 2020 16:46:51 +0000 (17:46 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 1 Dec 2020 12:55:27 +0000 (13:55 +0100)
The bug here was that if a backfill target has an object-to-delete
placed after the very last object of primary, it will be missed.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/backfill_state.cc
src/crimson/osd/backfill_state.h

index f92a6b50cc35f272c6e9c8d112d03ff5e337f8dd..56674792ad9c83a13e5ddd855cd71a374e320306 100644 (file)
@@ -278,6 +278,19 @@ BackfillState::Enqueuing::update_on_peers(const hobject_t& check)
   return result;
 }
 
+bool BackfillState::Enqueuing::Enqueuing::all_emptied(
+  const BackfillInterval& local_backfill_info,
+  const std::map<pg_shard_t, BackfillInterval>& peer_backfill_info) const
+{
+  const auto& targets = peering_state().get_backfill_targets();
+  const auto replicas_emptied =
+    std::all_of(std::begin(targets), std::end(targets),
+      [&] (const auto& bt) {
+        return peer_backfill_info.at(bt).empty();
+      });
+  return local_backfill_info.empty() && replicas_emptied;
+}
+
 BackfillState::Enqueuing::Enqueuing(my_context ctx)
   : my_base(ctx)
 {
@@ -299,7 +312,7 @@ BackfillState::Enqueuing::Enqueuing(my_context ctx)
   }
   trim_backfill_infos();
 
-  while (!primary_bi.empty()) {
+  while (!all_emptied(primary_bi, backfill_state().peer_backfill_info)) {
     if (!backfill_listener().budget_available()) {
       post_event(RequestWaiting{});
       return;
index f2995883e6775c46fa779125576850dce52a5b00..e742fd10a9a0f3eca5fc5721b0c74126ffba64d9 100644 (file)
@@ -169,6 +169,9 @@ public:
 
     // these methods take BackfillIntervals instead of extracting them from
     // the state to emphasize the relationships across the main loop.
+    bool all_emptied(
+      const BackfillInterval& local_backfill_info,
+      const std::map<pg_shard_t, BackfillInterval>& peer_backfill_info) const;
     hobject_t earliest_peer_backfill(
       const std::map<pg_shard_t, BackfillInterval>& peer_backfill_info) const;
     bool should_rescan_replicas(