From 5b945583ef1ff04283a1424e6951c3119d8b235d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 15 Sep 2018 14:40:18 -0500 Subject: [PATCH] osd/PG: only signal ready_to_merge if we have all replicas Only signal we are ready to merge if all replicas are in good shape. If they aren't, do nothing (yet). Signed-off-by: Sage Weil --- src/osd/PG.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 34ebff9e5886a..b04b0cfa5a96d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2345,16 +2345,20 @@ void PG::try_mark_clean() if (is_active()) { kick_snap_trim(); } else if (is_peered()) { - bool target; - if (pool.info.is_pending_merge(info.pgid.pgid, &target)) { - if (target) { - ldout(cct, 10) << "ready to merge (target)" << dendl; - osd->set_ready_to_merge_target(this, - info.history.last_epoch_clean); - } else { - ldout(cct, 10) << "ready to merge (source)" << dendl; - osd->set_ready_to_merge_source(this); + if (is_clean()) { + bool target; + if (pool.info.is_pending_merge(info.pgid.pgid, &target)) { + if (target) { + ldout(cct, 10) << "ready to merge (target)" << dendl; + osd->set_ready_to_merge_target(this, + info.history.last_epoch_clean); + } else { + ldout(cct, 10) << "ready to merge (source)" << dendl; + osd->set_ready_to_merge_source(this); + } } + } else { +#warning we should back off the merge! } } -- 2.39.5