From d9855e43010c90b335ad17c001a1ed37a7bfc937 Mon Sep 17 00:00:00 2001 From: Jie Yao Date: Tue, 23 Jan 2024 05:02:14 -0700 Subject: [PATCH] fix repl service --- src/lib/homestore.cpp | 6 +++++- src/lib/replication/service/raft_repl_service.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/homestore.cpp b/src/lib/homestore.cpp index b05387ee5..427fd6ddb 100644 --- a/src/lib/homestore.cpp +++ b/src/lib/homestore.cpp @@ -125,7 +125,6 @@ bool HomeStore::start(const hs_input_params& input, hs_before_services_starting_ if (has_meta_service()) { m_meta_service = std::make_unique< MetaBlkService >(); } if (has_index_service()) { m_index_service = std::make_unique< IndexService >(std::move(s_index_cbs)); } if (has_repl_data_service()) { - m_repl_service = GenericReplService::create(std::move(s_repl_app)); m_log_service = std::make_unique< LogStoreService >(); m_data_service = std::make_unique< BlkDataService >(std::move(s_custom_chunk_selector)); } else { @@ -195,6 +194,11 @@ void HomeStore::format_and_start(std::map< uint32_t, hs_format_params >&& format } void HomeStore::do_start() { + // when coming here: + // 1 if this is the first_time_boot, , the repl app already gets its uuid from upper layer + // 2 if this is not the first_time_boot, the repl app already gets its uuid from the metaservice + // now , we can safely initialize GenericReplService , which will get a correct uuid through get_my_repl_uuid() + if (has_repl_data_service()) m_repl_service = GenericReplService::create(std::move(s_repl_app)); const auto& inp_params = HomeStoreStaticConfig::instance().input; uint64_t cache_size = resource_mgr().get_cache_size(); diff --git a/src/lib/replication/service/raft_repl_service.cpp b/src/lib/replication/service/raft_repl_service.cpp index dde2da93c..960354a1f 100644 --- a/src/lib/replication/service/raft_repl_service.cpp +++ b/src/lib/replication/service/raft_repl_service.cpp @@ -81,8 +81,8 @@ void RaftReplService::start() { .token_client_ = std::dynamic_pointer_cast< sisl::GrpcTokenClient >(ioenvironment.get_token_client())}; m_msg_mgr = nuraft_mesg::init_messaging(params, weak_from_this(), true /* with_data_channel */); - LOGINFOMOD(replication, "Starting RaftReplService with server_uuid={} port={}", - boost::uuids::to_string(params.server_uuid_), params.mesg_port_); + LOGINFO("Starting RaftReplService with server_uuid={} port={}", boost::uuids::to_string(params.server_uuid_), + params.mesg_port_); // Step 2: Register all RAFT parameters. At the end of this step, raft is ready to be created/join group auto r_params = nuraft::raft_params()