Skip to content

Conversation

@smaheshwar-pltr
Copy link
Contributor

@smaheshwar-pltr smaheshwar-pltr commented Dec 4, 2025

While working on porting #14427 over to #13225, suspected that the flow could be simplified to handle the transaction cases.

This PR also adds tests inspired by the CatalogTests for these cases.

: TableProperties.ENCRYPTION_DEK_LENGTH_DEFAULT;

encryptedKeysFromMetadata = Optional.ofNullable(current().encryptionKeys());
encryptedKeys =
Copy link
Contributor Author

@smaheshwar-pltr smaheshwar-pltr Dec 4, 2025

Choose a reason for hiding this comment

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

If we can assume that encryption properties are unchanging (aside from keys) and therefore do not need to be updated on refresh, there's a actually simpler approach that just adds metadata keys to the current EM's transient state: https://github.com/apache/iceberg/compare/main...smaheshwar-pltr:iceberg:sm/add-keys?expand=1.

We could also go with that approach, and introduce setters in case we can't make that assumption. But then I suspect just re-initialising the EM on refresh makes more sense.

Curious though for thoughts on this assumption.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I like the idea of rather re-initializing the EM on refresh, so I'd rather stick to it. I suspect the transient state was never intended to be accesible from outside with set/put methods.

@ggershinsky let me know if you agree.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @smaheshwar-pltr and @szlta , I also think it's cleaner to re-init the EM upon refresh.

public void testRefresh() {
catalog.initialize(catalogName, catalogConfig);
Table table = catalog.loadTable(tableIdent);
validationCatalog.initialize(catalogName, catalogConfig);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically, the catalog -> validationCatalog isn't needed here, but figure it doesn't hurt to set things up for #13225.

}

@TestTemplate
public void testConcurrentAppendTransactions() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests an append retry


// See CatalogTests#testConcurrentReplaceTransactions
@TestTemplate
public void testConcurrentReplaceTransactions() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests a replace retry - note that replace retries don't re-apply updates to refreshed metadata, because they'll anyway replace the whole table. #13225 didn't handle this case at one point, because it requires keys to be maintained on refreshing different metadata, so I think valuable to test

@smaheshwar-pltr smaheshwar-pltr marked this pull request as ready for review December 4, 2025 21:22
@smaheshwar-pltr
Copy link
Contributor Author

cc @huaxingao @ggershinsky @szlta, LMKWYT - simplifying this code reduces duplication with the REST work in #13225.

Copy link
Contributor

@szlta szlta left a comment

Choose a reason for hiding this comment

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

Overall this looks great to me, thanks @smaheshwar-pltr

Copy link
Contributor

@huaxingao huaxingao left a comment

Choose a reason for hiding this comment

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

LGTM

@huaxingao huaxingao merged commit cbd3579 into apache:main Dec 10, 2025
44 checks passed
@huaxingao
Copy link
Contributor

Thanks @smaheshwar-pltr for the PR! Thanks @ggershinsky @szlta for the review!

@smaheshwar-pltr
Copy link
Contributor Author

Thanks all for the reviews 🙏

@smaheshwar-pltr smaheshwar-pltr deleted the simplify-hive-keys-and-test branch December 11, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants