From 2c2062cfca6e82612d7b177530c10d322dfbfd8b Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 19 Nov 2020 17:46:51 +0100 Subject: [PATCH] crimson: fix the condition in the loop of BackfillState::Enqueuing. 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 --- src/crimson/osd/backfill_state.cc | 15 ++++++++++++++- src/crimson/osd/backfill_state.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/crimson/osd/backfill_state.cc b/src/crimson/osd/backfill_state.cc index f92a6b50cc35..56674792ad9c 100644 --- a/src/crimson/osd/backfill_state.cc +++ b/src/crimson/osd/backfill_state.cc @@ -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& 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; diff --git a/src/crimson/osd/backfill_state.h b/src/crimson/osd/backfill_state.h index f2995883e677..e742fd10a9a0 100644 --- a/src/crimson/osd/backfill_state.h +++ b/src/crimson/osd/backfill_state.h @@ -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& peer_backfill_info) const; hobject_t earliest_peer_backfill( const std::map& peer_backfill_info) const; bool should_rescan_replicas( -- 2.47.3