]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: manage PG_STATE_SNAPTRIM when trimming snaps
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 19 Dec 2022 20:19:52 +0000 (20:19 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 28 Feb 2023 16:22:05 +0000 (16:22 +0000)
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 <rzarzyns@redhat.com>
src/crimson/osd/pg.cc

index 69076ad82669fefb9af4174a48863be7a98b722f..98da7ff5dba65ea5747d1c0fa0a0ff7039b64b35 100644 (file)
@@ -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();
     });
 }