From e0bb0217962a53efc85f011b7281e2517e94725f Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 19 Dec 2022 20:19:52 +0000 Subject: [PATCH] crimson/osd: manage PG_STATE_SNAPTRIM when trimming snaps After a few tries: ``` $ bin/ceph -s *** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH *** 2022-12-19T20:18:21.856+0000 7ff87b46f700 -1 WARNING: all dangerous and experimental features are enabled. 2022-12-19T20:18:21.857+0000 7ff87b46f700 1 build_initial for_mkfs: 0 2022-12-19T20:18:21.860+0000 7ff87b46f700 -1 WARNING: all dangerous and experimental features are enabled. 2022-12-19T20:18:21.861+0000 7ff87b46f700 1 build_initial for_mkfs: 0 cluster: id: 347aedc9-d72f-4a34-98fc-26cb04b0c2fc health: HEALTH_WARN 11 mgr modules have failed dependencies 1 pool(s) do not have an application enabled 1 pool(s) have no replicas configured services: mon: 1 daemons, quorum a (age 3m) mgr: x(active, since 3m) osd: 1 osds: 1 up (since 3m), 1 in (since 3m) data: pools: 1 pools, 1 pgs objects: 95 objects, 6 B usage: 1.0 GiB used, 100 GiB / 101 GiB avail pgs: 1 active+clean+snaptrim io: client: 1.2 KiB/s wr, 0 op/s rd, 1 op/s wr ``` Signed-off-by: Radoslaw Zarzynski --- src/crimson/osd/pg.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 69076ad8266..98da7ff5dba 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -455,6 +455,9 @@ void PG::on_active_actmap() std::ignore = seastar::do_until( [this] { return snap_trimq.empty(); }, [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); const auto needs_pause = !snap_trimq.empty(); @@ -469,6 +472,9 @@ void PG::on_active_actmap() }).then([this, trimmed=to_trim] { logger().debug("{}: trimmed snap={}", *this, trimmed); }); + }).finally([this] { + peering_state.state_clear(PG_STATE_SNAPTRIM); + publish_stats_to_osd(); }); } -- 2.39.5