Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.0.0
-
None
-
None
Description
org.apache.hadoop.hive.metastore.RetryingMetaStoreClient
} catch (UndeclaredThrowableException e) { throw e.getCause(); } catch (InvocationTargetException e) { Throwable t = e.getCause(); if (t instanceof TApplicationException) { TApplicationException tae = (TApplicationException)t; switch (tae.getType()) { case TApplicationException.UNSUPPORTED_CLIENT_TYPE: case TApplicationException.UNKNOWN_METHOD: case TApplicationException.WRONG_METHOD_NAME: case TApplicationException.INVALID_PROTOCOL: throw t; default: // TODO: most other options are probably unrecoverable... throw? caughtException = tae; } } else if ((t instanceof TProtocolException) || (t instanceof TTransportException)) { // TODO: most protocol exceptions are probably unrecoverable... throw? caughtException = (TException)t; } else if ((t instanceof MetaException) && t.getMessage().matches( "(?s).*(JDO[a-zA-Z]*|TProtocol|TTransport)Exception.*") && !t.getMessage().contains("java.sql.SQLIntegrityConstraintViolationException")) { caughtException = (MetaException)t; } else { throw t; } } catch (MetaException e) { if (e.getMessage().matches("(?s).*(IO|TTransport)Exception.*") && !e.getMessage().contains("java.sql.SQLIntegrityConstraintViolationException")) { caughtException = e; } else { throw e; }
Using these magic string checks is very fragile. The Metastore should be throwing tailored exceptions instead of relying on string checking in the client code that bubble up from third-party libraries. Metastore should control the underlying libraries and their specific exceptions.
Attachments
Issue Links
- is related to
-
HIVE-10384 RetryingMetaStoreClient does not retry wrapped TTransportExceptions
- Closed