Skip to content

Commit

Permalink
fix write_snapshot_data
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonYao287 committed Aug 26, 2024
1 parent ac17767 commit 1f85dd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 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.4.51"
version = "6.4.52"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
9 changes: 2 additions & 7 deletions src/tests/test_raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class TestReplicatedDB : public homestore::ReplDevListener {
{
std::unique_lock lk(db_mtx_);
inmem_db_.insert_or_assign(k, v);
last_committed_lsn = lsn;
++commit_count_;
}

Expand Down Expand Up @@ -224,10 +223,8 @@ class TestReplicatedDB : public homestore::ReplDevListener {
snp_data->is_last_obj);

if (snp_data->offset == 0) {
// TODO: this is a workaround to avoid the first snapshot data write error. revisit here and refine
// it. if last_committed_lsn is 0 and we send it back, then the leader will resend this to us, in which the
// snp_data->offset is 0. This will cause the snapshot data write error. So we set it to -1 to avoid this.
snp_data->offset = last_committed_lsn == 0 ? -1 : last_committed_lsn;
auto raft_server = std::dynamic_pointer_cast< RaftReplDev >(repl_dev())->raft_server();
snp_data->offset = raft_server->get_committed_log_idx();
LOGINFOMOD(replication, "[Replica={}] Save logical snapshot callback return obj_id={}",
g_helper->replica_num(), snp_data->offset);
return;
Expand All @@ -250,7 +247,6 @@ class TestReplicatedDB : public homestore::ReplDevListener {
value.blkid_ = out_blkids;
}
inmem_db_.insert_or_assign(key, value);
last_committed_lsn = value.lsn_;
++commit_count_;
ptr++;
}
Expand Down Expand Up @@ -372,7 +368,6 @@ class TestReplicatedDB : public homestore::ReplDevListener {
std::map< Key, Value > inmem_db_;
uint64_t commit_count_{0};
std::shared_mutex db_mtx_;
uint64_t last_committed_lsn{0};
std::shared_ptr< snapshot_context > m_last_snapshot{nullptr};
bool zombie_{false};
};
Expand Down

0 comments on commit 1f85dd3

Please sign in to comment.