Skip to content

Commit

Permalink
Add on_repl_devs_init_completed cb.
Browse files Browse the repository at this point in the history
A stable callback is needed regardless whether we have repl_dev created.

This CB is a nice place for upper layer to recover those depends on
repl_dev.

Signed-off-by: Xiaoxi Chen <[email protected]>
  • Loading branch information
xiaoxichen committed Dec 9, 2024
1 parent 4f4df87 commit b38f956
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
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.5.21"
version = "6.5.22"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
4 changes: 4 additions & 0 deletions src/include/homestore/replication_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class ReplApplication {
// Listener corresponding to the ReplDev which will be used to perform the precommit/commit/rollback.
virtual shared< ReplDevListener > create_repl_dev_listener(group_id_t group_id) = 0;

// Called after all the repl devs are found upon restart of the homestore instance.
// it is a nice place for upper layer to recovery anything depends on repl_devs
virtual void on_repl_devs_init_completed() = 0;

// Given the uuid of the peer, get their address and port
virtual std::pair< std::string, uint16_t > lookup_peer(replica_id_t uuid) const = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/lib/replication/service/raft_repl_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ void RaftReplService::start() {
rdev->on_restart();
}
m_config_sb_bufs.clear();
LOGINFO("Repl devs load completed, calling upper layer on_repl_devs_init_completed");
m_repl_app->on_repl_devs_init_completed();

// Step 5: Start the data and logstore service now. This step is essential before we can ask Raft to join groups etc

Expand Down
1 change: 1 addition & 0 deletions src/tests/test_common/hs_repl_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class HSReplTestHelper : public HSTestHelper {
create_repl_dev_listener(homestore::group_id_t group_id) override {
return helper_.get_listener(group_id);
}
void on_repl_devs_init_completed() { LOGINFO("Repl dev init completed CB called"); }

std::pair< std::string, uint16_t > lookup_peer(homestore::replica_id_t replica_id) const override {
uint16_t port;
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_solo_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class SoloReplDevTest : public testing::Test {
shared< ReplDevListener > create_repl_dev_listener(uuid_t) override {
return std::make_shared< Listener >(m_test);
}
void on_repl_devs_init_completed() { LOGINFO("Repl dev init completed CB called"); }
std::pair< std::string, uint16_t > lookup_peer(uuid_t uuid) const override { return std::make_pair("", 0u); }
replica_id_t get_my_repl_id() const override { return hs_utils::gen_random_uuid(); }
};
Expand Down

0 comments on commit b38f956

Please sign in to comment.