SinghAsDev commented on code in PR #5036:
URL: https://github.com/apache/iceberg/pull/5036#discussion_r903914952
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -631,4 +647,40 @@ private static boolean hiveEngineEnabled(TableMetadata
metadata, Configuration c
return conf.getBoolean(ConfigProperties.ENGINE_HIVE_ENABLED,
TableProperties.ENGINE_HIVE_ENABLED_DEFAULT);
}
+
+ private static class HiveLockHeartbeat implements Runnable {
+ private final ClientPool<IMetaStoreClient, TException> hmsClients;
+ private final long lockId;
+ private final long intervalMs;
+ private ScheduledFuture<?> future;
+
+ HiveLockHeartbeat(ClientPool<IMetaStoreClient, TException> hmsClients,
long lockId, long intervalMs) {
+ this.hmsClients = hmsClients;
+ this.lockId = lockId;
+ this.intervalMs = intervalMs;
+ this.future = null;
+ }
+
+ @Override
+ public void run() {
+ try {
+ hmsClients.run(client -> {
+ client.heartbeat(0, lockId);
+ return null;
+ });
+ } catch (TException | InterruptedException e) {
+ LOG.error("Fail to heartbeat for lock: {}", lockId, e);
Review Comment:
Hey @pvary , I was thinking about this more and I am wondering if throwing
CommitFailedException would really be of any benefit. Within the acquired hive
lock, the only expensive operation we do is alter table operation, which is a
blocking call. Once issued, we won't be able to abort it, even in case
heartbeat fails. Please correct me if I am missing something here. I think it
would be make more sense to handle the lock not found during unlock operation
and try to revert the commit or at least throw `CommitStateUnknownException`.
Thoughts?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]