Skip to content

Commit

Permalink
fix create_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
yawzhang committed Nov 28, 2024
1 parent 160f8c1 commit d4751e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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 HomeObjectConan(ConanFile):
name = "homeobject"
version = "2.1.11"
version = "2.1.12"

homepage = "https://github.com/eBay/HomeObject"
description = "Blob Store built on HomeReplication"
Expand Down
12 changes: 7 additions & 5 deletions src/lib/homestore_backend/replication_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ ReplicationStateMachine::create_snapshot(std::shared_ptr< homestore::snapshot_co
auto s = ctx->nuraft_snapshot();

std::lock_guard lk(m_snapshot_lock);
auto current = dynamic_pointer_cast< homestore::nuraft_snapshot_context >(m_snapshot_context)->nuraft_snapshot();
if (s->get_last_log_idx() < current->get_last_log_idx()) {
LOGI("Skipping create snapshot new idx/term: {}/{} current idx/term: {}/{}", s->get_last_log_idx(),
s->get_last_log_term(), current->get_last_log_idx(), current->get_last_log_term());
return folly::makeSemiFuture< homestore::ReplResult< folly::Unit > >(folly::Unit{});
if (m_snapshot_context != nullptr) {
auto current = dynamic_pointer_cast< homestore::nuraft_snapshot_context >(m_snapshot_context)->nuraft_snapshot();
if (s->get_last_log_idx() < current->get_last_log_idx()) {
LOGI("Skipping create snapshot new idx/term: {}/{} current idx/term: {}/{}", s->get_last_log_idx(),
s->get_last_log_term(), current->get_last_log_idx(), current->get_last_log_term());
return folly::makeSemiFuture< homestore::ReplResult< folly::Unit > >(folly::Unit{});
}
}

LOGI("create snapshot last_log_idx: {} last_log_term: {}", s->get_last_log_idx(), s->get_last_log_term());
Expand Down

0 comments on commit d4751e3

Please sign in to comment.