From 9323f25a6a6a3b1c86aef260be971e237945b6dc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 22 Oct 2011 20:41:03 -0700 Subject: [PATCH] osd: fix PG::Log::copy_after wrt backlogs (again) Commit 68fe748fc2d703623050e8f2a448a0fd31ca8a0f fixed half of this problem, but set this->tail incorrectly. If we read olog.tail, the entry we are on is a backlog entry, and probably not other.tail. Do not reset tail in this case because we already set it to other.tail above. OTOH if we hit v, we do want to set this->tail to the current record as it is the one that precedes the first log entry. This fixes an incorrect log.tail send to other nodes, which eventually propagates as a log bound mismatch. For example, 2011-10-22 17:33:18.654693 7f8a2fefe700 osd.4 2788 pg[1.1f( v 1627'28 (1627'28,1627'28] n=2 ec=1 les/c 2763/2782 2788/2788/2788) [4,0] r=0 mlcod 0'0 !hml peering] merge_log log(578'5,1627'28] from osd.0 into log(1627'28,1627'28] 2011-10-22 17:33:18.654706 7f8a2fefe700 osd.4 2788 pg[1.1f( v 1627'28 (1627'28,1627'28] n=2 ec=1 les/c 2763/2782 2788/2788/2788) [4,0] r=0 mlcod 0'0 !hml peering] merge_log extending tail to 578'5 2011-10-22 17:33:18.654720 7f8a2fefe700 osd.4 2788 pg[1.1f( v 1627'28 (578'5,1627'28] n=2 ec=1 les/c 2763/2782 2788/2788/2788) [4,0] r=0 (log bound mismatch, empty) mlcod 0'0 !hml peering] merge_log result log(578'5,1627'28] missing(0) changed=1 This might fix #1526. Signed-off-by: Sage Weil --- src/osd/PG.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5912f39e1fc89..eed29b966cf61 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -54,7 +54,12 @@ void PG::Log::copy_after(const Log &other, eversion_t v) for (list::const_reverse_iterator i = other.log.rbegin(); i != other.log.rend(); i++) { - if (i->version <= v || i->version <= other.tail) { + // stop if we reach the tail; do not copy backlog entries and keep + // tail == other.tail. + if (i->version <= other.tail) + break; + if (i->version <= v) { + // make tail accurate. tail = i->version; break; } -- 2.39.5