From d4c4b4a0b5cabda8a27c7ef412a92821af3333c5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 1 Apr 2011 15:57:46 -0700 Subject: [PATCH] journaler: fix partial tail entry correction If we encounter a partial tail entry, we drop it by moving the write_pos (end of journal) back to read_pos. We also need to reset the read state (read_buf, requested/received_pos) so that subsequent replay attempts won't be horribly confused. Signed-off-by: Sage Weil --- src/osdc/Journaler.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index 9fd00f44d28f9..2cab77c402259 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -745,11 +745,17 @@ bool Journaler::_is_readable() dout(10) << "is_readable() detected partial entry at tail, adjusting write_pos to " << read_pos << dendl; if (write_pos > read_pos) junk_tail_pos = write_pos; // note old tail + + // adjust write_pos write_pos = flush_pos = safe_pos = read_pos; assert(write_buf.length() == 0); + + // reset read state + requested_pos = received_pos = read_pos; + read_buf.clear(); - // truncate? - // FIXME: how much? + // FIXME: truncate on disk? + return false; } -- 2.39.5