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

Darrel Schneider commented on GEODE-1211:
-----------------------------------------

I think the bug is in the mbean code. Namely how the MemberMBean class 
aggregates its regions. As Barry's original comment on this bug shows when the 
member has two regions on the same disk store the disk store related stats get 
counted twice at the member level. If it had three regions on the same disk 
store it would be counted 3 times. He also showed that if the regions are on 
different disk stores then they are correctly aggregated at the member level. I 
think the aggregator, AggregateRegionStatsMonitor, needs to be changed in how 
disk stats are aggregated.
The actual bug might be in MemberMBeanBridge.java. It has both a 
"regionMonitor" field and a "diskMonitor" field. The regionMonitor will 
aggregate every region added to it and the current impl gets disk space from 
it. If you search  AggregateRegionStatsMonitor for DISK_SPACE you will see how 
it computes disk space for the DiskDirStats that have been added to it.
I think this method: 
org.apache.geode.management.internal.beans.MemberMBeanBridge.addRegion(Region)
needs to no longer add DiskDirStats when a region is added. Here is the code 
that needs to be removed from addRegion:
{noformat}
    DiskRegion dr = l.getDiskRegion();
    if (dr != null) {
      for (DirectoryHolder dh : dr.getDirectories()) {
        addDirectoryStats(dh.getDiskDirectoryStats());
      }
    }
{noformat}
Instead these DirectoryHolder instances need to be obtained from a DiskStore 
when it is added to the member in this method: 
org.apache.geode.management.internal.beans.MemberMBeanBridge.addDiskStore(DiskStore)
 by calling: 
org.apache.geode.internal.cache.DiskStoreImpl.getDirectoryHolders().

You will probably also want to reverse this when this method is called: 
org.apache.geode.management.internal.beans.MemberMBeanBridge.removeDiskStore(DiskStore)

The basic idea is to compute this disk space used from DiskStore instances on a 
member not on Regions on a member. Even if a member has no persistence regions 
it can still have disk stores using disk space (think of our PDX internal impl 
that uses a disk store).

So it seems like this bug is completely in the internal.beans package.

> Multiple Regions using the same DiskStore cause double-counting in the member 
> TotalDiskUsage JMX attribute
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-1211
>                 URL: https://issues.apache.org/jira/browse/GEODE-1211
>             Project: Geode
>          Issue Type: Bug
>          Components: persistence, statistics
>            Reporter: Barry Oglesby
>
> Here is what I'm seeing in my simple tests.
> After putting with 10000 entries into two persistent replicated regions each 
> using its own disk store:
> {{MemberMBean.getTotalDiskUsage}} totals each disk store bytes on disk 
> properly:
> {noformat}
> MemberMBean.getTotalDiskUsage returning 1298573 bytes
> DiskStoreMBeanBridge.getTotalBytesOnDisk data-rr_store returning 649253 bytes
> DiskStoreMBeanBridge.getTotalBytesOnDisk data2-rr_store returning 649320 bytes
> {noformat}
> After putting with 10000 entries into two persistent replicated regions each 
> using the same disk store:
> {{MemberMBean.getTotalDiskUsage}} double-counts the disk store bytes on disk:
> {noformat}
> MemberMBean.getTotalDiskUsage returning 2596956 bytes
> DiskStoreMBeanBridge.getTotalBytesOnDisk data-rr_store returning 1298478 bytes
> {noformat}



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

Reply via email to