From 78f35a6450bf7f8c0755650dcc40ce7f840e4ec4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 24 Dec 2010 08:27:38 -0800 Subject: [PATCH] osd: send sufficient log to compensate for replicas with last_complate < log.tail If a replica has last_complete < log.tail and no backlog, send enough log for them to get back into a consistent state. Signed-off-by: Sage Weil --- src/osd/PG.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7175e13b7f175..183974230d1cb 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1840,8 +1840,12 @@ void PG::activate(ObjectStore::Transaction& t, list& tfin, PG::Info& pi = peer_info[peer]; MOSDPGLog *m = 0; - - if (pi.last_update == info.last_update) { + + dout(10) << "activate peer osd" << peer << " " << pi << dendl; + + bool need_old_log_entries = pi.log_tail > pi.last_complete && !pi.log_backlog; + + if (pi.last_update == info.last_update && !need_old_log_entries) { // empty log if (activator_map) { dout(10) << "activate peer osd" << peer << " is up to date, queueing in pending_activators" << dendl; @@ -1855,7 +1859,7 @@ void PG::activate(ObjectStore::Transaction& t, list& tfin, } else { m = new MOSDPGLog(osd->osdmap->get_epoch(), info); - if (pi.log_tail > pi.last_complete && !pi.log_backlog) { + if (need_old_log_entries) { // the replica's tail is after it's last_complete and it has no backlog. // ick, this shouldn't normally happen. but we can compensate! dout(10) << "activate peer osd" << peer << " has last_complete < log tail and no backlog, compensating" << dendl; -- 2.39.5