Skip to content

Conversation

@abstractdog
Copy link
Contributor

@abstractdog abstractdog commented Mar 9, 2025

What changes were proposed in this pull request?

Commitlock to be created according to HiveTableOperations.hiveLockEnabled.

Why are the changes needed?

Mainly for testing purposes, where iceberg.engine.hive.lock-enabled=false, but anyway, other codepaths respect this setting before creating a lock object.

Does this PR introduce any user-facing change?

No.

Is the change a dependency upgrade?

No.

How was this patch tested?

A test introduced in HIVE-28802 without this change, waiting on a lock, and passed with this fix.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2025

Copy link
Member

@ayushtkn ayushtkn left a comment

Choose a reason for hiding this comment

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

LGTM

if (commitLock == null) {
commitLock = new MetastoreLock(conf, new CachedClientPool(conf, Maps.fromProperties(catalogProperties)),
catalogProperties.getProperty(Catalogs.NAME), hmsTable.getDbName(), hmsTable.getTableName());
if (HiveTableOperations.hiveLockEnabled(null, conf)) {
Copy link
Member

@deniskuzZ deniskuzZ Mar 9, 2025

Choose a reason for hiding this comment

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

I think, HiveIcebergMetaHook should always use MetastoreLock.
what if Hive conf is set to NO_LOCK, but the user has overridden it on the table level to METASTORE_LOCK? That would break the transaction isolation.
METASTORE_LOCK is a stronger one that checks if metadataLocation hasn't changed.

Copy link
Contributor Author

@abstractdog abstractdog Mar 10, 2025

Choose a reason for hiding this comment

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

what is interesting is that I can almost only see this whole hiveLockEnabled(...) thing used in testing scenarios, which applies to my case as well, see screenshot
Screenshot 2025-03-10 at 10 40 58

this makes me think that if I want to make my query history PR snapshot work then
a) I have to override the locking behavior and bypass it in case of tests by extending the meta hook instead and use a testing one
b) or make it work with metastore locking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems like b) works, I'm about to close this one soon

now I would appreciate a review on #5666 to finalize the first phase of query history maybe, thanks in advance!

deniskuzZ

This comment was marked as outdated.

@deniskuzZ deniskuzZ dismissed their stale review March 9, 2025 16:49

ignore

Copy link
Member

@deniskuzZ deniskuzZ left a comment

Choose a reason for hiding this comment

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

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