]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
journal: differentiate corruption vs missing entry errors
authorJason Dillaman <dillaman@redhat.com>
Tue, 23 Feb 2016 13:18:36 +0000 (08:18 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 26 Feb 2016 16:50:36 +0000 (11:50 -0500)
librbd should treat the corruption of the journal differently from
missing journal entries.  If entries are missing, it might be the
result of a crash and the journal should just be replayed through
the most recent, consistent entry.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/journal/JournalPlayer.cc
src/journal/ObjectPlayer.cc
src/test/journal/test_JournalPlayer.cc
src/test/journal/test_ObjectPlayer.cc

index 45505a37708c805d7b6e8b0bf11d47ff3d213203..08513550fa4b626363166eae8a86764228997a35 100644 (file)
@@ -164,7 +164,7 @@ bool JournalPlayer::try_pop_front(Entry *entry, uint64_t *commit_tid) {
 
     m_state = STATE_ERROR;
     m_journal_metadata->get_finisher().queue(new C_HandleComplete(
-      m_replay_handler), -EINVAL);
+      m_replay_handler), -ENOMSG);
     return false;
   }
 
index 56459a5bc684d9b91419c2b5a2c8993f299cae02..2aca0d73b47b8a553b5a04a0a151497fc2d08970 100644 (file)
@@ -161,7 +161,7 @@ int ObjectPlayer::handle_fetch_complete(int r, const bufferlist &bl) {
   }
 
   if (!m_invalid_ranges.empty()) {
-    r = -EINVAL;
+    r = -EBADMSG;
   }
   return r;
 }
index 66363272bd479add58f054c75ac3692ecfb9e840..28a24b583b75dc23786f8da84d23a399b9137c23 100644 (file)
@@ -310,7 +310,7 @@ TEST_F(TestJournalPlayer, PrefetchCorruptSequence) {
   uint64_t commit_tid;
   ASSERT_FALSE(player->try_pop_front(&entry, &commit_tid));
   ASSERT_TRUE(wait_for_complete(player));
-  ASSERT_NE(0, m_replay_hander.complete_result);
+  ASSERT_EQ(-ENOMSG, m_replay_hander.complete_result);
 }
 
 TEST_F(TestJournalPlayer, PrefetchAndWatch) {
index 86bf3ca5bfc2f974993b5e6e8c651fc06ec7a4db..586f97094a6da50d662f0feb9dd1f4877bf7785a 100644 (file)
@@ -141,7 +141,7 @@ TEST_F(TestObjectPlayer, FetchCorrupt) {
 
   C_SaferCond cond;
   object->fetch(&cond);
-  ASSERT_EQ(-EINVAL, cond.wait());
+  ASSERT_EQ(-EBADMSG, cond.wait());
 
   journal::ObjectPlayer::Entries entries;
   object->get_entries(&entries);