Repository navigation
[CELEBORN-2533] Add optional client host for the HA master leader-redirect address - #3934
shellfish007 wants to merge 1 commit into
Conversation
Add celeborn.master.ha.node.<id>.client.host, falling back to celeborn.master.ha.node.<id>.host. Masters advertise it as the Raft client address, which followers return to clients as the suggested leader in MasterNotLeaderException, so clients outside the cluster can follow the redirect. Raft peer traffic keeps using the ratis host, and workers are redirected via the admin address, which followers now use whether or not the internal port is enabled.
zaynt4606
left a comment
There was a problem hiding this comment.
Two HA redirect cases need to be addressed before merging; details inline.
| // internal port is disabled, and unlike the client address it is never the client host. | ||
| String adminAddress = | ||
| roleInfoProto.getFollowerInfo().getLeaderInfo().getId().getAdminAddress(); | ||
| leaderPeerInternalRpcEndpoint = Utils.addressToIpHostAddressPair(adminAddress); |
There was a problem hiding this comment.
[P2] Preserve the shared-RPC fallback when adminAddress is absent
Dynamically added peers can omit the optional adminAddress (both the peer-add API and Ratis shell allow this). With the internal port disabled, such a peer previously worked because workers were redirected to its clientAddress. Unconditionally parsing the empty admin address now produces 127.0.0.1:0 with the default IP preference. I reproduced this against the base and PR versions: the same leader metadata redirects the worker to 127.0.0.2:9097 before this change and 127.0.0.1:0 afterward.
When that peer becomes leader, worker registration/heartbeat retries through followers receive an unusable endpoint. Could we preserve a valid shared-RPC fallback for peers without an admin address and cover this case?
| .setId(localRaftPeerId) | ||
| .setAddress(ratisAddr) | ||
| .setClientAddress(localNode.rpcEndpoint()) | ||
| .setClientAddress(localNode.clientEndpoint()) |
There was a problem hiding this comment.
[P2] Apply client.host when recovering an existing HA cluster
This changes the bootstrap peer metadata, but updateServerRole() still reads the redirect from Ratis's effective peer configuration. On recovery, Ratis restores the persisted configuration, including the old clientAddress, over the supplied bootstrap group. I verified this with Ratis 3.3.1: after restarting with the same storage directory and supplying master1.external.invalid:9097, the effective client address remained 127.0.0.1:9097.
Consequently, adding client.host and restarting an existing cluster can leave followers advertising the original internal address, so the intended fix does not take effect. Could we prefer an explicitly configured client.host by leader ID when constructing the redirect, falling back to peer metadata when unset, or otherwise safely update the persisted metadata? Please also cover a restart that retains the Raft data directory.
What changes were proposed in this pull request?
Add an optional
celeborn.master.ha.node.<id>.client.host, falling back toceleborn.master.ha.node.<id>.host, used only for the leader-redirect address that masters hand to clients.CelebornConf: newHA_MASTER_NODE_CLIENT_HOSTentry andhaMasterClientHost(nodeId)accessor.MasterNode: newclientHostfield andclientEndpoint(clientHost:rpcPort, falling back torpcHost).Builder.setHostalso setsclientHost, andBuilder.setClientHostoverrides it.MasterClusterInfo.loadHAConfig: readshaMasterClientHostinto eachMasterNode.HARaftServer: the Raft peers' client address usesclientEndpointinstead ofrpcEndpoint. When building the suggested leader endpoints, followers take the internal (worker) endpoint from the leader's admin address whether or not the internal port is enabled, so workers are never redirected to the client host. With the internal port disabled, the admin address isrpcHost:rpcPort, the same address as before.JIRA: https://issues.apache.org/jira/browse/CELEBORN-2533
Why are the changes needed?
When a client sends a request to a follower, the follower replies with
MasterNotLeaderExceptioncarrying the leader's Raft client address, which is derived fromceleborn.master.ha.node.<id>.host. In Kubernetes that host is usually an in-cluster name, e.g. a headless Service FQDN, which a client outside the cluster can't resolve, so the client can't follow the redirect.client.hostlets operators advertise an externally reachable name for the redirect, e.g. a per-master gateway host, without routing Raft traffic between masters or worker traffic through it.Does this PR introduce any user-facing change?
Yes, a new optional config
celeborn.master.ha.node.<id>.client.host. When it is not set, behavior is unchanged.How was this patch tested?
HAConfSuite:client.hostfalls back tohost, and an override leaveshostandratis.hostunchanged.MasterNodeSuite(new):MasterClusterInfo.loadHAConfigputsclient.hostinto the node'sclientEndpointwhilerpcEndpoint,internalRpcEndpointand the Ratis host keep the node host; peers withoutclient.hostkeep advertising their rpc endpoint;MasterNode.Builderseeds and overrides the client host.RatisMasterStatusSystemSuiteJ,MasterRatisServerSuiteJandMasterStateMachineSuiteJpass.