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

Samarth Jain commented on PHOENIX-3942:
---------------------------------------

[~karanmehta93], thanks for the patch. I think it would make sense to have a 
null check in general for all other scan metrics too. Since we are relying on 
an external system to expose these metrics, we should guard ourselves from 
these metrics being not available. 

Something like this:

{code}
changeMetric(scanMetricsHolder.getCountOfRowsFiltered(), 
scanMetricsMap.get(COUNT_OF_ROWS_FILTERED_KEY_METRIC_NAME));
 private static void changeMetric(CombinableMetric metric, Long value) {
        if (value != null) {
            metric.change(value);
        }
    }
{code}

We should make the above change to all branches. For 1.1, it would make sense 
to remove the metrics you have in the patch and have this check too.

> Fix failing PhoenixMetricsIT test
> ---------------------------------
>
>                 Key: PHOENIX-3942
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3942
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Karan Mehta
>
> The PhoenixMetricsIT seems to be consistently failing in setup with the 
> following exception:
> {code}
> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.028 
> s <<< FAILURE! - in org.apache.phoenix.monitoring.PhoenixMetricsIT
> [ERROR] org.apache.phoenix.monitoring.PhoenixMetricsIT  Time elapsed: 0.025 s 
>  <<< ERROR!
> org.apache.phoenix.exception.PhoenixIOException: 
> java.lang.NullPointerException
>         at 
> org.apache.phoenix.monitoring.PhoenixMetricsIT.doSetup(PhoenixMetricsIT.java:95)
> Caused by: java.util.concurrent.ExecutionException: 
> java.lang.NullPointerException
>         at 
> org.apache.phoenix.monitoring.PhoenixMetricsIT.doSetup(PhoenixMetricsIT.java:95)
> Caused by: java.lang.NullPointerException
> {code}
> See 
> https://builds.apache.org/job/Phoenix-4.x-HBase-1.1/436/display/redirect?page=changes
>  for more information.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to