Gabriel39 commented on code in PR #71174:
URL: https://github.com/apache/doris/pull/71174#discussion_r4788813264


##########
fe/fe-core/src/main/java/org/apache/doris/system/HeartbeatMgr.java:
##########
@@ -178,17 +192,30 @@ protected void runAfterCatalogReady() {
             return;
         }
         clearRemovedBackendHeartbeatPools();
-        for (Backend backend : bes) {
-            BackendHeartbeatHandler handler = new 
BackendHeartbeatHandler(backend, feInfos);
-            hbResponses.add(executor.submit(handler));
-        }
-
         // send frontend heartbeat
         List<Frontend> frontends = Env.getCurrentEnv().getFrontends(null);
+        List<FutureTask<HeartbeatResponse>> deferredFrontends = 
Lists.newArrayList();
         for (Frontend frontend : frontends) {
             FrontendHeartbeatHandler handler = new 
FrontendHeartbeatHandler(frontend,
                     Env.getCurrentEnv().getClusterId(),
                     Env.getCurrentEnv().getToken());
+            try {
+                hbResponses.add(frontendExecutor.submit(handler));
+            } catch (RejectedExecutionException e) {
+                // The ordinary blocking rejection policy could otherwise 
stall dispatch for a full minute.
+                FutureTask<HeartbeatResponse> deferred = new 
FutureTask<>(handler);
+                deferredFrontends.add(deferred);
+                hbResponses.add(deferred);
+            }
+        }
+
+        HbPackage hbPackage = new HbPackage();
+        // Bound publication waiting so a stalled FE cannot withhold BE/broker 
heartbeats.
+        // Retain late futures for the final collection; reachable 
unregistered BEs still gate FE startup.
+        collectHeartbeatResponses(hbResponses, hbPackage, System.nanoTime() + 
TimeUnit.MILLISECONDS.toNanos(100));

Review Comment:
   Fixed in df7c41ad5988 through target execution admission rather than 
coupling all worker health to one global FE startup decision. All seven signed 
sender paths check the actual receiver before dispatch, and scanner issuance 
admits every advertised replica. A cached positive admission can be repaired 
once only after the BE returns a typed registration-required rejection before 
executing any work; the original fragment deadline is retained.
   
   Authority capture and FE identity changes share the membership writer, while 
epoch/sequence and identity-revision fences reject delayed updates. Tests cover 
late FE publication with newly discovered workers and stale/failed BE epochs. 
The local same-IP process scenario also passes both first queries after BE 
restart with periodic heartbeats still paused, without query-level retries.



##########
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/TableQueryPlanAction.java:
##########
@@ -322,6 +324,18 @@ private void handleQuery(ConnectContext context, String 
requestDb, String reques
             String opaquedQueryPlan;
             try {
                 serializer = new TSerializer();
+                byte[] unsignedPlan = serializer.serialize(tQueryPlanInfo);
+                InternalRpcRequestSigner.Authorization authorization = 
InternalRpcRequestSigner.getInstance()
+                        .signBytes("open_scanner", 0, 
Env.getCurrentEnv().getClusterId(), unsignedPlan,
+                                System.currentTimeMillis());
+                // This opaque plan can be opened on any of its tablet 
backends. Bind it to this
+                // FE's authority and the exact bytes, without exposing a 
reusable cluster token.
+                TQueryPlanAuthorization planAuthorization = new 
TQueryPlanAuthorization();
+                planAuthorization.setSerializedPlan(unsignedPlan);

Review Comment:
   Fixed in df7c41ad5988. New scanner capabilities contain one original Thrift 
payload, including its STOP, followed by a versioned authorization trailer 
bounded to 1024 raw bytes. The signature covers the exact prefix and format 
domain; legacy readers still see the original plan. The BE also accepts the 
preceding signed-envelope format.
   
   Only the backend Thrift listener reserves 4 KiB for encoded overhead, 
including its buffered transport and TLS replacement paths. A near-100 MiB FE 
test and real plain/TLS first/repeated/new-connection budget tests pass, as 
does the packaged scanner regression. The upgrade documentation explicitly 
requires BE-first deployment; older transports need a 4 KiB limit increase and 
restart for newly issued plans at the prior boundary.



##########
be/src/service/internal_service.cpp:
##########
@@ -360,10 +361,56 @@ void 
PInternalService::tablet_writer_open(google::protobuf::RpcController* contr
     }
 }
 
+bool PInternalService::_is_trusted_signing_key(std::string_view key) {
+    const auto frontends = _exec_env->get_frontends();

Review Comment:
   Fixed in df7c41ad5988. Heartbeats build and atomically publish an immutable 
verification snapshot containing receiver IDs and a key set. Authorization 
acquires one shared snapshot; it no longer calls get_frontends(), copies 
membership strings or holds the membership writer during signature 
verification. Replacement, missing-key and drop tests verify revocation for new 
readers while retained readers remain safe.
   
   The FE fan-out also shares one detached membership list across small 
per-worker envelopes, avoiding generated Thrift deep copies per worker. The 
two-worker allocation counterexample fails before this change and passes 
afterward. No throughput benchmark is claimed.



-- 
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]

Reply via email to