geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-2676) RegionMBean statistics wrong on partitioned regions
Date Wed, 15 Nov 2017 23:17:00 GMT

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

ASF GitHub Bot commented on GEODE-2676:
---------------------------------------

PurelyApplied commented on a change in pull request #1063: GEODE-2676: fix NPE with ShowMetricsCommand.
URL: https://github.com/apache/geode/pull/1063#discussion_r151280756
 
 

 ##########
 File path: geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandIntegrationTest.java
 ##########
 @@ -164,8 +158,16 @@ public void categoryOptionAbridgesOutput() throws Exception {
     List<String> expectedCategories = Arrays.asList("cluster", "cache", "");
     logger.info("Expecting categories: " + String.join(", ", expectedCategories));
 
-    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
     gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
         expectedCategories.toArray(new String[0]));
   }
+
+  @Test
+  public void getRegionMetricsForPartitionedRegionWithStatistics() throws Exception {
+    String cmd = "create region --name=region2 --type=PARTITION --enable-statistics";
 
 Review comment:
   If `RegionMBeanBridge` is going to fail the `region.getStatistics()` invocation, should
we really want this command to succeed, knowing a partitioned region cannot have `--enable-statistics`?
 Probably beyond the scope of this ticket, but I feel like this `create region` command is
invalid and should throw a `UserErrorException`.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> RegionMBean statistics wrong on partitioned regions
> ---------------------------------------------------
>
>                 Key: GEODE-2676
>                 URL: https://issues.apache.org/jira/browse/GEODE-2676
>             Project: Geode
>          Issue Type: Bug
>          Components: management
>            Reporter: Fred Krone
>            Priority: Minor
>              Labels: jmx
>
> RegionMBean attributes hitCount, hitRatio, missCount, lastAccessedTime, and lastModifiedTime
will always be 0 for an mbean that represents an partitioned region.
> The gettors for these methods may call getStatistics() which on a PR always throws UnsupportedOperationException.
So this exception might even get exposed to customers.
> The initialization of RegionMBeanBridge calls getStatisticsEnabled() which returns true
on a PartitionedRegion. This does have meaning on a PR but it does not mean that getStatistics()
is a supported operation. On a PR setting statistics-enabled causes each region-entry to also
keep track of its last access time.
> It is true that if getStatisticsEnabled() is false then you should not call getStatistics.
But the opposite is not true. Since we currently have regions that do not support getStatistics(),
the code in RegionMBeanBridge should catch UnsupportedOperationException and handle it. I
would suggest that the constructor be changed that initializes the "isStatisticsEnabled" field.
Instead of only calling getStatisticsEnabled() it should also call getStatistics(). Something
like this:
> {noformat}
>     {
>       boolean useGetStatistics = regAttrs.getStatisticsEnabled();
>       if (useGetStatistics) {
>         try {
>           region.getStatistics();
>         } catch (UnsupportedOperationException ex) {
>           useGetStatistics = false;
>         }
>       }
>       this.isStatisticsEnabled = useGetStatistics;
>     }
> {noformat}
> That way in a future release if PRs are changed to support getStatistics this code will
start calling it without having a direct dependency on the implementation of PartitionedRegion.
> https://issues.apache.org/jira/browse/GEODE-2685 is a request to support getStatistics
on PRs.



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

Mime
View raw message