From a466fcec38db124b1b5e578583d4bd8655a29f8e Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 9 Jul 2024 13:29:50 +0800 Subject: [PATCH] add more logs Signed-off-by: Bugen Zhao --- src/meta/node/src/server.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/meta/node/src/server.rs b/src/meta/node/src/server.rs index fb6d825e8ca2..c07bfc838142 100644 --- a/src/meta/node/src/server.rs +++ b/src/meta/node/src/server.rs @@ -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(); @@ -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; } @@ -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(); @@ -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,