From f3a22feaceab82c668e4a3b6bfe063b7f859bb2f Mon Sep 17 00:00:00 2001 From: "sjust@redhat.com" Date: Mon, 22 Apr 2019 14:07:06 -0700 Subject: [PATCH] PeeringState: don't zero backfill target num_bytes on activation 834d3c19a774f1cc93903447d91d182776e12d18 preserves num_bytes on backfill targets in order to estimate space required to complete backill. However, from activation until backfill reservation, info.stats.stats.sum.num_bytes is persisted to disk as 0 messing up future intervals. Instead, preserve it in the info sent during recovery and leave it alone in RequestBackfillPrio. Additionally, it's possible for backfill to be preempted between last_backfill=MAX being sent to the replica and Backfilled being queued occuring. In that case, the stats get on reservation and the replica ends up with invalid stats. Fixes: https://tracker.ceph.com/issues/39401 Signed-off-by: sjust@redhat.com --- src/osd/PeeringState.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index f87dadc968e..013ed49b3a7 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -2261,6 +2261,7 @@ void PeeringState::activate( // Save num_bytes for reservation request, can't be negative peer_bytes[peer] = std::max(0, pi.stats.stats.sum.num_bytes); pi.stats.stats.clear(); + pi.stats.stats.sum.num_bytes = peer_bytes[peer]; // initialize peer with our purged_snaps. pi.purged_snaps = info.purged_snaps; @@ -4781,9 +4782,6 @@ PeeringState::RepNotRecovering::react(const RequestBackfillPrio &evt) evt.primary_num_bytes, evt.local_num_bytes)) { post_event(RejectRemoteReservation()); } else { - // Use un-ec-adjusted bytes for stats. - ps->info.stats.stats.sum.num_bytes = evt.local_num_bytes; - PGPeeringEventRef preempt; if (HAVE_FEATURE(ps->upacting_features, RECOVERY_RESERVATION_2)) { // older peers will interpret preemption as TOOFULL -- 2.39.5