Re: Review Request 48065: AMBARI-16949 Metrics Collector API shows NPE if we use wildcard (%25 for '%') for metric name

2016-06-09 Thread Aravindan Vijayan


> On June 7, 2016, 3:07 p.m., Aravindan Vijayan wrote:
> > Has this been checked in? If you need help doing that, I can do that for 
> > you.
> 
> Jungtaek Lim wrote:
> No it's not checked in yet. Please check this in. Thanks!

Thank you Jungtaek. Patch has been committed. Please close the review.


- Aravindan


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48065/#review136468
---


On June 3, 2016, 12:43 a.m., Jungtaek Lim wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48065/
> ---
> 
> (Updated June 3, 2016, 12:43 a.m.)
> 
> 
> Review request for Ambari, Sriharsha Chintalapani and Sid Wagle.
> 
> 
> Bugs: AMBARI-16949
> https://issues.apache.org/jira/browse/AMBARI-16949
> 
> 
> Repository: ambari
> 
> 
> Description
> ---
> 
> When we request '/ws/v1/timeline/metrics' with metric name which contains %25 
> (escaped '%'), response for the API is json describing there's NPE.
> And NPE is logged for ambari-metrics-collector log file.
> 
> ```
> 2016-05-30 09:15:05,061 WARN 
> org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.appendAggregateMetricFromResultSet(PhoenixHBaseAccessor.java:810)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:772)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.HBaseTimelineMetricStore.getTimelineMetrics(HBaseTimelineMetricStore.java:178)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:372)
>   at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> ```
> 
> Reason of NPE: 
> 
> Metrics are properly fetched with wildcard. But when applying functions to 
> result set, actual metric name is not exist from map of metric name to list 
> of function.
> 
> 
> Diffs
> -
> 
>   
> ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
>  47962cb 
> 
> Diff: https://reviews.apache.org/r/48065/diff/
> 
> 
> Testing
> ---
> 
> Test failed from local but it's occurred from another modules, which is not 
> related to current modification.
> 
> ```
> Results :
> 
> Failed tests:
>   PrivilegeEventCreatorTest.putTest:107 expected:<...), Roles(
> Permission[2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...), Roles(
> Permission[1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   RepositoryVersionEventCreatorTest.postTest:70 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   RepositoryVersionEventCreatorTest.putTest:100 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   ViewPrivilegeEventCreatorTest.putTest:85 expected:<...tatus(200 OK), 
> Type([MyView), Version(MyView), Name(MyView), Permissions(
> Permission2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...tatus(200 OK), Type([null), Version(null), 
> Name(null), Permissions(
> Permission1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   
> ComponentResourceProviderTest.testGetResourcesAsAdministrator:190->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsClusterAdministrator:195->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsServiceAdministrator:200->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> 

Re: Review Request 48065: AMBARI-16949 Metrics Collector API shows NPE if we use wildcard (%25 for '%') for metric name

2016-06-07 Thread Jungtaek Lim


> On 6 7, 2016, 3:07 오후, Aravindan Vijayan wrote:
> > Has this been checked in? If you need help doing that, I can do that for 
> > you.

No it's not checked in yet. Please check this in. Thanks!


- Jungtaek


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48065/#review136468
---


On 6 3, 2016, 12:43 오전, Jungtaek Lim wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48065/
> ---
> 
> (Updated 6 3, 2016, 12:43 오전)
> 
> 
> Review request for Ambari, Sriharsha Chintalapani and Sid Wagle.
> 
> 
> Bugs: AMBARI-16949
> https://issues.apache.org/jira/browse/AMBARI-16949
> 
> 
> Repository: ambari
> 
> 
> Description
> ---
> 
> When we request '/ws/v1/timeline/metrics' with metric name which contains %25 
> (escaped '%'), response for the API is json describing there's NPE.
> And NPE is logged for ambari-metrics-collector log file.
> 
> ```
> 2016-05-30 09:15:05,061 WARN 
> org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.appendAggregateMetricFromResultSet(PhoenixHBaseAccessor.java:810)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:772)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.HBaseTimelineMetricStore.getTimelineMetrics(HBaseTimelineMetricStore.java:178)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:372)
>   at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> ```
> 
> Reason of NPE: 
> 
> Metrics are properly fetched with wildcard. But when applying functions to 
> result set, actual metric name is not exist from map of metric name to list 
> of function.
> 
> 
> Diffs
> -
> 
>   
> ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
>  47962cb 
> 
> Diff: https://reviews.apache.org/r/48065/diff/
> 
> 
> Testing
> ---
> 
> Test failed from local but it's occurred from another modules, which is not 
> related to current modification.
> 
> ```
> Results :
> 
> Failed tests:
>   PrivilegeEventCreatorTest.putTest:107 expected:<...), Roles(
> Permission[2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...), Roles(
> Permission[1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   RepositoryVersionEventCreatorTest.postTest:70 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   RepositoryVersionEventCreatorTest.putTest:100 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   ViewPrivilegeEventCreatorTest.putTest:85 expected:<...tatus(200 OK), 
> Type([MyView), Version(MyView), Name(MyView), Permissions(
> Permission2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...tatus(200 OK), Type([null), Version(null), 
> Name(null), Permissions(
> Permission1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   
> ComponentResourceProviderTest.testGetResourcesAsAdministrator:190->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsClusterAdministrator:195->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsServiceAdministrator:200->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> AmbariLdapDataPopulatorTest.testSynchronizeExistingLdapGroups_removeDuringIteration:333
>   Expectation failure on verify:
> 

Re: Review Request 48065: AMBARI-16949 Metrics Collector API shows NPE if we use wildcard (%25 for '%') for metric name

2016-06-07 Thread Aravindan Vijayan

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48065/#review136468
---


Ship it!




Has this been checked in? If you need help doing that, I can do that for you.

- Aravindan Vijayan


On June 3, 2016, 12:43 a.m., Jungtaek Lim wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48065/
> ---
> 
> (Updated June 3, 2016, 12:43 a.m.)
> 
> 
> Review request for Ambari, Sriharsha Chintalapani and Sid Wagle.
> 
> 
> Bugs: AMBARI-16949
> https://issues.apache.org/jira/browse/AMBARI-16949
> 
> 
> Repository: ambari
> 
> 
> Description
> ---
> 
> When we request '/ws/v1/timeline/metrics' with metric name which contains %25 
> (escaped '%'), response for the API is json describing there's NPE.
> And NPE is logged for ambari-metrics-collector log file.
> 
> ```
> 2016-05-30 09:15:05,061 WARN 
> org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.appendAggregateMetricFromResultSet(PhoenixHBaseAccessor.java:810)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:772)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.HBaseTimelineMetricStore.getTimelineMetrics(HBaseTimelineMetricStore.java:178)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:372)
>   at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> ```
> 
> Reason of NPE: 
> 
> Metrics are properly fetched with wildcard. But when applying functions to 
> result set, actual metric name is not exist from map of metric name to list 
> of function.
> 
> 
> Diffs
> -
> 
>   
> ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
>  47962cb 
> 
> Diff: https://reviews.apache.org/r/48065/diff/
> 
> 
> Testing
> ---
> 
> Test failed from local but it's occurred from another modules, which is not 
> related to current modification.
> 
> ```
> Results :
> 
> Failed tests:
>   PrivilegeEventCreatorTest.putTest:107 expected:<...), Roles(
> Permission[2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...), Roles(
> Permission[1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   RepositoryVersionEventCreatorTest.postTest:70 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   RepositoryVersionEventCreatorTest.putTest:100 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   ViewPrivilegeEventCreatorTest.putTest:85 expected:<...tatus(200 OK), 
> Type([MyView), Version(MyView), Name(MyView), Permissions(
> Permission2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...tatus(200 OK), Type([null), Version(null), 
> Name(null), Permissions(
> Permission1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   
> ComponentResourceProviderTest.testGetResourcesAsAdministrator:190->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsClusterAdministrator:195->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsServiceAdministrator:200->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> AmbariLdapDataPopulatorTest.testSynchronizeExistingLdapGroups_removeDuringIteration:333
>   Expectation failure on verify:
> AmbariLdapDataPopulatorTestInstance.getLdapGroupByMemberAttr("group2"): 
> expected: 1, actual: 0
>   

Re: Review Request 48065: AMBARI-16949 Metrics Collector API shows NPE if we use wildcard (%25 for '%') for metric name

2016-06-07 Thread Sid Wagle

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48065/#review136413
---


Ship it!




- Sid Wagle


On June 3, 2016, 12:43 a.m., Jungtaek Lim wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48065/
> ---
> 
> (Updated June 3, 2016, 12:43 a.m.)
> 
> 
> Review request for Ambari, Sriharsha Chintalapani and Sid Wagle.
> 
> 
> Bugs: AMBARI-16949
> https://issues.apache.org/jira/browse/AMBARI-16949
> 
> 
> Repository: ambari
> 
> 
> Description
> ---
> 
> When we request '/ws/v1/timeline/metrics' with metric name which contains %25 
> (escaped '%'), response for the API is json describing there's NPE.
> And NPE is logged for ambari-metrics-collector log file.
> 
> ```
> 2016-05-30 09:15:05,061 WARN 
> org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.appendAggregateMetricFromResultSet(PhoenixHBaseAccessor.java:810)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:772)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.HBaseTimelineMetricStore.getTimelineMetrics(HBaseTimelineMetricStore.java:178)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:372)
>   at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> ```
> 
> Reason of NPE: 
> 
> Metrics are properly fetched with wildcard. But when applying functions to 
> result set, actual metric name is not exist from map of metric name to list 
> of function.
> 
> 
> Diffs
> -
> 
>   
> ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
>  47962cb 
> 
> Diff: https://reviews.apache.org/r/48065/diff/
> 
> 
> Testing
> ---
> 
> Test failed from local but it's occurred from another modules, which is not 
> related to current modification.
> 
> ```
> Results :
> 
> Failed tests:
>   PrivilegeEventCreatorTest.putTest:107 expected:<...), Roles(
> Permission[2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...), Roles(
> Permission[1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   RepositoryVersionEventCreatorTest.postTest:70 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   RepositoryVersionEventCreatorTest.putTest:100 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   ViewPrivilegeEventCreatorTest.putTest:85 expected:<...tatus(200 OK), 
> Type([MyView), Version(MyView), Name(MyView), Permissions(
> Permission2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...tatus(200 OK), Type([null), Version(null), 
> Name(null), Permissions(
> Permission1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   
> ComponentResourceProviderTest.testGetResourcesAsAdministrator:190->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsClusterAdministrator:195->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsServiceAdministrator:200->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> AmbariLdapDataPopulatorTest.testSynchronizeExistingLdapGroups_removeDuringIteration:333
>   Expectation failure on verify:
> AmbariLdapDataPopulatorTestInstance.getLdapGroupByMemberAttr("group2"): 
> expected: 1, actual: 0
>   UpgradeCatalog222Test.testInitializeStromAndKafkaWidgets:1107
>   Unexpected method call 
> 

Re: Review Request 48065: AMBARI-16949 Metrics Collector API shows NPE if we use wildcard (%25 for '%') for metric name

2016-06-06 Thread Sriharsha Chintalapani

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48065/#review136402
---


Ship it!




Ship It!

- Sriharsha Chintalapani


On June 3, 2016, 12:43 a.m., Jungtaek Lim wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48065/
> ---
> 
> (Updated June 3, 2016, 12:43 a.m.)
> 
> 
> Review request for Ambari, Sriharsha Chintalapani and Sid Wagle.
> 
> 
> Bugs: AMBARI-16949
> https://issues.apache.org/jira/browse/AMBARI-16949
> 
> 
> Repository: ambari
> 
> 
> Description
> ---
> 
> When we request '/ws/v1/timeline/metrics' with metric name which contains %25 
> (escaped '%'), response for the API is json describing there's NPE.
> And NPE is logged for ambari-metrics-collector log file.
> 
> ```
> 2016-05-30 09:15:05,061 WARN 
> org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.appendAggregateMetricFromResultSet(PhoenixHBaseAccessor.java:810)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:772)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.HBaseTimelineMetricStore.getTimelineMetrics(HBaseTimelineMetricStore.java:178)
>   at 
> org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:372)
>   at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> ```
> 
> Reason of NPE: 
> 
> Metrics are properly fetched with wildcard. But when applying functions to 
> result set, actual metric name is not exist from map of metric name to list 
> of function.
> 
> 
> Diffs
> -
> 
>   
> ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
>  47962cb 
> 
> Diff: https://reviews.apache.org/r/48065/diff/
> 
> 
> Testing
> ---
> 
> Test failed from local but it's occurred from another modules, which is not 
> related to current modification.
> 
> ```
> Results :
> 
> Failed tests:
>   PrivilegeEventCreatorTest.putTest:107 expected:<...), Roles(
> Permission[2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...), Roles(
> Permission[1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   RepositoryVersionEventCreatorTest.postTest:70 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   RepositoryVersionEventCreatorTest.putTest:100 expected:<...ating system: 
> redhat[6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
> Operating system: redhat7
> Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
> )> but was:<...ating system: redhat[7
> Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
> Operating system: redhat6
> Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
> )>
>   ViewPrivilegeEventCreatorTest.putTest:85 expected:<...tatus(200 OK), 
> Type([MyView), Version(MyView), Name(MyView), Permissions(
> Permission2:
>   Users: testuser2
> Permission1:
>   Users: testuser
>   Groups: testgroup])> but was:<...tatus(200 OK), Type([null), Version(null), 
> Name(null), Permissions(
> Permission1:
>   Users: testuser
>   Groups: testgroup
> Permission2:
>   Users: testuser2])>
>   
> ComponentResourceProviderTest.testGetResourcesAsAdministrator:190->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsClusterAdministrator:195->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> ComponentResourceProviderTest.testGetResourcesAsServiceAdministrator:200->testGetResources:296
>  expected:<[tru]e> but was:<[fals]e>
>   
> AmbariLdapDataPopulatorTest.testSynchronizeExistingLdapGroups_removeDuringIteration:333
>   Expectation failure on verify:
> AmbariLdapDataPopulatorTestInstance.getLdapGroupByMemberAttr("group2"): 
> expected: 1, actual: 0
>   UpgradeCatalog222Test.testInitializeStromAndKafkaWidgets:1107
>   Unexpected method call 
> 

Review Request 48065: AMBARI-16949 Metrics Collector API shows NPE if we use wildcard (%25 for '%') for metric name

2016-05-31 Thread Jungtaek Lim

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/48065/
---

Review request for Ambari.


Bugs: AMBARI-16949
https://issues.apache.org/jira/browse/AMBARI-16949


Repository: ambari


Description
---

When we request '/ws/v1/timeline/metrics' with metric name which contains %25 
(escaped '%'), response for the API is json describing there's NPE.
And NPE is logged for ambari-metrics-collector log file.

```
2016-05-30 09:15:05,061 WARN 
org.apache.hadoop.yarn.webapp.GenericExceptionHandler: INTERNAL_SERVER_ERROR
java.lang.NullPointerException
at 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.appendAggregateMetricFromResultSet(PhoenixHBaseAccessor.java:810)
at 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.PhoenixHBaseAccessor.getAggregateMetricRecords(PhoenixHBaseAccessor.java:772)
at 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.HBaseTimelineMetricStore.getTimelineMetrics(HBaseTimelineMetricStore.java:178)
at 
org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.TimelineWebServices.getTimelineMetrics(TimelineWebServices.java:372)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
```

Reason of NPE: 

Metrics are properly fetched with wildcard. But when applying functions to 
result set, actual metric name is not exist from map of metric name to list of 
function.


Diffs
-

  
ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
 47962cb 

Diff: https://reviews.apache.org/r/48065/diff/


Testing
---

Test failed from local but it's occurred from another modules, which is not 
related to current modification.

```
Results :

Failed tests:
  PrivilegeEventCreatorTest.putTest:107 expected:<...), Roles(
Permission[2:
  Users: testuser2
Permission1:
  Users: testuser
  Groups: testgroup])> but was:<...), Roles(
Permission[1:
  Users: testuser
  Groups: testgroup
Permission2:
  Users: testuser2])>
  RepositoryVersionEventCreatorTest.postTest:70 expected:<...ating system: 
redhat[6
Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
Operating system: redhat7
Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
)> but was:<...ating system: redhat[7
Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
Operating system: redhat6
Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
)>
  RepositoryVersionEventCreatorTest.putTest:100 expected:<...ating system: 
redhat[6
Repository ID(2), Repository name(MyRepo6), Base url(http://example6.com)
Operating system: redhat7
Repository ID(1), Repository name(MyRepo), Base url(http://example].com)
)> but was:<...ating system: redhat[7
Repository ID(1), Repository name(MyRepo), Base url(http://example.com)
Operating system: redhat6
Repository ID(2), Repository name(MyRepo6), Base url(http://example6].com)
)>
  ViewPrivilegeEventCreatorTest.putTest:85 expected:<...tatus(200 OK), 
Type([MyView), Version(MyView), Name(MyView), Permissions(
Permission2:
  Users: testuser2
Permission1:
  Users: testuser
  Groups: testgroup])> but was:<...tatus(200 OK), Type([null), Version(null), 
Name(null), Permissions(
Permission1:
  Users: testuser
  Groups: testgroup
Permission2:
  Users: testuser2])>
  
ComponentResourceProviderTest.testGetResourcesAsAdministrator:190->testGetResources:296
 expected:<[tru]e> but was:<[fals]e>
  
ComponentResourceProviderTest.testGetResourcesAsClusterAdministrator:195->testGetResources:296
 expected:<[tru]e> but was:<[fals]e>
  
ComponentResourceProviderTest.testGetResourcesAsServiceAdministrator:200->testGetResources:296
 expected:<[tru]e> but was:<[fals]e>
  
AmbariLdapDataPopulatorTest.testSynchronizeExistingLdapGroups_removeDuringIteration:333
  Expectation failure on verify:
AmbariLdapDataPopulatorTestInstance.getLdapGroupByMemberAttr("group2"): 
expected: 1, actual: 0
  UpgradeCatalog222Test.testInitializeStromAndKafkaWidgets:1107
  Unexpected method call 
AmbariManagementController.initializeWidgetsAndLayouts(EasyMock for interface 
org.apache.ambari.server.state.Cluster, EasyMock for interface 
org.apache.ambari.server.state.Service):
AmbariManagementController.getClusters(): expected: at least 0, actual: 1
AmbariManagementController.initializeWidgetsAndLayouts(EasyMock for 
interface org.apache.ambari.server.state.Cluster, EasyMock for interface 
org.apache.ambari.server.state.Service): expected: 1, actual: 0
Tests in error:
  KerberosCheckerTest.testCheckFailed »  Unexpected exception, 
expected