You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/08/03 18:39:00 UTC
[3/3] incubator-geode git commit: better fix for replace
better fix for replace
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/49bf91e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/49bf91e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/49bf91e3
Branch: refs/heads/feature/GEODE-1718
Commit: 49bf91e39e43771ce843baea625fe73578ae7040
Parents: 3703c05
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed Aug 3 11:33:10 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Wed Aug 3 11:33:10 2016 -0700
----------------------------------------------------------------------
.../internal/cache/AbstractRegionMap.java | 23 +++++++++-----------
1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49bf91e3/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 87b59cd..dd97a82 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
@@ -2809,17 +2809,14 @@ public abstract class AbstractRegionMap implements RegionMap {
// replace is propagated to server, so no need to check
// satisfiesOldValue on client
if (expectedOldValue != null && !replaceOnClient) {
- ReferenceCountHelper.skipRefCountTracking();
-
- @Retained @Released Object v = re.getValueOffHeapOrDiskWithoutFaultIn(event.getLocalRegion());
-
- ReferenceCountHelper.unskipRefCountTracking();
- try {
- if (!AbstractRegionEntry.checkExpectedOldValue(expectedOldValue, v, event.getLocalRegion())) {
- return false;
- }
- } finally {
- OffHeapHelper.releaseWithNoTracking(v);
+ assert event.getOperation().guaranteesOldValue();
+ // We already called setOldValueInEvent so the event will have the old value.
+ @Unretained Object v = event.getRawOldValue();
+ // Note that v will be null instead of INVALID because setOldValue
+ // converts INVALID to null.
+ // But checkExpectedOldValue handle this and says INVALID equals null.
+ if (!AbstractRegionEntry.checkExpectedOldValue(expectedOldValue, v, event.getLocalRegion())) {
+ return false;
}
}
return true;
@@ -2835,7 +2832,7 @@ public abstract class AbstractRegionMap implements RegionMap {
@Released Object oldValueInVMOrDisk = re.getValueOffHeapOrDiskWithoutFaultIn(event.getLocalRegion());
ReferenceCountHelper.unskipRefCountTracking();
try {
- event.setOldValue(oldValueInVMOrDisk, requireOldValue);
+ event.setOldValue(oldValueInVMOrDisk, needToSetOldValue);
} finally {
OffHeapHelper.releaseWithNoTracking(oldValueInVMOrDisk);
}
@@ -2847,7 +2844,7 @@ public abstract class AbstractRegionMap implements RegionMap {
ReferenceCountHelper.unskipRefCountTracking();
try {
- event.setOldValue(oldValueInVM, requireOldValue);
+ event.setOldValue(oldValueInVM, needToSetOldValue);
} finally {
OffHeapHelper.releaseWithNoTracking(oldValueInVM);
}