This is an automated email from the ASF dual-hosted git repository. jiashunzhu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push: new a665f60d remove the docs and comments related to HealthCheckThread (#2463) a665f60d is described below commit a665f60d10eb1fd991941def0707b872231e4a09 Author: Divyansh200102 <146909065+divyansh200...@users.noreply.github.com> AuthorDate: Thu Dec 14 03:23:48 2023 +0530 remove the docs and comments related to HealthCheckThread (#2463) --- docs/cn/load_balancing.md | 2 +- src/brpc/socket.h | 2 +- test/brpc_socket_unittest.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/cn/load_balancing.md b/docs/cn/load_balancing.md index 27bad7d3..689c1e8c 100644 --- a/docs/cn/load_balancing.md +++ b/docs/cn/load_balancing.md @@ -40,7 +40,7 @@ Load balancer最重要的是如何让不同线程中的负载均衡不互斥, 对于那些无法连接却仍在NamingService的节点,brpc会定期连接它们,成功后对应的Socket将被”复活“,并可能被LoadBalancer选择上,这个过程就是健康检查。注意:被健康检查或在LoadBalancer中的节点一定在NamingService中。换句话说,只要一个节点不从NamingService删除,它要么是正常的(会被LoadBalancer选上),要么在做健康检查。 -传统的做法是使用一个线程做所有连接的健康检查,brpc简化了这个过程:为需要的连接动态创建一个bthread专门做健康检查(Socket::HealthCheckThread)。这个线程的生命周期被对应连接管理。具体来说,当Socket被SetFailed后,健康检查线程就可能启动(如果SocketOptions.health_check_interval为正数的话): +传统的做法是使用一个线程做所有连接的健康检查,brpc简化了这个过程:为需要的连接动态创建一个bthread专门做健康检查(Socket::StartHealthCheck)。这个线程的生命周期被对应连接管理。具体来说,当Socket被SetFailed后,健康检查线程就可能启动(如果SocketOptions.health_check_interval为正数的话): - 健康检查线程先在确保没有其他人在使用Socket了后关闭连接。目前是通过对Socket的引用计数判断的。这个方法之所以有效在于Socket被SetFailed后就不能被Address了,所以引用计数只减不增。 - 定期连接直到远端机器被连接上,在这个过程中,如果Socket析构了,那么该线程也就随之退出了。 diff --git a/src/brpc/socket.h b/src/brpc/socket.h index f4c3cf90..d28d8f17 100644 --- a/src/brpc/socket.h +++ b/src/brpc/socket.h @@ -386,7 +386,7 @@ public: // Mark this Socket or the Socket associated with `id' as failed. // Any later Address() of the identifier shall return NULL unless the - // Socket was revivied by HealthCheckThread. The Socket is NOT recycled + // Socket was revivied by StartHealthCheck. The Socket is NOT recycled // after calling this function, instead it will be recycled when no one // references it. Internal fields of the Socket are still accessible // after calling this function. Calling SetFailed() of a Socket more diff --git a/test/brpc_socket_unittest.cpp b/test/brpc_socket_unittest.cpp index 36a3b1b0..d2258735 100644 --- a/test/brpc_socket_unittest.cpp +++ b/test/brpc_socket_unittest.cpp @@ -543,7 +543,7 @@ TEST_F(SocketTest, not_health_check_when_nref_hits_0) { ASSERT_TRUE(src.empty()); ASSERT_EQ(-1, s->fd()); } - // HealthCheckThread is possibly still running. Spin until global_sock + // StartHealthCheck is possibly still running. Spin until global_sock // is NULL(set in CheckRecycle::BeforeRecycle). Notice that you should // not spin until Socket::Status(id) becomes -1 and assert global_sock // to be NULL because invalidating id happens before calling BeforeRecycle. @@ -765,7 +765,7 @@ TEST_F(SocketTest, health_check) { s.release()->Dereference(); - // Must stop messenger before SetFailed the id otherwise HealthCheckThread + // Must stop messenger before SetFailed the id otherwise StartHealthCheck // still has chance to get reconnected and revive the id. messenger->StopAccept(0); ASSERT_EQ(-1, messenger->listened_fd()); @@ -773,7 +773,7 @@ TEST_F(SocketTest, health_check) { ASSERT_EQ(EBADF, errno); ASSERT_EQ(0, brpc::Socket::SetFailed(id)); - // HealthCheckThread is possibly still addressing the Socket. + // StartHealthCheck is possibly still addressing the Socket. start_time = butil::gettimeofday_us(); while (global_sock != NULL) { bthread_usleep(1000); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org