]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
journaler: fix partial tail entry correction
authorSage Weil <sage@newdream.net>
Fri, 1 Apr 2011 22:57:46 +0000 (15:57 -0700)
committerSage Weil <sage@newdream.net>
Fri, 1 Apr 2011 22:57:46 +0000 (15:57 -0700)
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 <sage@newdream.net>
src/osdc/Journaler.cc

index 9fd00f44d28f90e3a843c656d3c20482a4379dea..2cab77c40225994b9669a4981d8b342e35ef6472 100644 (file)
@@ -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;
   }