geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [3/4] incubator-geode git commit: fixed a problem in bucketStats in updateRecoveredEntry
Date Mon, 08 Aug 2016 22:34:00 GMT
fixed a problem in bucketStats in updateRecoveredEntry


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/4427f020
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/4427f020
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/4427f020

Branch: refs/heads/feature/GEODE-1714
Commit: 4427f020b3a282f3d49313f1df2946f5dbd23bec
Parents: b26d65f
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Mon Aug 8 15:32:12 2016 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Mon Aug 8 15:32:12 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/AbstractRegionMap.java      | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4427f020/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
index 47d74f7..299c09c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegionMap.java
@@ -698,16 +698,25 @@ public abstract class AbstractRegionMap implements RegionMap {
       }
       try {
         if (_isOwnerALocalRegion()) {
-          if (re.isTombstone()) {
+          boolean oldValueWasTombstone = re.isTombstone();
+          if (oldValueWasTombstone) {
             // when a tombstone is to be overwritten, unschedule it first
             _getOwner().unscheduleTombstone(re);
+            // unscheduleTombstone incs entryCount which is ok
+            // because we either set the value after this so that
+            // the entry exists or we call scheduleTombstone which
+            // will dec entryCount.
           }
           final int oldSize = _getOwner().calculateRegionEntryValueSize(re);
           re.setValue(_getOwner(), value); // OFFHEAP no need to call AbstractRegionMap.prepareValueForCache
because setValue is overridden for disk and that code takes apart value (RecoveredEntry) and
prepares its nested value for the cache
           if (re.isTombstone()) {
             _getOwner().scheduleTombstone(re, re.getVersionStamp().asVersionTag());
+            _getOwner().updateSizeOnRemove(key, oldSize);
+          } else if (oldValueWasTombstone) {
+            _getOwner().updateSizeOnCreate(key, _getOwner().calculateRegionEntryValueSize(re));
+          } else {
+            _getOwner().updateSizeOnPut(key, oldSize, _getOwner().calculateRegionEntryValueSize(re));
           }
-          _getOwner().updateSizeOnPut(key, oldSize, _getOwner().calculateRegionEntryValueSize(re));
         } else {
           DiskEntry.Helper.updateRecoveredEntry((PlaceHolderDiskRegion)_getOwnerObject(),
               (DiskEntry)re, value, (RegionEntryContext) _getOwnerObject());


Mime
View raw message