github-actions[bot] commented on code in PR #70697:
URL: https://github.com/apache/doris/pull/70697#discussion_r4675123209


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/scan/FileScanEncryptionGuard.java:
##########
@@ -35,80 +36,129 @@
 import org.apache.doris.thrift.TTableFormatFileDesc;
 
 import java.util.List;
+import java.util.Map;
+import java.util.function.BooleanSupplier;
 
 /** Last checks before serializing file keys, including lazy split responses 
and replanned retries. */
 public final class FileScanEncryptionGuard {
     private FileScanEncryptionGuard() {
     }
 
-    private static void rejectEncryptedRead(boolean internalRpc) {
-        // An external plaintext channel cannot carry file keys, even if local 
private TLS is enabled.
-        if (!internalRpc) {
-            throw new IllegalStateException("File encryption 
[KEY_TRANSPORT_UNAVAILABLE]");
-        }
-        // Native decryption and protected transport for file keys are not 
implemented yet.
-        throw new IllegalStateException("File encryption [READ_UNAVAILABLE]");
+    public static void checkFragments(TPipelineFragmentParamsList fragments) {
+        checkFragments(fragments, () -> false);
     }
 
-    public static void checkFragments(TPipelineFragmentParamsList fragments) {
-        checkFragments(fragments, true);
+    public static boolean checkFragments(TPipelineFragmentParamsList 
fragments, BooleanSupplier supportsEncryption) {
+        return checkFragments(fragments, supportsEncryption, true);
     }
 
     public static void checkFragments(TPipelineFragmentParamsList fragments, 
boolean internalRpc) {
-        if (!fragments.isSetParamsList()) {
-            return;
-        }
-        for (TPipelineFragmentParams fragment : fragments.getParamsList()) {
-            if (fragment.isSetFileScanParams()) {
-                for (TFileScanRangeParams params : 
fragment.getFileScanParams().values()) {
-                    checkParams(params, internalRpc);
+        checkFragments(fragments, () -> false, internalRpc);
+    }
+
+    public static boolean checkFragments(TPipelineFragmentParamsList 
fragments, BooleanSupplier supportsEncryption,
+            boolean internalRpc) {
+        Checker checker = new Checker(supportsEncryption, true, internalRpc);
+        if (fragments.isSetParamsList()) {
+            Map<Integer, TFileScanRangeParams> paramsByNode = Map.of();
+            for (TPipelineFragmentParams fragment : fragments.getParamsList()) 
{
+                // Later simplified fragments reuse the query-wide params sent 
in the first fragment.
+                if (fragment.isSetFileScanParams()) {
+                    paramsByNode = fragment.getFileScanParams();
+                    for (TFileScanRangeParams params : paramsByNode.values()) {
+                        checker.checkParams(params);

Review Comment:
   [P2] Check shared PME markers only for scans assigned to the recipient
   
   `ThriftPlansBuilder` puts the query-wide `fileScanParams` map on every 
worker's first fragment. With `prefer_compute_node_for_external_table=true` and 
`min_backend_num_for_external_table=1`, an encrypted scan can run only on 
capable compute C while a joined OLAP table's sole replica runs on mixed M. A 
failed heartbeat can revoke M's encryption lease during liveness grace while 
leaving it query-available. Admission and every encrypted scan target pass, but 
this loop rejects M's OLAP-only fragment with `READ_UNAVAILABLE` because it 
checks the unused PME entry. M receives no encrypted range or key. Scope 
shared-parameter capability checks to scan nodes actually executed by the 
recipient, retaining marker-only validation for its real file scans, and add a 
mixed OLAP/encrypted-Iceberg regression. This is distinct from the fixed 
admission/scan-subset mismatch.



##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergScanRange.java:
##########
@@ -454,13 +455,17 @@ public void populateRangeParams(TTableFormatFileDesc 
formatDesc, TFileRangeDesc
             // field-ids/DV-offset exactly as legacy built them.
             List<TIcebergDeleteFileDesc> deleteDescs = new 
ArrayList<>(deleteFiles.size());
             for (DeleteFile delete : deleteFiles) {
+                nativeEncryption |= delete.encryption != null;
                 deleteDescs.add(delete.toThrift());
             }
             fileDesc.setDeleteFiles(deleteDescs);
         }
 
         // native reader format (JNI = system tables, P6.5). Leaves the 
parent's default (FORMAT_JNI) otherwise.
-        if ("orc".equals(fileFormat)) {
+        if (nativeEncryption) {
+            // Older readers may ignore optional key fields; a distinct 
physical wire value must stop them.
+            rangeDesc.setFormatType(TFileFormatType.FORMAT_PARQUET_PME);

Review Comment:
   [P2] Keep encrypted Parquet eligible for BE split refinement
   
   The new PME format is missing from 
`FileScanLocalState::_can_generate_physical_splits` and 
`FileQueryScanNode.isColumnarFormat`. Iceberg still coarsens a keyed Parquet 
file without deletes to `file_split_size_on_fe` (512 MiB by default). For one 
256 MiB file with multiple row groups, this produces one FE range, but the BE 
gate returns false for PME and caps `_max_scanners` at one; 
`_should_refine_source_split` then refuses to generate children because it 
requires at least two scanners. The equivalent plaintext scan retains parallel 
row-group readers. Include PME in both columnar gates, preserving the existing 
delete/serial restrictions, and cover a single encrypted coarse range in the 
refinement tests.



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