[jira] [Commented] (HIVE-4835) Methods in Metrics class could avoid throwing IOException

2013-07-09 Thread Ashutosh Chauhan (JIRA)

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

Ashutosh Chauhan commented on HIVE-4835:


I agree. Metrics is best effort, throwing exceptions from it is not best of the 
ideas. 
CC'ing [~sushanth] who originally authored this class.

 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


[jira] [Commented] (HIVE-4835) Methods in Metrics class could avoid throwing IOException

2013-07-09 Thread Sushanth Sowmyan (JIRA)

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

Sushanth Sowmyan commented on HIVE-4835:


Agreed, that should make a lot of the metrics calls simpler, and will clean up 
calling code.

 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


[jira] [Commented] (HIVE-4835) Methods in Metrics class could avoid throwing IOException

2013-07-09 Thread Thiruvel Thirumoolan (JIRA)

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

Thiruvel Thirumoolan commented on HIVE-4835:


I think the method should return at-least return a boolean on whether an 
increment succeeded, so a corresponding decrement can be avoided if the 
increment failed. An incr might succeed but a decr fail, but that's again best 
effort to be consistent.

 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


[jira] [Commented] (HIVE-4835) Methods in Metrics class could avoid throwing IOException

2013-07-09 Thread Arup Malakar (JIRA)

[ 
https://issues.apache.org/jira/browse/HIVE-4835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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