Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-2676

RegionMBean statistics wrong on partitioned regions



    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0
    • Component/s: management
    • Labels:


      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:

            boolean useGetStatistics = regAttrs.getStatisticsEnabled();
            if (useGetStatistics) {
              try {
              } catch (UnsupportedOperationException ex) {
                useGetStatistics = false;
            this.isStatisticsEnabled = useGetStatistics;

      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.


          Issue Links



              • Assignee:
                fkrone Fred Krone
              • Votes:
                2 Vote for this issue
                5 Start watching this issue


                • Created: