-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HIVE-28851: HiveIcebergMetaHook acquires an HMS lock, regardless of the config and operations #5722
Conversation
…he config and operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses an issue where HiveIcebergMetaHook acquires an HMS lock unnecessarily during certain operations, causing Stat tasks to fail on Iceberg tables. Key changes include:
- Adding a new test (testStatsWithPessimisticLockInsert) to verify that lock acquisition is properly bypassed when not required.
- Refactoring HiveIcebergMetaHook to conditionally acquire a lock by introducing a helper method (lockObject) and logic to determine lock eligibility (hiveLockEnabled).
- Making the HiveLock interface public to support its use across packages.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStatistics.java | Adds a test to verify that statistics computation bypasses locking when appropriate. |
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java | Refactors lock acquisition logic to conditionally acquire locks based on operation type and configuration. |
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveLock.java | Updates the interface to public to enable broader usage. |
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStatistics.java
Outdated
Show resolved
Hide resolved
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStatistics.java
Outdated
Show resolved
Hide resolved
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
Outdated
Show resolved
Hide resolved
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
Outdated
Show resolved
Hide resolved
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStatistics.java
Outdated
Show resolved
Hide resolved
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStatistics.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, pending tests
Thanks for the review! The tests seem to be pending due to the "This workflow requires approval from a maintainer" requirement. Could you please approve the workflow? |
The tests When This commit adjusts |
|
|
You're right. Enabling test failure log:
|
What changes were proposed in this pull request?
HiveIcebergMetaHook acquires the HMS lock only when necessary, depending on the operationType and the config(
engine.hive.lock-enabled
).Why are the changes needed?
Stat tasks fail during insert queries on Iceberg tables.
How to reproduce:
StatsTask Fail:
HIVE_LOCKS Table:
Does this PR introduce any user-facing change?
The Stat tasks of the Iceberg table will succeed
Is the change a dependency upgrade?
No
How was this patch tested?
Unit test added