coderzc opened a new issue, #15859: URL: https://github.com/apache/pulsar/issues/15859
## Motivation Currently, the broker has an admin `health check` endpoint, which is very good, But in some scenarios, we may not be able to use the admin API (such as https://github.com/apache/pulsar/pull/13316#discussion_r773313991), so I propose to introduce the `HEALTH_CHECK` command in the broker binary protocol. ## Goal Introduce the `HEALTH_CHECK` command in the broker binary protocol. ### Protocol Changes ```proto message CommandHealthCheck { enum TopicVersion { V1 = 0; V2 = 1; } required uint64 request_id = 1; required TopicVersion topic_version = 2; } message CommandHealthCheckResponse { required uint64 request_id = 1; required bool ok = 2 [default = false]; optional ServerError error_code = 3; optional string error_message = 4; } ``` When the `ok == true` indicates that the cluster is in a healthy state. Conversely, when the `ok == false` that the cluster is unhealthy, the specific error message can view `error_code` and `error_message`. ### Client API Changes ```java interface PulsarClient { // .... CompletableFuture<Boolean> healthCheck(TopicVersion topicVersion); } ``` ## Implementation * Add a handler function to handle `CommandHealthCheck` at `ServerCnx`. * Add a handler function to handle `CommandHealthCheckResponse` at `ClientCnx`. * In order to better reuse some functions, move the [internalRunHealthCheck](https://github.com/apache/pulsar/blob/7800fbd5d8cdbeb307f98a8d9408bb5309f41c0d/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java#L385) and [checkDeadlockedThreads](https://github.com/apache/pulsar/blob/7800fbd5d8cdbeb307f98a8d9408bb5309f41c0d/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java#L364) to `BrokerService`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
