Gabriel39 commented on code in PR #71174:
URL: https://github.com/apache/doris/pull/71174#discussion_r4753062388
##########
fe/fe-core/src/main/java/org/apache/doris/system/HeartbeatMgr.java:
##########
@@ -505,26 +508,36 @@ public FrontendHeartbeatHandler(Frontend fe, int
clusterId, String token) {
@Override
public HeartbeatResponse call() {
HostInfo selfNode = Env.getCurrentEnv().getSelfNode();
- if (fe.getHost().equals(selfNode.getHost())) {
+ // A host can contain multiple FE membership identities with
separate signing keys.
+ if (fe.getHost().equals(selfNode.getHost()) && fe.getEditLogPort()
== selfNode.getPort()) {
// heartbeat to self
if (Env.getCurrentEnv().isReady()) {
return new FrontendHbResponse(fe.getNodeName(),
Config.query_port, Config.rpc_port,
Config.arrow_flight_sql_port,
Env.getCurrentEnv().getMaxJournalId(),
System.currentTimeMillis(),
Version.DORIS_BUILD_VERSION + "-" +
Version.DORIS_BUILD_SHORT_HASH,
ExecuteEnv.getInstance().getStartupTime(),
ExecuteEnv.getInstance().getDiskInfos(),
- ExecuteEnv.getInstance().getProcessUUID(),
Config.local_resource_group);
+ ExecuteEnv.getInstance().getProcessUUID(),
Config.local_resource_group)
+
.withRpcPublicKey(InternalRpcRequestSigner.getInstance().getPublicKey());
} else {
return new FrontendHbResponse(fe.getNodeName(), "not
ready");
}
}
+ // Falling back to our own socket would publish our key under the
peer's identity.
+ if (fe.getHost().equals(selfNode.getHost())
+ && (fe.getRpcPort() <= 0 || fe.getRpcPort() ==
Config.rpc_port)) {
+ return new FrontendHbResponse(fe.getNodeName(),
+ "Colocated frontend requires a known RPC endpoint
distinct from the local endpoint");
+ }
return getHeartbeatResponse();
}
private HeartbeatResponse getHeartbeatResponse() {
FrontendService.Client client = null;
- TNetworkAddress addr = new TNetworkAddress(fe.getHost(),
Config.rpc_port);
+ // Use the discovered peer endpoint; the local port is only a
bootstrap default.
+ int rpcPort = fe.getRpcPort() > 0 ? fe.getRpcPort() :
Config.rpc_port;
Review Comment:
Fixed in 51d68256ac. After a transport failure, the heartbeat invalidates
the old client and tries the configured port once, only for a different host
with exactly one FE membership. It never retries an application-level rejection
or an ambiguous colocated/multiple-membership endpoint. Unit tests round-trip
the actual heartbeat journal and cover both failed borrow and failed ping,
subsequent use of the learned port, unavailable endpoints and wrong-authority
guards. The four-FE Docker regression reproduces startup failure on the
previous head after changing every RPC port from 9020 to 9021; with this fix,
all four FEs become ready, retain their signing identities and execute the
first data query. All 13 heartbeat-publication cases and the complete HA suite
pass.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/doris/FeServiceClient.java:
##########
@@ -246,16 +247,31 @@ private <T> T masterCallWithRetry(ThriftCall<T> call,
String errorMsg, int timeo
throw new RuntimeException(errorMsg + ":" + lastMessage,
lastException);
}
+ public int getClusterId() {
+ Integer destination = clusterId;
+ if (destination == null) {
+ listBackends();
Review Comment:
Fixed in 51d68256ac. CoordinatorContext memoizes destination identity once
per catalog/query, including an unknown result, while preserving each worker's
receiving backend ID. Metadata IO runs outside map mutation locks; the next
query gets a new snapshot and can discover an upgrade. The builder test uses
two catalogs with three workers each, verifies one resolution per catalog and
stable unknown identity within the first query, then verifies refresh in a
second query. A real native regression uses two receiving BEs and a warm legacy
metadata cache: the previous head makes two full metadata RPCs, while the fix
makes exactly one. The same running origin then observes modern metadata and
passes SELECT, join, INSERT SELECT and restart reuse. The final targeted
FE/JDBC preset passes 105 tests, and all seven local regression suites pass.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]