Skip to content

Commit

Permalink
Adopt on_repl_devs_init_completed CB.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
xiaoxichen committed Dec 9, 2024
1 parent b8334df commit 6dd81a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 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.16"
version = "2.1.17"

homepage = "https://github.com/eBay/HomeObject"
description = "Blob Store built on HomeReplication"
Expand Down
9 changes: 7 additions & 2 deletions src/lib/homestore_backend/hs_homeobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/homestore_backend/replication_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6dd81a2

Please sign in to comment.