// Find all check peers that have the wrong version
if (const eversion_t& obj_v = primary_bi.objects.begin()->second;
check == primary_bi.begin && check == peer_bi.begin) {
- if(peer_bi.objects.begin()->second != obj_v) {
- backfill_state().progress_tracker->enqueue_push(primary_bi.begin);
- backfill_listener().enqueue_push(bt, primary_bi.begin, obj_v);
+ if(peer_bi.objects.begin()->second != obj_v &&
+ backfill_state().progress_tracker->enqueue_push(primary_bi.begin)) {
+ backfill_listener().enqueue_push(primary_bi.begin, obj_v);
} else {
- // it's fine, keep it!
+ // it's fine, keep it! OR already recovering
}
result.pbi_targets.insert(bt);
} else {
// Only include peers that we've caught up to their backfill line
// otherwise, they only appear to be missing this object
// because their peer_bi.begin > backfill_info.begin.
- if (primary_bi.begin > peering_state().get_peer_last_backfill(bt)) {
- backfill_state().progress_tracker->enqueue_push(primary_bi.begin);
- backfill_listener().enqueue_push(bt, primary_bi.begin, obj_v);
+ if (primary_bi.begin > peering_state().get_peer_last_backfill(bt) &&
+ backfill_state().progress_tracker->enqueue_push(primary_bi.begin)) {
+ backfill_listener().enqueue_push(primary_bi.begin, obj_v);
}
}
}
return registry.empty();
}
-void BackfillState::ProgressTracker::enqueue_push(const hobject_t& obj)
+bool BackfillState::ProgressTracker::enqueue_push(const hobject_t& obj)
{
- ceph_assert(registry.count(obj) == 0);
- registry[obj] = registry_item_t{ op_stage_t::enqueued_push, std::nullopt };
+ [[maybe_unused]] const auto [it, first_seen] = registry.try_emplace(
+ obj, registry_item_t{op_stage_t::enqueued_push, std::nullopt});
+ return first_seen;
}
void BackfillState::ProgressTracker::enqueue_drop(const hobject_t& obj)
{
- ceph_assert(registry.count(obj) == 0);
- registry[obj] = registry_item_t{ op_stage_t::enqueued_drop, pg_stat_t{} };
+ registry.try_emplace(
+ obj, registry_item_t{op_stage_t::enqueued_drop, pg_stat_t{}});
}
void BackfillState::ProgressTracker::complete_to(
const hobject_t& begin) = 0;
virtual void enqueue_push(
- const pg_shard_t& target,
const hobject_t& obj,
const eversion_t& v) = 0;
bool tracked_objects_completed() const;
- void enqueue_push(const hobject_t&);
+ bool enqueue_push(const hobject_t&);
void enqueue_drop(const hobject_t&);
void complete_to(const hobject_t&, const pg_stat_t&);
};
}
void PGRecovery::enqueue_push(
- const pg_shard_t& target,
const hobject_t& obj,
const eversion_t& v)
{
- logger().debug("{}: target={} obj={} v={}",
- __func__, target, obj, v);
+ logger().debug("{}: obj={} v={}",
+ __func__, obj, v);
pg->get_recovery_backend()->add_recovering(obj);
std::ignore = pg->get_recovery_backend()->recover_object(obj, v).\
handle_exception([] (auto) {
const hobject_t& begin) override;
void enqueue_push(
- const pg_shard_t& target,
const hobject_t& obj,
const eversion_t& v) override;
}
void BackfillFixture::enqueue_push(
- const pg_shard_t& target,
const hobject_t& obj,
const eversion_t& v)
{
- backfill_targets.at(target).store.push(obj, v);
+ for (auto& [ _, bt ] : backfill_targets) {
+ bt.store.push(obj, v);
+ }
schedule_event(crimson::osd::BackfillState::ObjectPushed{ obj });
}