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: GEODE-1167: check off-heap flag to see if recovered region is compatible
Date Tue, 05 Apr 2016 21:47:42 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 226713433 -> a11f6089b


GEODE-1167: check off-heap flag to see if recovered region is compatible


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

Branch: refs/heads/develop
Commit: a11f6089b015070c5420670bebfe7f634a134db6
Parents: 2267134
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Mon Apr 4 16:48:10 2016 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Tue Apr 5 14:45:32 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/DiskRegion.java      |  1 +
 .../internal/offheap/OffHeapRegionBase.java     | 31 ++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a11f6089/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskRegion.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskRegion.java
index 843a716..c1d2f03 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskRegion.java
@@ -165,6 +165,7 @@ public class DiskRegion extends AbstractDiskRegion {
             || ra.getInitialCapacity() != getInitialCapacity()
             || ra.getLoadFactor() != getLoadFactor()
             || ra.getStatisticsEnabled() != getStatisticsEnabled()
+            || offHeap != getOffHeap()
             || !hasSameCompressor(ra)) { 
           if (getRecoveredEntryMap() != null) {
             getRecoveredEntryMap().lruCloseStats();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a11f6089/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
index 25e69de..a820619 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapRegionBase.java
@@ -38,6 +38,9 @@ import com.gemstone.gemfire.compression.Compressor;
 import com.gemstone.gemfire.compression.SnappyCompressor;
 import com.gemstone.gemfire.internal.cache.EntryEventImpl;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.OffHeapRegionEntry;
+import com.gemstone.gemfire.internal.cache.RegionEntry;
 import com.gemstone.gemfire.internal.offheap.annotations.OffHeapIdentifier;
 import com.gemstone.gemfire.internal.offheap.annotations.Released;
 import com.gemstone.gemfire.internal.offheap.annotations.Retained;
@@ -589,4 +592,32 @@ public abstract class OffHeapRegionBase {
     doRegionTest(RegionShortcut.PARTITION_PERSISTENT, "prPersist2", true);
   }
 
+  @Test
+  public void testPersistentChangeFromHeapToOffHeap() {
+    GemFireCacheImpl gfc = createCache(true);
+    Region r = null;
+    final String value = "value big enough to force off-heap storage";
+    try {
+      r = gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setOffHeap(false).create("changedFromHeapToOffHeap");
+      r.put("key", value);
+    } finally {
+      closeCache(gfc, false);
+    }
+    gfc = createCache(true);
+    try {
+      r = gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT).setOffHeap(true).create("changedFromHeapToOffHeap");
+      assertEquals(true, r.containsKey("key"));
+      LocalRegion lr = (LocalRegion) r;
+      RegionEntry re = lr.getRegionEntry("key");
+      if (!(re instanceof OffHeapRegionEntry)) {
+        fail("expected re to be instanceof OffHeapRegionEntry but it was a " + re.getClass());
+      }
+      assertEquals(value, r.get("key"));
+    } finally {
+      if (r != null && !r.isDestroyed()) {
+        r.destroyRegion();
+      }
+      closeCache(gfc, false);
+    }
+  }
 }


Mime
View raw message