hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arup Malakar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-4835) Methods in Metrics class could avoid throwing IOException
Date Tue, 09 Jul 2013 23:13:49 GMT

    [ https://issues.apache.org/jira/browse/HIVE-4835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13703975#comment-13703975
] 

Arup Malakar commented on HIVE-4835:
------------------------------------

[~thiruvel] Makes sense, that way the caller could handle failure if it prefers to, but is
not forced to.
                
> Methods in Metrics class could avoid throwing IOException
> ---------------------------------------------------------
>
>                 Key: HIVE-4835
>                 URL: https://issues.apache.org/jira/browse/HIVE-4835
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 0.11.0
>            Reporter: Arup Malakar
>            Priority: Minor
>
> I see that most of the methods in the Metrics class throws exception:
> {code:java}
> public void resetMetrics() throws IOException {
> public void open() throws IOException {
> public void close() throws IOException {
> public void reopen() throws IOException {
> public static void init() throws Exception {
> public static Long incrementCounter(String name) throws IOException{
> public static Long incrementCounter(String name, long increment) throws IOException{
> public static void set(String name, Object value) throws IOException{
> public static Object get(String name) throws IOException{
> public static void initializeScope(String name) throws IOException {
> public static MetricsScope startScope(String name) throws IOException{
> public static MetricsScope getScope(String name) throws IOException {
> public static void endScope(String name) throws IOException{
> {code}
> I believe Metrics should be best effort and the Metrics system should just log error
messages in case it is unable to capture the Metrics. Throwing exception makes the caller
code unnecessarily lengthy. Also the caller would never want to stop execution because of
failure to capture metrics, so it ends up just logging the exception. 
> The kind of code we see is like:
> {code:java}
>       // Snippet from HiveMetaStore.java
>       try {
>         Metrics.startScope(function);
>       } catch (IOException e) {
>         LOG.debug("Exception when starting metrics scope"
>             + e.getClass().getName() + " " + e.getMessage());
>         MetaStoreUtils.printStackTrace(e);
>       }
> {code} 
> which could have been:
> {code:java}
> Metrics.startScope(function);
> {code}
> Thoughts?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message