]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: re-cache peer_bytes on every peering state activate
authorMykola Golub <mgolub@suse.com>
Mon, 30 Aug 2021 06:58:04 +0000 (07:58 +0100)
committerMykola Golub <mgolub@suse.com>
Wed, 6 Oct 2021 17:39:14 +0000 (20:39 +0300)
peer_bytes is used for backfill reservation request and may be
reset if backfill is interrupted, and we want it set back before
continuing backfill and re-sending the reservation request.

Fixes: https://tracker.ceph.com/issues/52448
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit bdfdf96d2f6c3cf7e5595ae5b8238fd4c0b3c6bc)

src/osd/PeeringState.cc

index 355ba78ed6ca2c534cdcff40592e17204bb71529..ac951a4a9f391f672dad6964c7bbaf9e8377f685 100644 (file)
@@ -2802,6 +2802,9 @@ void PeeringState::activate(
 
       bool needs_past_intervals = pi.dne();
 
+      // Save num_bytes for backfill reservation request, can't be negative
+      peer_bytes[peer] = std::max<int64_t>(0, pi.stats.stats.sum.num_bytes);
+
       if (pi.last_update == info.last_update) {
         // empty log
        if (!pi.last_backfill.is_max())
@@ -2852,8 +2855,6 @@ void PeeringState::activate(
        pi.last_interval_started = info.last_interval_started;
        pi.history = info.history;
        pi.hit_set = info.hit_set;
-        // Save num_bytes for reservation request, can't be negative
-        peer_bytes[peer] = std::max<int64_t>(0, pi.stats.stats.sum.num_bytes);
         pi.stats.stats.clear();
         pi.stats.stats.sum.num_bytes = peer_bytes[peer];