Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Jul 9, 2024
1 parent 9d320bf commit a466fce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/meta/node/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ pub async fn rpc_serve_with_store(

// Spawn and run the follower service if not the leader.
// Watch the leader status and switch to the leader service when elected.
// TODO: the branch seems to be always hit since the default value of `is_leader` is false until
// the election is done (unless using `DummyElectionClient`).
if !election_client.is_leader() {
// The follower service can be shutdown separately if we're going to be the leader.
let follower_shutdown = shutdown.child_token();
Expand All @@ -310,6 +312,7 @@ pub async fn rpc_serve_with_store(
}
}

tracing::info!("elected as leader, shutting down follower services");
follower_shutdown.cancel();
let _ = follower_handle.await;
}
Expand Down Expand Up @@ -342,6 +345,8 @@ pub async fn start_service_as_election_follower(
address_info: AddressInfo,
election_client: ElectionClientRef,
) {
tracing::info!("starting follower services");

let meta_member_srv = MetaMemberServiceImpl::new(election_client);

let health_srv = HealthServiceImpl::new();
Expand Down Expand Up @@ -385,7 +390,8 @@ pub async fn start_service_as_election_leader(
election_client: ElectionClientRef,
shutdown: CancellationToken,
) -> MetaResult<()> {
tracing::info!("Defining leader services");
tracing::info!("starting leader services");

let env = MetaSrvEnv::new(
opts.clone(),
init_system_params,
Expand Down

0 comments on commit a466fce

Please sign in to comment.