From 8cf08f3ab8803affb3fb470779f1d8b739be8ada Mon Sep 17 00:00:00 2001 From: Neha Ojha Date: Tue, 20 Feb 2018 20:57:20 -0800 Subject: [PATCH] PG: add location to missing_loc only during async_recovery Signed-off-by: Neha Ojha --- src/osd/PrimaryLogPG.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 2df6297b468d7..7f9bd5cdb08fa 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -10077,10 +10077,12 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) ++i) { dout(10) << __func__ << " shard " << i->first << " before missing " << (i->second).get_items() << dendl; } + bool requires_missing_loc = false; for (set::iterator i = async_recovery_targets.begin(); i != async_recovery_targets.end(); ++i) { if (*i == get_primary() || !peer_missing[*i].is_missing(soid)) continue; + requires_missing_loc = true; for (auto &&entry: ctx->log) { peer_missing[*i].add_next_event(entry); } @@ -10114,12 +10116,14 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) missing_loc.remove_location(soid, peer); } - for (set::const_iterator i = actingset.begin(); - i != actingset.end(); - ++i) { - pg_shard_t peer(*i); - if (!peer_missing[peer].is_missing(soid)) - missing_loc.add_location(soid, peer); + if (requires_missing_loc) { + for (set::const_iterator i = actingset.begin(); + i != actingset.end(); + ++i) { + pg_shard_t peer(*i); + if (!peer_missing[peer].is_missing(soid)) + missing_loc.add_location(soid, peer); + } } dout(10) << __func__ << " missing_loc after: " << missing_loc.get_locations(soid) << dendl; -- 2.39.5