You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "sercanCyberVision (via GitHub)" <gi...@apache.org> on 2024/09/24 20:28:42 UTC

[PR] HIVE-28534: Improve HMS Client Exception Handling for Hive-3 [hive]

sercanCyberVision opened a new pull request, #5465:
URL: https://github.com/apache/hive/pull/5465

   **MOTIVATION**
   When the HMS client fails to connect to the server due to a `TTransportException`, there is no issue with error reporting.
   
   However, when the failure is caused by an `IOException`, the exception object, which is used for reporting purposes, remains null. As a result, it does not properly capture the root cause, and end-users encounter an unrelated NPE, masking the actual issue.
   ```
   Exception in thread "main" java.lang.AssertionError: Unable to connect to HMS!
   	at TestHMS.main(TestHMS.java:20)
   Caused by: java.lang.NullPointerException
   	at org.apache.hadoop.util.StringUtils.stringifyException(StringUtils.java:90)
   	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:613)
   	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:233)
   	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:145)
   	at TestHMS.main(TestHMS.java:13)
   ```
   
   **SOLUTION**
   I have added an `IOException` object to capture the corresponding exception during connection attempts. If the `IOException` is not null, it will now be output, providing clearer information about the failure.
   
   **CHECKS**
   After applying the patch, instead of an NPE, I now receive a proper error message:
   ```
   Exception in thread "main" java.lang.AssertionError: Unable to connect to HMS!
   	at TestHMS.main(TestHMS.java:20)
   Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: 
   javax.security.auth.login.LoginException: Unable to obtain MapR credentials)
   	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:618)
   	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:233)
   	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:145)
   	at TestHMS.main(TestHMS.java:13)
   ```


-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-28534: Improve HMS Client Exception Handling for Hive-3 [hive]

Posted by "difin (via GitHub)" <gi...@apache.org>.
difin commented on code in PR #5465:
URL: https://github.com/apache/hive/pull/5465#discussion_r1774181978


##########
standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -456,6 +457,7 @@ private void open() throws MetaException {
                   trustStorePath, trustStorePassword );
               LOG.info("Opened an SSL connection to metastore, current connections: " + connCount.incrementAndGet());
             } catch(IOException e) {
+              ioException = e;

Review Comment:
   This assignment is excessive cause it's not doing anything after the IllegalArgumentException is thrown on the next line.



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-28534: Improve HMS Client Exception Handling for Hive-3 [hive]

Posted by "sercanCyberVision (via GitHub)" <gi...@apache.org>.
sercanCyberVision commented on code in PR #5465:
URL: https://github.com/apache/hive/pull/5465#discussion_r1774213876


##########
standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -456,6 +457,7 @@ private void open() throws MetaException {
                   trustStorePath, trustStorePassword );
               LOG.info("Opened an SSL connection to metastore, current connections: " + connCount.incrementAndGet());
             } catch(IOException e) {
+              ioException = e;

Review Comment:
   Thank you @difin for the review.
   You're right! 
   
   if the `IllegalArgumentException` isn't explicitly intended to terminate reattempts, I can change it to `MetaException` to log the error message and allow the connection process to make another attempt.
   
   If not, I can remove the assignment.



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-28534: Improve HMS Client Exception Handling for Hive-3 [hive]

Posted by "sercanCyberVision (via GitHub)" <gi...@apache.org>.
sercanCyberVision commented on code in PR #5465:
URL: https://github.com/apache/hive/pull/5465#discussion_r1774213876


##########
standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -456,6 +457,7 @@ private void open() throws MetaException {
                   trustStorePath, trustStorePassword );
               LOG.info("Opened an SSL connection to metastore, current connections: " + connCount.incrementAndGet());
             } catch(IOException e) {
+              ioException = e;

Review Comment:
   Thank you @difin for the review.
   You're right! 
   
   If the `IllegalArgumentException` is explicitly intended to terminate reattempts, I can remove the assignment.
   
   Otherwise, I can change it to `MetaException` to log the error message and allow the connection process to retry.



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


Re: [PR] HIVE-28534: Improve HMS Client Exception Handling for Hive-3 [hive]

Posted by "sercanCyberVision (via GitHub)" <gi...@apache.org>.
sercanCyberVision commented on code in PR #5465:
URL: https://github.com/apache/hive/pull/5465#discussion_r1777147817


##########
standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java:
##########
@@ -456,6 +457,7 @@ private void open() throws MetaException {
                   trustStorePath, trustStorePassword );
               LOG.info("Opened an SSL connection to metastore, current connections: " + connCount.incrementAndGet());
             } catch(IOException e) {
+              ioException = e;

Review Comment:
   @deniskuzZ, could you please review the options mentioned above and let us know which one you think we should proceed with?



-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org