From 3cf8952559e2ac43487d2e347e1041722ee1ecd9 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 16 Mar 2016 08:33:03 -0400 Subject: [PATCH] journal: refetch active object before defaulting to new tag If a live replay is in progress, it's possible that object offset 0 was pulled and a new tag is discovered before the current object is (re-)pulled to determine that the old tag still has entries remaining. Signed-off-by: Jason Dillaman --- src/journal/JournalPlayer.cc | 9 +++++++++ src/journal/JournalPlayer.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/journal/JournalPlayer.cc b/src/journal/JournalPlayer.cc index 4d6382cc4bf2a..0d6b1776ac49f 100644 --- a/src/journal/JournalPlayer.cc +++ b/src/journal/JournalPlayer.cc @@ -392,6 +392,14 @@ bool JournalPlayer::verify_playback_ready() { } } + // if we just advanced to this object, make sure we have the latest + // set of data before advancing to a new tag + if (m_watch_enabled && m_watch_required) { + m_watch_required = false; + schedule_watch(); + return false; + } + // NOTE: replay currently does not check tag class to playback multiple tags // from different classes (issue #14909). When a new tag is discovered, it // is assumed that the previous tag was closed at the last replayable entry. @@ -443,6 +451,7 @@ void JournalPlayer::advance_splay_object() { assert(m_lock.is_locked()); ++m_splay_offset; m_splay_offset %= m_journal_metadata->get_splay_width(); + m_watch_required = true; ldout(m_cct, 20) << __func__ << ": new offset " << static_cast(m_splay_offset) << dendl; } diff --git a/src/journal/JournalPlayer.h b/src/journal/JournalPlayer.h index 902a1959d95b0..476b49b5acb42 100644 --- a/src/journal/JournalPlayer.h +++ b/src/journal/JournalPlayer.h @@ -112,6 +112,7 @@ private: bool m_watch_enabled; bool m_watch_scheduled; double m_watch_interval; + bool m_watch_required = false; bool m_handler_notified = false; -- 2.39.5