You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "gaborkaszab (via GitHub)" <gi...@apache.org> on 2026/09/17 09:57:06 UTC

[PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

gaborkaszab opened a new pull request, #18150:
URL: https://github.com/apache/iceberg/pull/18150

   Problems this solves:
    - There is a dependency between toManifestFile() and encryptionKeys().
    - From toManifestFile()'s return type only keyId is used, but it's also present in the output of encryptionKeys()
    - manifestListFile member can be dropped
    - outputFile member can be dropped


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4037265129


##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -356,7 +356,6 @@ public Snapshot apply() {
           replacedRecords);
     }
 
-    ManifestListFile manifestListFile = writer.toManifestListFile();
     this.manifestListEncryptionKeys = writer.encryptionKeys();

Review Comment:
   If we do what I mentioned above, I think we can effectively get rid of this state on SnapshotProducer, and just pass in manifestListFile.encryptionKeys(). So it trades off more state in ManifestListFile for getting rid of state in SnapshotProducer, which I think is better as as it really shouldn't be SnapshotProducer's responsibility imo.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4037265129


##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -356,7 +356,6 @@ public Snapshot apply() {
           replacedRecords);
     }
 
-    ManifestListFile manifestListFile = writer.toManifestListFile();
     this.manifestListEncryptionKeys = writer.encryptionKeys();

Review Comment:
   If we do what I mentioned above, I think we can effectively get rid of this state on SnapshotProducer, and just pass in manifestListFile.encryptionKeys(). So it trades off more state in ManifestListFile for getting rid of state in SnapshotProducer, which I think is better as SnapshotProducer has disjoint state for encryption keys ofr manifest list and the actual manifest list which feels unfortunate as it really shouldn't be SnapshotProducer's responsibility imo.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "gaborkaszab (via GitHub)" <gi...@apache.org>.
gaborkaszab commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4035463647


