Skip to content

Commit

Permalink
crimson/osd: handle PG_STATE_SNAPTRIM_ERROR when trimming snaps
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslaw Zarzynski <[email protected]>
  • Loading branch information
rzarzynski committed Feb 28, 2023
1 parent f091a70 commit 38c030e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/crimson/osd/pg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,13 @@ Context *PG::on_clean()
void PG::on_active_actmap()
{
logger().debug("{}: {} snap_trimq={}", *this, __func__, snap_trimq);
peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR);
std::ignore = seastar::do_until(
[this] { return snap_trimq.empty(); },
[this] { return snap_trimq.empty()
&& !peering_state.state_test(PG_STATE_SNAPTRIM_ERROR);
},
[this] {
peering_state.state_set(PG_STATE_SNAPTRIM);
peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR);
publish_stats_to_osd();
const auto to_trim = snap_trimq.range_start();
snap_trimq.erase(to_trim);
Expand All @@ -468,7 +470,16 @@ void PG::on_active_actmap()
this,
snap_mapper,
to_trim,
needs_pause).second.handle_error(crimson::ct_error::assert_all{});
needs_pause
).second.handle_error(
crimson::ct_error::enoent::handle([this] {
logger().error("{}: ENOENT saw, trimming stopped", *this);
peering_state.state_set(PG_STATE_SNAPTRIM_ERROR);
publish_stats_to_osd();
return seastar::make_ready_future<seastar::stop_iteration>(
seastar::stop_iteration::yes);
})
);
}).then([this, trimmed=to_trim] {
logger().debug("{}: trimmed snap={}", *this, trimmed);
});
Expand Down

0 comments on commit 38c030e

Please sign in to comment.