pvary commented on a change in pull request #2119:
URL: https://github.com/apache/iceberg/pull/2119#discussion_r563549890



##########
File path: hive-metastore/src/main/java/org/apache/iceberg/hive/ClientPool.java
##########
@@ -54,7 +54,7 @@
       return action.run(client);
 
     } catch (Exception exc) {
-      if (reconnectExc.isInstance(exc)) {
+      if (reconnectExc.isInstance(exc) || failureDetection(exc)) {

Review comment:
       I think it would be more easy to understand if we move 
`reconnectExc.isInstance(exc)` into the `failureDetection(exc)` method as well.
   
   What do you think?

##########
File path: 
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveClientPool.java
##########
@@ -83,6 +84,15 @@ protected HiveMetaStoreClient reconnect(HiveMetaStoreClient 
client) {
     return client;
   }
 
+  @Override
+  protected boolean failureDetection(Exception e) {
+    if (Objects.nonNull(e) && e instanceof MetaException &&

Review comment:
       nit: Do we need to use `Objects.nonNull(e)`? Maybe I am old fashioned 
but should `e != null` suffice?
   
   Thanks,
   Peter

##########
File path: hive-metastore/src/main/java/org/apache/iceberg/hive/ClientPool.java
##########
@@ -54,7 +54,7 @@
       return action.run(client);
 
     } catch (Exception exc) {
-      if (reconnectExc.isInstance(exc)) {
+      if (reconnectExc.isInstance(exc) || failureDetection(exc)) {

Review comment:
       @Jecarm: This is what I have been thinking about too.
   
   And in `HiveClientPool` we can do something like this:
   ```
     @Override
     protected boolean failureDetection(Exception e) {
       if (super.failureDetection(e) || (e != null && e instanceof 
MetaException &&
               e.getMessage().contains("Got exception: 
org.apache.thrift.transport.TTransportException"))) {
         return true;
       }
       return false;
     }
   ```




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

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