[ https://issues.apache.org/jira/browse/HIVE-9436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14288623#comment-14288623 ]
Sushanth Sowmyan commented on HIVE-9436: ---------------------------------------- Hari, good point - I had a look at RetryingHMSHandler, and the code is rather similar. There seems to be two main differences though: First, on the HMSHandler side, the exact cause-chain of exceptions are still available, and we can compare using "instanceof", whereas on the client-side, we have only the first level exception object, and all internal objects are serialized, so we have to look at the messages instead. Secondly, the client has thrift-related exceptions which are acceptable as well. Still, possibly, we should undertake to refactor this into MetastoreUtils with a parameter which asks whether to look strictly at types, or look inside the messages as well, and call that from both sides, and also pass in a list of acceptable exception types. In that scenario, this would be usable all over the place where we need to retry. I would, however, like to tackle the refactor as an improvement rather than in a bug-fix jira if that's okay. > RetryingMetaStoreClient does not retry JDOExceptions > ---------------------------------------------------- > > Key: HIVE-9436 > URL: https://issues.apache.org/jira/browse/HIVE-9436 > Project: Hive > Issue Type: Bug > Affects Versions: 0.14.0, 0.13.1 > Reporter: Sushanth Sowmyan > Assignee: Sushanth Sowmyan > Attachments: HIVE-9436.2.patch, HIVE-9436.patch > > > RetryingMetaStoreClient has a bug in the following bit of code: > {code} > } else if ((e.getCause() instanceof MetaException) && > e.getCause().getMessage().matches("JDO[a-zA-Z]*Exception")) { > caughtException = (MetaException) e.getCause(); > } else { > throw e.getCause(); > } > {code} > The bug here is that java String.matches matches the entire string to the > regex, and thus, that match will fail if the message contains anything before > or after JDO[a-zA-Z]\*Exception. The solution, however, is very simple, we > should match .\*JDO[a-zA-Z]\*Exception.\* -- This message was sent by Atlassian JIRA (v6.3.4#6332)