summaryrefslogtreecommitdiffstats
path: root/src/journal/JournalPlayer.cc
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2016-02-02 00:16:38 +0100
committerJason Dillaman <dillaman@redhat.com>2016-02-05 19:03:57 +0100
commit243d91db68674142e01364dcdc9fdc98a33fe520 (patch)
treecfb362801fd2b39f167761b154d00a3ab88cdf90 /src/journal/JournalPlayer.cc
parentMerge pull request #7474 from jack-changtao/wip-cmake2 (diff)
downloadceph-243d91db68674142e01364dcdc9fdc98a33fe520.tar.xz
ceph-243d91db68674142e01364dcdc9fdc98a33fe520.zip
journal: switched entry tags to use id instead of string
Later commits will add the ability to allocate tags and associate them with registered clients. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/journal/JournalPlayer.cc')
-rw-r--r--src/journal/JournalPlayer.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/journal/JournalPlayer.cc b/src/journal/JournalPlayer.cc
index a2355f52063..45505a37708 100644
--- a/src/journal/JournalPlayer.cc
+++ b/src/journal/JournalPlayer.cc
@@ -55,7 +55,7 @@ JournalPlayer::JournalPlayer(librados::IoCtx &ioctx,
m_journal_metadata(journal_metadata), m_replay_handler(replay_handler),
m_lock("JournalPlayer::m_lock"), m_state(STATE_INIT), m_splay_offset(0),
m_watch_enabled(false), m_watch_scheduled(false), m_watch_interval(0),
- m_commit_object(0) {
+ m_commit_object(0), m_commit_tag_tid(0) {
m_replay_handler->get();
m_ioctx.dup(ioctx);
m_cct = reinterpret_cast<CephContext *>(m_ioctx.cct());
@@ -66,13 +66,13 @@ JournalPlayer::JournalPlayer(librados::IoCtx &ioctx,
uint8_t splay_width = m_journal_metadata->get_splay_width();
m_splay_offset = commit_position.object_number % splay_width;
m_commit_object = commit_position.object_number;
- m_commit_tag = commit_position.entry_positions.front().tag;
+ m_commit_tag_tid = commit_position.entry_positions.front().tag_tid;
for (EntryPositions::const_iterator it =
commit_position.entry_positions.begin();
it != commit_position.entry_positions.end(); ++it) {
const EntryPosition &entry_position = *it;
- m_commit_tids[entry_position.tag] = entry_position.tid;
+ m_commit_tids[entry_position.tag_tid] = entry_position.entry_tid;
}
}
}
@@ -156,9 +156,10 @@ bool JournalPlayer::try_pop_front(Entry *entry, uint64_t *commit_tid) {
object_player->front(entry);
object_player->pop_front();
- uint64_t last_tid;
- if (m_journal_metadata->get_last_allocated_tid(entry->get_tag(), &last_tid) &&
- entry->get_tid() != last_tid + 1) {
+ uint64_t last_entry_tid;
+ if (m_journal_metadata->get_last_allocated_entry_tid(
+ entry->get_tag_tid(), &last_entry_tid) &&
+ entry->get_entry_tid() != last_entry_tid + 1) {
lderr(m_cct) << "missing prior journal entry: " << *entry << dendl;
m_state = STATE_ERROR;
@@ -171,10 +172,10 @@ bool JournalPlayer::try_pop_front(Entry *entry, uint64_t *commit_tid) {
if (!object_player->empty()) {
Entry peek_entry;
object_player->front(&peek_entry);
- if (peek_entry.get_tag() == entry->get_tag() ||
- (m_journal_metadata->get_last_allocated_tid(peek_entry.get_tag(),
- &last_tid) &&
- last_tid + 1 != peek_entry.get_tid())) {
+ if (peek_entry.get_tag_tid() == entry->get_tag_tid() ||
+ (m_journal_metadata->get_last_allocated_entry_tid(
+ peek_entry.get_tag_tid(), &last_entry_tid) &&
+ last_entry_tid + 1 != peek_entry.get_entry_tid())) {
advance_splay_object();
}
} else {
@@ -182,9 +183,11 @@ bool JournalPlayer::try_pop_front(Entry *entry, uint64_t *commit_tid) {
remove_empty_object_player(object_player);
}
- m_journal_metadata->reserve_tid(entry->get_tag(), entry->get_tid());
+ m_journal_metadata->reserve_entry_tid(entry->get_tag_tid(),
+ entry->get_entry_tid());
*commit_tid = m_journal_metadata->allocate_commit_tid(
- object_player->get_object_number(), entry->get_tag(), entry->get_tid());
+ object_player->get_object_number(), entry->get_tag_tid(),
+ entry->get_entry_tid());
return true;
}
@@ -249,14 +252,15 @@ int JournalPlayer::process_prefetch(uint64_t object_number) {
Entry entry;
while (!m_commit_tids.empty() && !object_player->empty()) {
object_player->front(&entry);
- if (entry.get_tid() > m_commit_tids[entry.get_tag()]) {
+ if (entry.get_entry_tid() > m_commit_tids[entry.get_tag_tid()]) {
ldout(m_cct, 10) << "located next uncommitted entry: " << entry
<< dendl;
break;
}
ldout(m_cct, 20) << "skipping committed entry: " << entry << dendl;
- m_journal_metadata->reserve_tid(entry.get_tag(), entry.get_tid());
+ m_journal_metadata->reserve_entry_tid(entry.get_tag_tid(),
+ entry.get_entry_tid());
object_player->pop_front();
}
@@ -269,7 +273,7 @@ int JournalPlayer::process_prefetch(uint64_t object_number) {
} else {
Entry entry;
object_player->front(&entry);
- if (entry.get_tag() == m_commit_tag) {
+ if (entry.get_tag_tid() == m_commit_tag_tid) {
advance_splay_object();
}
}