wombatu-kun commented on code in PR #19370:
URL: https://github.com/apache/hudi/pull/19370#discussion_r3644088665
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java:
##########
@@ -225,12 +234,33 @@ private void acquireLockInternal(long time, TimeUnit
unit, LockComponent lockCom
* takes a long time. Must be called only after {@link #lock} has been set.
*/
private void scheduleHeartbeat() {
- Heartbeat heartbeat = new Heartbeat(hiveClient, lock.getLockid());
+ Heartbeat heartbeat = new Heartbeat(hiveClient, lock.getLockid(),
this::onLockLost);
long heartbeatIntervalMs = lockConfiguration.getConfig()
.getLong(LOCK_HEARTBEAT_INTERVAL_MS_KEY,
DEFAULT_LOCK_HEARTBEAT_INTERVAL_MS);
future = executor.scheduleAtFixedRate(heartbeat, heartbeatIntervalMs / 2,
heartbeatIntervalMs, TimeUnit.MILLISECONDS);
}
+ /**
+ * Invoked from the heartbeat thread once the metastore reports the lock as
expired or aborted.
+ * The lock cannot be renewed anymore, so stop heartbeating it and stop
claiming it is held.
+ */
+ private void onLockLost(Exception cause) {
Review Comment:
Done 25abde0461ba. The callback carries the lock id it was scheduled for and
no-ops unless that id is still the one held.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]