Skip to content

Commit

Permalink
fix HomeRaftLogStore::last_entry
Browse files Browse the repository at this point in the history
according to the contract, we should return a dummy log entry if the
index is out of range.
  • Loading branch information
JacksonYao287 committed Dec 23, 2024
1 parent c388f69 commit 3407c65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.6.1"
version = "6.6.2"

homepage = "/~https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
7 changes: 5 additions & 2 deletions src/lib/replication/log_store/home_raft_log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ nuraft::ptr< nuraft::log_entry > HomeRaftLogStore::last_entry() const {
auto log_bytes = m_log_store->read_sync(max_seq);
nle = to_nuraft_log_entry(log_bytes);
} catch (const std::exception& e) {
REPL_STORE_LOG(ERROR, "last_entry() out_of_range={}", max_seq);
throw e;
// all the log entries are truncated, so we should return a dummy log entry.
REPL_STORE_LOG(ERROR, "last_entry() out_of_range={}, {}", max_seq, e.what());
// according to the contract, we should return a dummy log entry if the index is out of range.
// /~https://github.com/eBay/NuRaft/blob/50e2f949503081262cb21923e633eaa8dacad8fa/include/libnuraft/log_store.hxx#L56
nle = m_dummy_log_entry;
}

return nle;
Expand Down

0 comments on commit 3407c65

Please sign in to comment.