From d4e67ff3037a3cc7ae2ecc9e1d8d086c45ae515a Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 8 May 2014 13:25:32 -0700 Subject: [PATCH] ReplicatedPG::recover_backfill: do not update last_backfill prematurely Previously, we would update last_backfill on the backfill peer to backfills_in_flight.empty() ? backfill_pos : backfills_in_flight.begin()->first which is actually the next backfill to complete. We want to update last_backfill to the largest completed backfill instead. We use the pending_backfill_updates mapping to identify the most recently completed backfill. Due to the previous patch, deletes will also be included in that mapping. Related sha1s from master: 4139e75d63b0503dbb7fea8036044eda5e8b7cf1 7a06a71e0f2023f66d003dfb0168f4fe51eaa058 We don't really want to backport those due to the changes in: 9ec35d5ccf6a86c380865c7fc96017a1f502560a This patch does essentially the same thing, but using backfill_pos. Fixse: #8162 Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index c1af03de4c8..47b28a412a1 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -7474,18 +7474,23 @@ int ReplicatedPG::recover_backfill( dout(20) << *i << " is still in flight" << dendl; } - hobject_t bound = backfills_in_flight.size() ? + hobject_t next_to_complete = backfills_in_flight.size() ? *(backfills_in_flight.begin()) : backfill_pos; - if (bound > pinfo.last_backfill) { - pinfo.last_backfill = bound; - for (map::iterator i = pending_backfill_updates.begin(); - i != pending_backfill_updates.end() && i->first < bound; - pending_backfill_updates.erase(i++)) { - pinfo.stats.add(i->second); - } + hobject_t pending_last_backfill = pinfo.last_backfill; + for (map::iterator i = pending_backfill_updates.begin(); + i != pending_backfill_updates.end() && i->first < next_to_complete; + pending_backfill_updates.erase(i++)) { + pinfo.stats.add(i->second); + pending_last_backfill = i->first; + } + if (backfills_in_flight.empty() && backfill_pos.is_max()) + pending_last_backfill = hobject_t::get_max(); + + if (pending_last_backfill > pinfo.last_backfill) { + pinfo.last_backfill = pending_last_backfill; epoch_t e = get_osdmap()->get_epoch(); MOSDPGBackfill *m = NULL; - if (bound.is_max()) { + if (pinfo.last_backfill.is_max()) { m = new MOSDPGBackfill(MOSDPGBackfill::OP_BACKFILL_FINISH, e, e, info.pgid); // Use default priority here, must match sub_op priority /* pinfo.stats might be wrong if we did log-based recovery on the @@ -7497,7 +7502,7 @@ int ReplicatedPG::recover_backfill( m = new MOSDPGBackfill(MOSDPGBackfill::OP_BACKFILL_PROGRESS, e, e, info.pgid); // Use default priority here, must match sub_op priority } - m->last_backfill = bound; + m->last_backfill = pinfo.last_backfill; m->stats = pinfo.stats; osd->send_message_osd_cluster(backfill_target, m, get_osdmap()->get_epoch()); } -- 2.47.3