##########
core/src/test/java/org/apache/iceberg/TestManifestListEncryption.java:
##########
@@ -375,7 +372,11 @@ private ManifestFile writeAndReadEncryptedManifestList(EncryptionManager em) thr
             io,
             EncryptionTestHelpers.createEncryptionManager(
                 List.of(encryptionKeys.keyEncryptionKey(), encryptionKeys.fileKey())))) {
-      List<ManifestFile> manifests = ManifestLists.read(readingIO.newInputFile(manifestListFile));
+      List<ManifestFile> manifests =
+          ManifestLists.read(
+              readingIO.newInputFile(
+                  new BaseManifestListFile(

Review Comment:
   Note, https://github.com/apache/iceberg/pull/17545 will get rid of `BaseManifestListFile` and use a more general version of `newInputFile`



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar merged PR #18150:
URL: https://github.com/apache/iceberg/pull/18150


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4037231321


##########
core/src/main/java/org/apache/iceberg/ManifestListWriter.java:
##########
@@ -98,25 +97,16 @@ public Long nextRowId() {
     return null;
   }
 
-  public ManifestListFile toManifestListFile() {

Review Comment:
   I agree that the dependency is weird, it's what I mentioned [here](https://github.com/apache/iceberg/pull/17984#discussion_r4018922664) already; we should clean that part up.
   
   But I think there's a good argument for having a `toManifestListFile` API, it's consistent with what we have for manifest files (`toManifestFile`) and I think fundamentally a writer handing back a "This is the complete object" makes it easier for consumers to just use that as a source of truth (e.g. they can do manifestList.encryptionKeys(), manifestList.location() etc).
   
   In our case the consumer is just SnapshotProducer 
   
   So what I was thinking was a good way to clean this up would be 
   
   ```
   EncryptionKeys encryptionKeys() {
      /// what you have now
   }
   
   ManifestListFile toManifestList() {
      EncryptionKeys encryptionKeys = encryptionKeys()
       return new ManifestListFile(location, encryptionKeys != null ? encryptionKeys.fileKey().keyId() : null):
   }
   
   ```
   
   So we get rid of the bad dependency ordering and still keep (imo) a useful API. 
   
   WDYT?



##########
core/src/test/java/org/apache/iceberg/TestManifestListEncryption.java:
##########
@@ -353,15 +353,12 @@ private ManifestFile writeAndReadEncryptedManifestList(EncryptionManager em) thr
             SEQ_NUM,
             SNAPSHOT_FIRST_ROW_ID);
     try (writer) {
-      assertThatThrownBy(writer::toManifestListFile)
+      assertThatThrownBy(writer::encryptionKeys)
           .isInstanceOf(IllegalStateException.class)
-          .hasMessage("Cannot build ManifestListFile, writer is not closed");
+          .hasMessage("Cannot build encryption keys, writer is not closed");
       writer.add(TEST_MANIFEST);
     }
 
-    ManifestListFile manifestListFile = writer.toManifestListFile();
-    assertThat(writer.toManifestListFile().encryptionKeyID())

Review Comment:
   One possible issue with removing this is that then we're not effectively testing the `encryptionKeys == null` which currently prevents registering 2 different keys for the same file. But fwiw the utility of testing this behavior is moot if we're only calling this from snapshot producer just once. So I'm good with the removal.



##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -356,7 +356,6 @@ public Snapshot apply() {
           replacedRecords);
     }
 
-    ManifestListFile manifestListFile = writer.toManifestListFile();
     this.manifestListEncryptionKeys = writer.encryptionKeys();

Review Comment:
   If we do what I mentioned above, I think we can effectively get rid of this state on SnapshotProducer, and just pass in manifestListFile.encryptionKeys(). So it trades off more state in ManifestListFile for getting rid of state in SnapshotProducer, which I think is better as SnapshotProducer has disjoint state for encryption keys ofr manifest list and the actual manifest list which feels unfortunate.



##########
core/src/main/java/org/apache/iceberg/ManifestListWriter.java:
##########
@@ -98,25 +97,16 @@ public Long nextRowId() {
     return null;
   }
 
-  public ManifestListFile toManifestListFile() {

Review Comment:
   I'm fine as it is btw, we can always add functions later, but just wanted to point out that the toManifestListFile was something thought through and not rushed :) but agree on cleaning up the dependency/state, that's a good thing. 



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "gaborkaszab (via GitHub)" <gi...@apache.org>.
gaborkaszab commented on PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#issuecomment-5713057061

   Hi @amogh-jahagirdar @smaheshwar-pltr @nssalian ,
   
   I think https://github.com/apache/iceberg/pull/17984 was merged in a premature state and we could have made a final cleanup on the code on the area of `ManifestListWriter`. We introduced some redundancy and ambiguous responsibilities between functions IMO.
   This is a follow-up for some cleanup. Please take a look!


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4037265129


##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -356,7 +356,6 @@ public Snapshot apply() {
           replacedRecords);
     }
 
-    ManifestListFile manifestListFile = writer.toManifestListFile();
     this.manifestListEncryptionKeys = writer.encryptionKeys();

Review Comment:
   If we do what I mentioned above, I think we can effectively get rid of this state on SnapshotProducer, and just pass in manifestListFile.encryptionKeys(). So it trades off more state in ManifestListFile (OutputFile) for getting rid of state in SnapshotProducer, which I think is better as as it really shouldn't be SnapshotProducer's responsibility imo.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4037388135


##########
core/src/main/java/org/apache/iceberg/ManifestListWriter.java:
##########
@@ -36,22 +36,21 @@ abstract class ManifestListWriter implements FileAppender<ManifestFile> {
   private final FileAppender<ManifestFile> writer;
   private final StandardEncryptionManager standardEncryptionManager;
   private final NativeEncryptionKeyMetadata manifestListKeyMetadata;
-  private final OutputFile outputFile;

Review Comment:
   Agreed, even if we do my proposed approach we can drop ManifestListFile. Though in my approach, we would need OutputFile, which I feel like is very reasonable and consistent with what we do for "regular" manifests https://github.com/apache/iceberg/blob/f1c6206d8ef4ad92a2a8bab511c5138e1124423e/core/src/main/java/org/apache/iceberg/ManifestWriter.java#L45 . The writer needs to have some reference to an output file



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "gaborkaszab (via GitHub)" <gi...@apache.org>.
gaborkaszab commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4035455063


##########
core/src/main/java/org/apache/iceberg/ManifestListWriter.java:
##########
@@ -36,22 +36,21 @@ abstract class ManifestListWriter implements FileAppender<ManifestFile> {
   private final FileAppender<ManifestFile> writer;
   private final StandardEncryptionManager standardEncryptionManager;
   private final NativeEncryptionKeyMetadata manifestListKeyMetadata;
-  private final OutputFile outputFile;

Review Comment:
   The only usage of the `outputFile` member outside of the constructor was to create a `ManifestListFile` in `toManifestListFile()`, but then it was unused later on. Now that the functions are merged, no need for this member



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: ManifestListWriter cleanup around encryption keys [iceberg]

Posted by "gaborkaszab (via GitHub)" <gi...@apache.org>.
gaborkaszab commented on code in PR #18150:
URL: https://github.com/apache/iceberg/pull/18150#discussion_r4037894410


##########
core/src/main/java/org/apache/iceberg/ManifestListWriter.java:
##########
@@ -98,25 +97,16 @@ public Long nextRowId() {
     return null;
   }
 
-  public ManifestListFile toManifestListFile() {

Review Comment:
   Thanks for the feedback, @amogh-jahagirdar !
   
   As you pointed out `SnapshotProducer` is the only user of `toManifestList()`, but in practice the `ManifestListFile` return type is not needed there, just the key ID from it. In fact, I'm [working on](https://github.com/apache/iceberg/pull/17545) dropping this whole `ManifestListFile` abstraction because there is nothing specific to manifest files and we need a way to handle manifest files, root manifest, snapshot files in the same way in term of encryption.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org