Skip to content

Commit

Permalink
don't truncate on if compact_lsn is zero (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamingk authored Apr 22, 2024
1 parent 6ae31e1 commit 7eafcf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.3.1"
version = "6.3.3"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
10 changes: 6 additions & 4 deletions src/lib/replication/log_store/home_raft_log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ void HomeRaftLogStore::truncate(uint32_t num_reserved_cnt, repl_lsn_t compact_ls
auto const last_lsn = last_index();
auto const start_lsn = start_index();

if (start_lsn + num_reserved_cnt >= last_lsn) {
// compact_lsn will be zero on first time boot, so we should not truncate in that case.
if (compact_lsn == 0 || (start_lsn + num_reserved_cnt >= last_lsn)) {
REPL_STORE_LOG(DEBUG,
"Store={} LogDev={}: Skipping truncating because of reserved logs entries is not enough. "
"start_lsn={}, resv_cnt={}, last_lsn={}",
m_logstore_id, m_logdev_id, start_lsn, num_reserved_cnt, last_lsn);
"Store={} LogDev={}: Skipping truncating because of reserved logs entries is not enough or "
"compact_lsn is zero. "
"start_lsn={}, resv_cnt={}, last_lsn={}, compact_lsn={}",
m_logstore_id, m_logdev_id, start_lsn, num_reserved_cnt, last_lsn, compact_lsn);
return;
} else {
//
Expand Down

0 comments on commit 7eafcf2

Please sign in to comment.