Core: Only add required encrypted keys to metadata#16837
Closed
Hugo-WB wants to merge 1 commit into
Closed
Conversation
a850070 to
84227db
Compare
Contributor
Author
|
Closing in favor of: #16353 I think makes sense to just include it there. I was also misunderstanding that this would fix the expiration issue on this own, but since we only restricting the keys we are adding, this doesn't solve removing encryption keys on it's own. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses: #16352
After putting up: #16353 which cleaned encryption keys at
expire_snapshottime by removing the encryption key associated with the removed snapshot. (InTableMetadata::RemoveSnapshotalsoRemoveEncryptionKeyfor the keyId of the removed snapshot).When writing E2E tests for above, it wasn't working due to HiveTableOperations::doCommit always adding all keys from the EncryptionManager into the TableMetadata.
From my rough understanding, sorry if this is wrong 😅,
EncryptionManageris independent ofTableMetadata, they "branch off" at metadata load time, and at commit time they are "reconciled".The current "reconciliation" logic is to add all keys in
EncryptionManagertoTableMetadata.This leads to issues when trying to remove keys. Even if the EncryptedKey is removed from the base metadata and the new
metadatadoes not have the key, removal of EncryptionKeys from metadata is never propagated to the EncryptionManager.This PR proposes to change the "reconciliation" logic to only add keys that are still referenced/needed by the new metadata file.
This effectively does cleanup at runtime.
Ideas for alternative solutions (Open to ideas here, I think I have a rather limited view here of how things are correlated with each-other):
This also related to the REST catalog implementation of encryption: #13225
The above PR has the same issue as the Hive implementation, where it will always add all keys from the
EncryptionManager.