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


##########
fe/fe-core/src/main/java/org/apache/doris/qe/runtime/MultiFragmentsPipelineTask.java:
##########
@@ -179,8 +195,12 @@ private Future<InternalService.PExecPlanFragmentResult> 
execRemoteFragmentsAsync
             boolean twoPhaseExecution) {
         Preconditions.checkNotNull(serializedFragments);
         try {
+            // Serialization can precede a failed heartbeat or backend 
replacement; recheck at the send boundary.
+            if (needsFileEncryption) {
+                NativeFileEncryptionSupport.require(backend);

Review Comment:
   Addressed in 75e66f8da6ad. Immediately before prepare, BackendRpcTarget 
passes its copied BRPC address and the bound backend ID to 
NativeFileEncryptionSupport.require. That method looks up the current 
registration, requires the registered address to match the bound destination, 
and checks the current capability and protected transports. It refuses the 
fragment without issuing prepare when the port changes, registration is 
removed, the backend is replaced by an incapable registration, or capability is 
revoked; it does not redirect the bound target.
   
   Fresh verification with the official FE test runner passed all 16 selected 
tests. PipelineExecutionTaskTest includes all four refusal cases and an 
unchanged-target success control. This verifies the requested 
binding-to-dispatch transition; it does not claim to eliminate changes 
occurring after the send-boundary check.



##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergScanPlanProvider.java:
##########
@@ -975,7 +979,7 @@ private List<ConnectorScanRange> planScanInternal(
         // deletes or invalid record counts prevent an exact proof, use the 
normal scan so BE reads and counts.
         // A data-row predicate can leave partially matching files, whose 
file-level recordCount is only an
         // upper bound. Keep those scans on the normal path even if the engine 
supplies the count signal.
-        if (countPushdown && filter.isEmpty()) {
+        if (countPushdown && filter.isEmpty() && 
!IcebergEncryptionRead.isEncrypted(table)) {

Review Comment:
   Addressed in 75e66f8da6ad. streamingSplitEstimate now returns -1 for format 
v3 and later before entering the COUNT/delete-manifest probe. The physical 
planning path therefore remains available when batch mode, COUNT pushdown and 
ignore_iceberg_dangling_delete are enabled together.
   
   Fresh verification passed 
v3CountBatchEstimateSkipsEncryptedPositionDeleteProbe with the official FE 
runner. It checks the synchronous estimate, retained encrypted position-delete 
metadata on physical ranges, and absence of a metadata row count. The SQL 
fixture also enables and restores ignore_iceberg_dangling_delete, but its 
surviving-row assertions were not freshly executed on a prepared encrypted 
native deployment. The complete focused run passed 16 tests with zero 
failures/errors/skips.



##########
fe/fe-core/src/main/java/org/apache/doris/rpc/NativeFileEncryptionSupport.java:
##########
@@ -0,0 +1,75 @@
+// 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.common.AnalysisException;
+import org.apache.doris.common.ClientPool;
+import org.apache.doris.system.Backend;
+import org.apache.doris.thrift.TNetworkAddress;
+import org.apache.doris.tls.server.FeServerStarterFactory;
+
+import java.util.Collection;
+import java.util.List;
+
+/** Runtime proof for the native reader and every private channel carrying 
file keys. */
+public final class NativeFileEncryptionSupport {
+    private NativeFileEncryptionSupport() {
+    }
+
+    private static boolean protectedTransports() {
+        return BackendServiceClient.supportsPrivateFileKeys()
+                && ClientPool.backendHeartbeatPool.supportsPrivateFileKeys()
+                && FeServerStarterFactory.supportsPrivateFileKeys();
+    }
+
+    public static boolean supported() {
+        try {
+            // Admission precedes backend assignment: require every currently 
selectable live backend.
+            List<Backend> backends = 
Env.getCurrentSystemInfo().getBackendsByCurrentCluster().values().stream()
+                    .filter(Backend::isAlive).toList();

Review Comment:
   Addressed in 75e66f8da6ad. Admission now reuses FederationBackendPolicy's 
query/load availability policy and the session compute group's backend list 
instead of the global registered-backend inventory. The same policy builder and 
compute-group resolver are used by ordinary scan initialization, and the 
per-target registry/address/capability check remains at dispatch.
   
   I also checked the calling path: Iceberg uses ExternalScanNode's no-argument 
backendPolicy.init(); the preLocations overload is used for TVF scanning. 
Consequently, an empty location preference matches the Iceberg scheduling path 
here.
   
   The fresh official FE run passed all 16 selected tests. 
NativeFileEncryptionSupportTest covers a still-alive backend whose capability 
is revoked after a failed heartbeat, excluded separately by query availability, 
load availability and compute group. It also verifies that making that 
incapable backend eligible rejects admission.



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