Skip to content

feat(encryption): [16/N] Enable encryption for purge table - #2918

Open
xanderbailey wants to merge 3 commits into
apache:mainfrom
xanderbailey:xb/encrypted_purge
Open

feat(encryption): [16/N] Enable encryption for purge table#2918
xanderbailey wants to merge 3 commits into
apache:mainfrom
xanderbailey:xb/encrypted_purge

Conversation

@xanderbailey

@xanderbailey xanderbailey commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Working towards #2034

What changes are included in this PR?

We previously used FileIO to read manifest files rather than going through the load_manifest method which handles decryption correctly.

Are these changes tested?

Tested added to show we can purge encrypted tables.

/// (the `manifest-list-v3-encrypted.avro` testdata, an encrypted empty list)
/// are seeded into the in-memory `FileIO` at that path so callers can read
/// the current snapshot's manifest list.
pub async fn make_encrypted_table() -> Table {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from crates/iceberg/src/transaction/mod.rs

@mbutrovich
mbutrovich self-requested a review July 27, 2026 22:00

@blackmwk blackmwk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xanderbailey for this pr!

Comment thread crates/iceberg/src/catalog/utils.rs Outdated
pub async fn drop_table_data(table_info: &Table) -> Result<()> {
let mut manifest_lists_to_delete: HashSet<String> = HashSet::new();
let mut manifests_to_delete: HashSet<String> = HashSet::new();
let mut manifests_to_delete: HashSet<ManifestFile> = HashSet::new();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let mut manifests_to_delete: HashSet<ManifestFile> = HashSet::new();
let mut manifests_to_delete: HashMap<String, ManifestFile> = HashSet::new();

To use ManifestFile as key, it requires a lot including equality and hashing, using path as key is more safe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d25c814

Very nice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this issue, but we should add an #cfg[(test)] in lib.rs, it should not be public api.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to do this in a follow up, I thought it was odd that this was pub.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment thread crates/iceberg/src/catalog/utils.rs Outdated
}

#[cfg(test)]
mod tests {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitating to add this ut. The preferred test should be purging encrypted table in the catalog ut, see crates/catalog/loader/tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there harm in a targeted unit test here? It's a little harder to write good tests at the catalog level because we block commits today (link) but I'd be happy to create an issue to add these regression tests in crates/catalog/loader/tests if that works for you?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worrying about the maintainability. I prefer to create an issue to add the integration tests later.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a utilit method shared by all catalogs, so I don't want to add ut for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you prefer to add this unit test now or when we add the catalog level tests?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to remove this ut for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbutrovich mbutrovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion with @blackmwk on the manifest-path-vs-ManifestFile keying and the test-coverage question already covers what I would have raised here. Thanks @blackmwk and @xanderbailey!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants