diff options
author | Jason Dillaman <dillaman@redhat.com> | 2016-05-13 20:49:07 +0200 |
---|---|---|
committer | Jason Dillaman <dillaman@redhat.com> | 2016-05-18 17:02:28 +0200 |
commit | 6056f8c45c99bd37cb18933a37cc238c7e9a7c7d (patch) | |
tree | bf0a8a5b0a0dc40ac7bdd60020bcb911a58d76a6 /src/test/journal | |
parent | Merge pull request #8747 from jcsp/wip-15599 (diff) | |
download | ceph-6056f8c45c99bd37cb18933a37cc238c7e9a7c7d.tar.xz ceph-6056f8c45c99bd37cb18933a37cc238c7e9a7c7d.zip |
journal: re-fetch active object before advancing set during replay
During a live replay, it's possible that an append and and overflow
into the next object could race with the live playback of the same
object. Re-fetch an "empty" object at least once before advancing
to next set to ensure all records have been read.
Fixes: http://tracker.ceph.com/issues/15665
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test/journal')
-rw-r--r-- | src/test/journal/test_JournalPlayer.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/journal/test_JournalPlayer.cc b/src/test/journal/test_JournalPlayer.cc index f989dd536b7..7ad92be3e2c 100644 --- a/src/test/journal/test_JournalPlayer.cc +++ b/src/test/journal/test_JournalPlayer.cc @@ -452,3 +452,48 @@ TEST_F(TestJournalPlayer, ImbalancedJournal) { ASSERT_TRUE(metadata->get_last_allocated_entry_tid(301, &last_tid)); ASSERT_EQ(3U, last_tid); } + +TEST_F(TestJournalPlayer, LiveReplayLaggyAppend) { + std::string oid = get_temp_oid(); + + cls::journal::ObjectSetPosition commit_position; + + ASSERT_EQ(0, create(oid)); + ASSERT_EQ(0, client_register(oid)); + ASSERT_EQ(0, client_commit(oid, commit_position)); + + journal::JournalMetadataPtr metadata = create_metadata(oid); + ASSERT_EQ(0, init_metadata(metadata)); + + journal::JournalPlayer *player = create_player(oid, metadata); + + ASSERT_EQ(0, write_entry(oid, 0, 0, 0)); + ASSERT_EQ(0, write_entry(oid, 1, 0, 1)); + ASSERT_EQ(0, write_entry(oid, 0, 0, 2)); + ASSERT_EQ(0, write_entry(oid, 0, 0, 4)); + ASSERT_EQ(0, write_entry(oid, 3, 0, 5)); // laggy entry 0/3 in object 1 + metadata->set_active_set(1); + player->prefetch_and_watch(0.25); + + Entries entries; + ASSERT_TRUE(wait_for_entries(player, 3, &entries)); + + Entries expected_entries = { + create_entry(0, 0), + create_entry(0, 1), + create_entry(0, 2)}; + ASSERT_EQ(expected_entries, entries); + + journal::Entry entry; + uint64_t commit_tid; + ASSERT_FALSE(player->try_pop_front(&entry, &commit_tid)); + + ASSERT_EQ(0, write_entry(oid, 1, 0, 3)); + ASSERT_TRUE(wait_for_entries(player, 3, &entries)); + + expected_entries = { + create_entry(0, 3), + create_entry(0, 4), + create_entry(0, 5)}; + ASSERT_EQ(expected_entries, entries); +} |