]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
JounralingObjectStore: journal->committed_thru after replay 3489/head
authorSage Weil <sage@redhat.com>
Sun, 2 Nov 2014 22:27:12 +0000 (14:27 -0800)
committerLoic Dachary <ldachary@redhat.com>
Mon, 26 Jan 2015 15:57:57 +0000 (16:57 +0100)
It's possible that the osd stopped between when the filestore
op_seq file was updated and when the journal was trimmed.  In
that case, it's possible that on boot the journal might be
full, and yet not be trimmed because commit_start assumes
there is no work to do.  Calling committed_thru on the journal
ensures that the journal matches committed_seq.

Backport: giant firefly emperor dumpling
Fixes: #6756
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit 8924158df8580bbb462130b5bb7f753b13513a23)

src/os/FileJournal.cc

index 2c9e73265c90445658ad4c3a9fffe89a710c91ee..dc3a46a91993efb81e7da3724c6785d1c549aa9c 100644 (file)
@@ -469,7 +469,6 @@ int FileJournal::open(uint64_t fs_op_seq)
 {
   dout(2) << "open " << fn << " fsid " << fsid << " fs_op_seq " << fs_op_seq << dendl;
 
-  last_committed_seq = fs_op_seq;
   uint64_t next_seq = fs_op_seq + 1;
 
   int err = _open(false);
@@ -528,6 +527,16 @@ int FileJournal::open(uint64_t fs_op_seq)
   // find next entry
   read_pos = header.start;
   uint64_t seq = header.start_seq;
+
+  // last_committed_seq is 1 before the start of the journal or
+  // 0 if the start is 0
+  last_committed_seq = seq > 0 ? seq - 1 : seq;
+  if (last_committed_seq < fs_op_seq) {
+    dout(2) << "open advancing committed_seq " << last_committed_seq
+           << " to fs op_seq " << fs_op_seq << dendl;
+    last_committed_seq = fs_op_seq;
+  }
+
   while (1) {
     bufferlist bl;
     off64_t old_pos = read_pos;