From: Sage Weil Date: Fri, 1 Apr 2011 22:57:46 +0000 (-0700) Subject: journaler: fix partial tail entry correction X-Git-Tag: v0.27~170 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d4c4b4a0b5cabda8a27c7ef412a92821af3333c5;p=ceph.git 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 --- 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; }