924060929 commented on code in PR #70697:
URL: https://github.com/apache/doris/pull/70697#discussion_r4665573643
##########
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:
[P2] Skip the metadata COUNT probe during v3 batch estimation too
This guard selects a physical scan for an encrypted table, but
`computeBatchMode()` calls `streamingSplitEstimate()` first. With external
batch mode, COUNT pushdown, and `ignore_iceberg_dangling_delete` enabled, an
unfiltered `COUNT(*)` on a v3 table with an encrypted position-delete file
reaches `livePositionDeleteRowCount()`. It throws `COUNT_READ_UNAVAILABLE`
before planning reaches this guard.
Since v3 always uses synchronous planning, could we move the existing v3
early return ahead of the delete-manifest probe in `streamingSplitEstimate()`?
The encrypted position-delete fixture could cover this combination by asserting
the surviving row count.
##########
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:
[P1] Check the bound RPC destination before sending the fragment
`BackendRpcTarget` copies the BRPC address when the task is bound. If a
heartbeat changes the port before dispatch, `require(backend)` sees the new
heartbeat, but `target.prepare()` still sends to the old address. Dropping the
BE also removes its registry entry while the captured `Backend` can retain a
valid heartbeat timestamp.
Could we look up the bound BE ID, verify that its registered address matches
the bound target, and check its current capability before sending the file
keys? A test that changes the port or removes the BE between binding and
dispatch should verify that no prepare RPC is issued.
##########
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:
[P2] Use the query's eligible backends for encrypted-read admission
In shared-nothing mode, `getBackendsByCurrentCluster()` returns all
registered BEs. `FederationBackendPolicy` starts from the session's compute
group and checks query and load availability. For example, a query-disabled BE
can lose its encryption capability after one failed heartbeat while it is still
marked alive. This check then rejects the query with
`BACKEND_CAPABILITY_UNAVAILABLE` even when every BE eligible for the scan is
healthy.
Could admission reuse the scheduler's candidate set and keep the per-target
check at dispatch? A test with one eligible BE and one query-disabled BE whose
capability expired would cover the distinction.
--
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]