szehon-ho commented on code in PR #5036:
URL: https://github.com/apache/iceberg/pull/5036#discussion_r906251590


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -631,4 +652,41 @@ 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) {
+        throw new CommitFailedException(e, "Fail to heartbeat for lock: %d", 
lockId);
+      }
+    }
+
+    public void schedule(ScheduledExecutorService scheduler) {
+      future =

Review Comment:
   Nit: I think most of the code does not newline so soon, maybe we can newline 
in the arguments of the scheduleAtFixedRate.



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -631,4 +652,41 @@ 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;

Review Comment:
   Is the code block necessary?
   
    client -> client.heartbeat(0, lockId);



##########
hive-metastore/src/test/java/org/apache/iceberg/hive/HiveMetastoreTest.java:
##########
@@ -43,8 +43,12 @@ public abstract class HiveMetastoreTest {
   @BeforeClass
   public static void startMetastore() throws Exception {
     HiveMetastoreTest.metastore = new TestHiveMetastore();
-    metastore.start();
-    HiveMetastoreTest.hiveConf = metastore.hiveConf();
+    if (HiveMetastoreTest.hiveConf != null) {

Review Comment:
   Trying to understand, how would this happen?



-- 
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]

Reply via email to