Gabriel39 commented on code in PR #71174:
URL: https://github.com/apache/doris/pull/71174#discussion_r4750819390
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/doris/FeServiceClient.java:
##########
@@ -246,16 +247,26 @@ private <T> T masterCallWithRetry(ThriftCall<T> call,
String errorMsg, int timeo
throw new RuntimeException(errorMsg + ":" + lastMessage,
lastException);
}
+ public int getClusterId() {
+ if (clusterId == null) {
Review Comment:
Fixed in 0b95478627. An omitted cluster identity now remains unknown and is
refreshed on native target binding; an advertised identity (including zero)
stays cached, and an older peer cannot erase an identity learned from an
upgraded peer. The socket-level test covers old → new → old responses. The
native regression uses a real Thrift metadata proxy to make the same transition
while the origin FE, catalog and backend IDs remain unchanged: the prior head
rejects the first upgraded query with NOT_AUTHORIZED, and the fix passes
SELECT, joins, INSERT SELECT and restart reuse. This models the metadata
transition rather than deploying mixed-version binaries.
##########
fe/fe-core/src/main/java/org/apache/doris/rpc/FrontendRpcKeyRegistration.java:
##########
@@ -0,0 +1,110 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.rpc;
+
+import org.apache.doris.catalog.Env;
+import org.apache.doris.system.Backend;
+import org.apache.doris.system.Frontend;
+import org.apache.doris.thrift.TNetworkAddress;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.BooleanSupplier;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+/** Keeps query listeners closed until heartbeat publication and worker key
registration complete. */
+public final class FrontendRpcKeyRegistration {
+ private FrontendRpcKeyRegistration() {
+ }
+
+ public static void awaitPublication() throws IOException,
InterruptedException {
+ String key = InternalRpcRequestSigner.getInstance().getPublicKey();
+ BackendServiceProxy proxy = BackendServiceProxy.getInstance();
+ // Zero is the uninitialized heartbeat position, so it cannot
acknowledge a startup.
+ long journalFence = Math.max(1,
Env.getCurrentEnv().getReplayedJournalId());
+ awaitPublication(() ->
Env.getCurrentSystemInfo().getAllClusterBackendsNoException().values(),
+ backend -> proxy.isFrontendKeyRegistered(
+ new TNetworkAddress(backend.getHost(),
backend.getBrpcPort()), key),
+ () -> isHeartbeatPublished(journalFence), 120_000);
Review Comment:
Fixed in 0b95478627. The startup deadline now allows two configured
heartbeat rounds plus the existing 120-second grace, using long arithmetic.
Publication acknowledgment and worker-registration gates remain enforced. Unit
cases cover the default, 180-second and maximum integer cadences. The real
two-FE/zero-BE Docker regression reproduces the prior observer exit before its
next heartbeat; with the fix, the observer waits 176 seconds and becomes ready
after publication. The complete suite, including resource cleanup, passes.
--
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]