Hugo-WB commented on code in PR #16395:
URL: https://github.com/apache/iceberg/pull/16395#discussion_r3261173504
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -266,6 +276,13 @@ private TableMetadata internalApply() {
.filter(schemaId -> !reachableSchemas.contains(schemaId))
.collect(Collectors.toSet());
updatedMetaBuilder.removeSchemas(schemasToRemove);
+
+ Set<String> encryptionKeysToRemove =
+ base.encryptionKeys().stream()
+ .map(EncryptedKey::keyId)
+ .filter(keyId -> !reachableKeyIds.contains(keyId))
+ .collect(Collectors.toSet());
+ encryptionKeysToRemove.forEach(updatedMetaBuilder::removeEncryptionKey);
Review Comment:
In a similar line to: https://github.com/apache/iceberg/pull/12670
I see 2 arguments to introduce/make `RemoveEncryptionKey` ->
`RemoveEncryptionKeys`. (Bulk).
- Performance: We've ran into performance issues server side when expiring
150k+ snapshots in a non-bulk way. Bulking the changes fixed it. Although I
don't expect `RemoveEncryptionKey` to be as expensive of a call as
`RemoveSnapshot`. So perhaps a premature optimisation.
- Consistency: Consistent with the other `RemovePartitionSpecs` and
`RemoveSchemas`
Curious to hear thoughts.
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -241,6 +244,12 @@ private TableMetadata internalApply() {
reachableSpecs.add(base.defaultSpecId());
Set<Integer> reachableSchemas = Sets.newConcurrentHashSet();
reachableSchemas.add(base.currentSchemaId());
+ Set<String> reachableKeyIds =
+ Sets.newConcurrentHashSet(
+ base.encryptionKeys().stream()
+ .map(EncryptedKey::encryptedById)
+ .filter(Objects::nonNull)
Review Comment:
For my own understanding. Couldn't figure out why `encryptedById` is
nullable. In what cases do we expect this to be null?
--
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]