]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
journal: properly advance read offset after skipping invalid range 28814/head
authorMykola Golub <mgolub@suse.com>
Tue, 18 Jun 2019 09:24:28 +0000 (12:24 +0300)
committerMykola Golub <mgolub@suse.com>
Mon, 1 Jul 2019 10:56:56 +0000 (13:56 +0300)
Fixes: https://tracker.ceph.com/issues/40409
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 7b8fd11fc6f49ca69a8484ee4b175b530b2dd2a3)

src/journal/ObjectPlayer.cc
src/test/journal/test_ObjectPlayer.cc

index d5a8b0d6078e2c9bde0b5533672117b28030a83f..f00bf16460576f92b93bdd6bee23109f7946001f 100644 (file)
@@ -172,6 +172,8 @@ int ObjectPlayer::handle_fetch_complete(int r, const bufferlist &bl,
       m_invalid_ranges.insert(invalid_start_off,
                               invalid_end_off - invalid_start_off);
       invalid = false;
+
+      m_read_bl_off = invalid_end_off;
     }
 
     EntryKey entry_key(std::make_pair(entry.get_tag_tid(),
index 3c255c9ed6ccf5b423bdbb589bae9c2b39a1ea2c..b78bd219f85ad515c1d0c941bd6d93ae51fd7ea4 100644 (file)
@@ -155,21 +155,25 @@ TYPED_TEST(TestObjectPlayer, FetchCorrupt) {
 
   journal::Entry entry1(234, 123, this->create_payload(std::string(24, '1')));
   journal::Entry entry2(234, 124, this->create_payload(std::string(24, '2')));
+  journal::Entry entry3(234, 125, this->create_payload(std::string(24, '3')));
 
   bufferlist bl;
   encode(entry1, bl);
-  encode(this->create_payload("corruption"), bl);
+  encode(this->create_payload("corruption" + std::string(1024, 'X')), bl);
   encode(entry2, bl);
+  encode(this->create_payload("corruption" + std::string(1024, 'Y')), bl);
+  encode(entry3, bl);
   ASSERT_EQ(0, this->append(this->get_object_name(oid), bl));
 
   journal::ObjectPlayerPtr object = this->create_object(oid, 14);
   ASSERT_EQ(-EBADMSG, this->fetch(object));
+  ASSERT_EQ(0, this->fetch(object));
 
   journal::ObjectPlayer::Entries entries;
   object->get_entries(&entries);
-  ASSERT_EQ(2U, entries.size());
+  ASSERT_EQ(3U, entries.size());
 
-  journal::ObjectPlayer::Entries expected_entries = {entry1, entry2};
+  journal::ObjectPlayer::Entries expected_entries = {entry1, entry2, entry3};
   ASSERT_EQ(expected_entries, entries);
 }