From ca8f6036688117f7b7a743ac6ca5b512564d2674 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 16 Oct 2011 16:07:12 -0700 Subject: [PATCH] osd: fix assemble_backlog This was written assuming that le->prior_version wouldn't be the version that we have locally on disk. Not always true! If it is the same, then we can just keep the entry (and clear reqid). If it is different, keep the behavior we had (re-add, erase current). FWIW the last time this was touched was 916b1998. Signed-off-by: Sage Weil --- src/osd/PG.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ccc60f32ec574..4766d61d78c9d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -790,14 +790,21 @@ void PG::assemble_backlog(map& omap) // note the prior version if (le->prior_version == eversion_t() || // either new object, or le->prior_version > log.tail) { // prior_version also already in log - dout(15) << " skipping " << be << " (have " << *le << ")" << dendl; - } else { - be.version = le->prior_version; - be.reqid = osd_reqid_t(); - dout(15) << " adding prior_version " << be << " (have " << *le << ")" << dendl; - omap[be.version] = be; - // don't try to index: this is the prior_version backlog entry + dout(15) << " dropping " << be << " (have " << *le << ")" << dendl; + omap.erase(i++); + continue; } + + be.reqid = osd_reqid_t(); + if (be.version == le->prior_version) { + dout(15) << " keeping prior_version " << be << " (have " << *le << ")" << dendl; + i++; + continue; + } + + be.version = le->prior_version; + dout(15) << " adding prior_version " << be << " (have " << *le << ")" << dendl; + omap[be.version] = be; omap.erase(i++); } else { i++; @@ -813,6 +820,10 @@ void PG::assemble_backlog(map& omap) if (be.reqid != osd_reqid_t()) // don't index prior_version backlog entries log.index( *log.log.begin() ); } + + dout(25) << "result:\n"; + log.print(*_dout); + *_dout << dendl; } -- 2.39.5