hililiwei commented on code in PR #6451:
URL: https://github.com/apache/iceberg/pull/6451#discussion_r1056350192


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -617,9 +624,27 @@ long acquireLock() throws UnknownHostException, 
TException, InterruptedException
             Lists.newArrayList(lockComponent),
             System.getProperty("user.name"),
             InetAddress.getLocalHost().getHostName());
-    LockResponse lockResponse = metaClients.run(client -> 
client.lock(lockRequest));
-    AtomicReference<LockState> state = new 
AtomicReference<>(lockResponse.getState());
-    long lockId = lockResponse.getLockid();
+
+    // Only works in Hive 2 or later.
+    if (MetastoreVersion.min(MetastoreVersion.HIVE_2)) {
+      lockRequest.setAgentInfo(agentInfo);
+    }
+
+    Pair<Long, LockState> lockResult;
+    try {
+      lockResult = tryLock(lockRequest);
+    } catch (TException e) {
+      // Try to find the lock. Only works in Hive 2 or later.
+      if (MetastoreVersion.min(MetastoreVersion.HIVE_2)) {
+        lockResult = reTryLock(agentInfo, lockRequest);
+      } else {
+        LOG.info("Could not retry with HMSClient {}", 
MetastoreVersion.current(), e);

Review Comment:
   Should this be a higher level log, like `warn`?



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