From 6dd81a296e8196b5795dfc835ad2e2dd6158e37a Mon Sep 17 00:00:00 2001 From: Xiaoxi Chen Date: Sun, 8 Dec 2024 01:50:39 +0800 Subject: [PATCH] Adopt on_repl_devs_init_completed CB. moving PG/Shard recovery into this CB, through HomeObject::on_replica_restart(). Stop calling on_replica_restart from StateMachine::on_restart(). Signed-off-by: Xiaoxi Chen --- conanfile.py | 2 +- src/lib/homestore_backend/hs_homeobject.cpp | 9 +++++++-- src/lib/homestore_backend/replication_state_machine.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/conanfile.py b/conanfile.py index 7fc78ce..45c1e14 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class HomeObjectConan(ConanFile): name = "homeobject" - version = "2.1.16" + version = "2.1.17" homepage = "https://github.com/eBay/HomeObject" description = "Blob Store built on HomeReplication" diff --git a/src/lib/homestore_backend/hs_homeobject.cpp b/src/lib/homestore_backend/hs_homeobject.cpp index ffa76fe..039a4b9 100644 --- a/src/lib/homestore_backend/hs_homeobject.cpp +++ b/src/lib/homestore_backend/hs_homeobject.cpp @@ -60,6 +60,10 @@ class HSReplApplication : public homestore::ReplApplication { return it->second; } + void on_repl_devs_init_completed() override { + _home_object->on_replica_restart(); + } + std::pair< std::string, uint16_t > lookup_peer(homestore::replica_id_t uuid) const override { std::string endpoint; // for folly::uri to parse correctly, we need to add "http://" prefix @@ -195,13 +199,14 @@ void HSHomeObject::init_homestore() { .chunk_sel_type = chunk_selector_type_t::CUSTOM}}, }); } - + // We dont have any repl dev now, explicitly call init_completed_cb() where we register PG/Shard meta types. + repl_app->on_repl_devs_init_completed(); // Create a superblock that contains our SvcId auto svc_sb = homestore::superblk< svc_info_superblk_t >(_svc_meta_name); svc_sb.create(sizeof(svc_info_superblk_t)); svc_sb->svc_id_ = _our_id; svc_sb.write(); - on_replica_restart(); + } else { RELEASE_ASSERT(!_our_id.is_nil(), "No SvcId read after HomeStore recovery!"); auto const new_id = app->discover_svcid(_our_id); diff --git a/src/lib/homestore_backend/replication_state_machine.cpp b/src/lib/homestore_backend/replication_state_machine.cpp index 793700d..e0c4127 100644 --- a/src/lib/homestore_backend/replication_state_machine.cpp +++ b/src/lib/homestore_backend/replication_state_machine.cpp @@ -92,7 +92,7 @@ void ReplicationStateMachine::on_rollback(int64_t lsn, sisl::blob const& header, } } -void ReplicationStateMachine::on_restart() { home_object_->on_replica_restart(); } +void ReplicationStateMachine::on_restart() { LOGD("ReplicationStateMachine::on_restart");} void ReplicationStateMachine::on_error(ReplServiceError error, const sisl::blob& header, const sisl::blob& key, cintrusive< repl_req_ctx >& ctx) {