-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Search before asking
- I searched in the issues and found nothing similar.
Motivation
he current Java client implementation has certain flaws in automatic fault switching.
org.apache.pulsar.client.impl.AutoClusterFailover.java
boolean probeAvailable(String url) {
try {
resolver.updateServiceUrl(url);
InetSocketAddress endpoint = resolver.resolveHost();
Socket socket = new Socket();
socket.connect(new InetSocketAddress(endpoint.getHostName(), endpoint.getPort()), TIMEOUT);
socket.close();
return true
} catch (Exception e) {
log.warn("Failed to probe available, url: {}", url, e);
return false;
}
}
The client only establishes a TCP connection with the exposed connection address of the cluster to determine whether the cluster is available, which cannot adapt to scenarios where the cluster is partially unavailable (half dead). In this scenario, we hope to make corresponding fault switching judgments by initiating cluster health status requests to the cluster. Then within the cluster, we provide an admin management command to update the cluster's health status. To avoid this scenario, all businesses that need to connect to this cluster need to manually switch cluster connection addresses and restart applications, resulting in inconsistent link data among multiple business team due to inconsistent operation steps.
Solution
No response
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
PR: [improve][broker]PIP-340 Optimization of Probe Implementation for Automatic Failover #22133