-
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-28190: Fix heartbeatLockMaterializationRebuild #5186
HIVE-28190: Fix heartbeatLockMaterializationRebuild #5186
Conversation
@kasakrisz , what do you think, what should be the expected behaviour when the heartbeat fails:
|
...etastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/hadoop/hive/metastore/txn/jdbc/functions/HeartbeatTxnRangeFunction.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
IMHO It should work like in case of other DML statements ( |
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.
please don't merge without the tests, see TestTxnHandler#testHeartbeatLock
...etastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
Outdated
Show resolved
Hide resolved
b5b981f
to
4107ccd
Compare
4107ccd
to
c8a9a0c
Compare
ql/src/test/org/apache/hadoop/hive/ql/materializedview/TestHeartbeatTxnRangeFunction.java
Outdated
Show resolved
Hide resolved
ql/src/test/org/apache/hadoop/hive/ql/materializedview/TestHeartbeatTxnRangeFunction.java
Outdated
Show resolved
Hide resolved
ql/src/test/org/apache/hadoop/hive/ql/materializedview/TestHeartbeatTxnRangeFunction.java
Outdated
Show resolved
Hide resolved
ql/src/test/org/apache/hadoop/hive/ql/materializedview/TestHeartbeatTxnRangeFunction.java
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
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 +1
@deniskuzZ , thank you for your help. |
…i, reviewed by Attila Turoczy, Denys Kuzmenko, Krisztian Kasa, Zoltan Ratkai) Closes apache#5186
There is a bug in heartbeatLockMaterializationRebuild that is trivial to fix:
https://github.com/apache/hive/blob/5e78ce0e1f1577c4b68f9149430c1d6ad26fd91d/stand[…]/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
As you can see, the paremterized query expects 2 parameter and it gets 4. It cannot possibly run at all.
The reason why it haven't discovered yet is it is a heartbeating function that runs in a background - so it can be only spotted by checking the logs:
The fix fixes an other issue as well, in https://github.com/apache/hive/blob/881d38fb4d7af3ed4fa55b71598b5057080f8829/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/functions/HeartbeatTxnRangeFunction.java#L85
It says if we were able to update all the transactions in the given range successfully, just kindly roll it back instead of committing the changes.
What changes were proposed in this pull request?
Fix those two issues
Why are the changes needed?
Because it is wrong
Does this PR introduce any user-facing change?
No
Is the change a dependency upgrade?
No
How was this patch tested?
Firstly, it was checked manually, by modifying an existing qtest materialized_view_create_rewrite_6.q and checking the logs, like this:
It makes the heartbeat times out immediately, right after the transaction starts.
At the end solution, I added the following tests:
HeartbeatTxnRangeFunction