geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject incubator-geode git commit: on retry remove the region entry from the map
Date Fri, 23 Sep 2016 17:54:54 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1885 [created] 7f1f4b258


on retry remove the region entry from the map


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

Branch: refs/heads/feature/GEODE-1885
Commit: 7f1f4b25862c94d06ec107929d140b2ce3f95fb7
Parents: 85e97c3
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Fri Sep 23 10:53:35 2016 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Fri Sep 23 10:53:35 2016 -0700

----------------------------------------------------------------------
 .../geode/internal/cache/AbstractRegionMap.java | 44 +++++++++-----------
 1 file changed, 20 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f1f4b25/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index 33e98b6..65aebd1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -640,12 +640,11 @@ public abstract class AbstractRegionMap implements RegionMap {
       while (oldRe != null) {
         synchronized (oldRe) {
           if (oldRe.isRemoved() && !oldRe.isTombstone()) {
-            oldRe = putEntryIfAbsent(key, newRe);
-            if (oldRe != null) {
-              if (_isOwnerALocalRegion()) {
-                _getOwner().getCachePerfStats().incRetries();
-              }
+            if (_isOwnerALocalRegion()) {
+              _getOwner().getCachePerfStats().incRetries();
             }
+            _getMap().remove(key, oldRe);
+            oldRe = putEntryIfAbsent(key, newRe);
           } 
           /*
            * Entry already exists which should be impossible.
@@ -844,10 +843,9 @@ public abstract class AbstractRegionMap implements RegionMap {
           while (!done && oldRe != null) {
             synchronized (oldRe) {
               if (oldRe.isRemovedPhase2()) {
+                owner.getCachePerfStats().incRetries();
+                _getMap().remove(key, oldRe);
                 oldRe = putEntryIfAbsent(key, newRe);
-                if (oldRe != null) {
-                  owner.getCachePerfStats().incRetries();
-                }
               }
               else {
                 boolean acceptedVersionTag = false;
@@ -1104,10 +1102,9 @@ public abstract class AbstractRegionMap implements RegionMap {
                   while (!opCompleted && oldRe != null) {
                     synchronized (oldRe) {
                       if (oldRe.isRemovedPhase2()) {
+                        owner.getCachePerfStats().incRetries();
+                        _getMap().remove(event.getKey(), oldRe);
                         oldRe = putEntryIfAbsent(event.getKey(), newRe);
-                        if (oldRe != null) {
-                          owner.getCachePerfStats().incRetries();
-                        }
                       } else {
                         event.setRegionEntry(oldRe);
 
@@ -1356,6 +1353,8 @@ public abstract class AbstractRegionMap implements RegionMap {
                     && (event.isOriginRemote() || event.getContext() != null || removeRecoveredEntry));
                 if (!re.isRemoved() || createTombstoneForConflictChecks) {
                   if (re.isRemovedPhase2()) {
+                    _getMap().remove(event.getKey(), re);
+                    owner.getCachePerfStats().incRetries();
                     retry = true;
                     continue;
                   }
@@ -1650,10 +1649,9 @@ public abstract class AbstractRegionMap implements RegionMap {
             while (!opCompleted && oldRe != null) {
               synchronized (oldRe) {
                 if (oldRe.isRemovedPhase2()) {
+                  owner.getCachePerfStats().incRetries();
+                  _getMap().remove(key, oldRe);
                   oldRe = putEntryIfAbsent(key, newRe);
-                  if (oldRe != null) {
-                    owner.getCachePerfStats().incRetries();
-                  }
                 }
                 else {
                   try {
@@ -1874,10 +1872,9 @@ public abstract class AbstractRegionMap implements RegionMap {
                     // that is destroying the RE will see the invalidation and not
                     // proceed to phase 2 of removal.
                     if (oldRe.isRemovedPhase2()) {
+                      owner.getCachePerfStats().incRetries();
+                      _getMap().remove(event.getKey(), oldRe);
                       oldRe = putEntryIfAbsent(event.getKey(), newRe);
-                      if (oldRe != null) {
-                        owner.getCachePerfStats().incRetries();
-                      }
                     } else {
                       opCompleted = true;
                       event.setRegionEntry(oldRe);
@@ -2335,10 +2332,9 @@ public abstract class AbstractRegionMap implements RegionMap {
               while (!opCompleted && oldRe != null) {
                 synchronized (oldRe) {
                   if (oldRe.isRemovedPhase2()) {
+                    owner.getCachePerfStats().incRetries();
+                    _getMap().remove(key, oldRe);
                     oldRe = putEntryIfAbsent(key, newRe);
-                    if (oldRe != null) {
-                      owner.getCachePerfStats().incRetries();
-                    }
                   }
                   else {
                     opCompleted = true;
@@ -2711,8 +2707,9 @@ public abstract class AbstractRegionMap implements RegionMap {
             // from the map. otherwise we can append an event to it
             // and change its state
             if (re.isRemovedPhase2()) {
-              re = getOrCreateRegionEntry(owner, event, Token.REMOVED_PHASE1, null, onlyExisting,
false);
               _getOwner().getCachePerfStats().incRetries();
+              _getMap().remove(event.getKey(), re);
+              re = getOrCreateRegionEntry(owner, event, Token.REMOVED_PHASE1, null, onlyExisting,
false);
               if (re == null) {
                 // this will happen when onlyExisting is true
                 return null;
@@ -3192,10 +3189,9 @@ public abstract class AbstractRegionMap implements RegionMap {
             while (!opCompleted && oldRe != null) {
               synchronized (oldRe) {
                 if (oldRe.isRemovedPhase2()) {
+                  owner.getCachePerfStats().incRetries();
+                  _getMap().remove(key, oldRe);
                   oldRe = putEntryIfAbsent(key, newRe);
-                  if (oldRe != null) {
-                    owner.getCachePerfStats().incRetries();
-                  }
                 }
                 else {
                   opCompleted = true;


Mime
View raw message