You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by la...@apache.org on 2017/03/03 23:03:26 UTC
[1/2] geode git commit: GEODE-2589,
GEODE-2590 lucene index region attributes should be based on data
region
Repository: geode
Updated Branches:
refs/heads/develop 21a9b5e2c -> 4e61799f9
GEODE-2589, GEODE-2590 lucene index region attributes should be based on data region
- lucene index region now inherits recoveryDelay and startupRecoveryDelay from data region
- lucene index region now only sets diskStoreName (in RegionAttributes) when data region has persistence.
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/24d02a58
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/24d02a58
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/24d02a58
Branch: refs/heads/develop
Commit: 24d02a5862851ceffa715233f245c46651776cf4
Parents: 21a9b5e
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
Authored: Fri Mar 3 13:11:53 2017 -0800
Committer: Lynn Hughes-Godfrey <lh...@pivotal.io>
Committed: Fri Mar 3 13:11:53 2017 -0800
----------------------------------------------------------------------
.../LuceneIndexForPartitionedRegion.java | 6 ++-
...IndexCreationPersistenceIntegrationTest.java | 44 +++++++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/24d02a58/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index f45d94d..4aa24b5 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -158,6 +158,8 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
attributesFactory.setTotalNumBuckets(dataRegionAttributes.getTotalNumBuckets());
attributesFactory.setRedundantCopies(dataRegionAttributes.getRedundantCopies());
attributesFactory.setPartitionResolver(getPartitionResolver(dataRegionAttributes));
+ attributesFactory.setRecoveryDelay(dataRegionAttributes.getRecoveryDelay());
+ attributesFactory.setStartupRecoveryDelay(dataRegionAttributes.getStartupRecoveryDelay());
return attributesFactory;
}
@@ -185,7 +187,9 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
RegionAttributes baseAttributes = this.cache.getRegionAttributes(regionShortCut.toString());
AttributesFactory factory = new AttributesFactory(baseAttributes);
factory.setPartitionAttributes(partitionAttributesFactory.create());
- factory.setDiskStoreName(regionAttributes.getDiskStoreName());
+ if (regionAttributes.getDataPolicy().withPersistence()) {
+ factory.setDiskStoreName(regionAttributes.getDiskStoreName());
+ }
RegionAttributes<K, V> attributes = factory.create();
return createRegion(regionName, attributes);
http://git-wip-us.apache.org/repos/asf/geode/blob/24d02a58/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
index 81e76f5..4b27ee6 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
@@ -31,7 +31,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
-
+import org.apache.geode.cache.PartitionAttributesFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
@@ -69,6 +69,48 @@ public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegra
}
@Test
+ public void shouldInheritRecoveryDelayFromUserRegion() {
+ createIndex(cache, "text");
+
+ PartitionAttributesFactory paf = new PartitionAttributesFactory();
+ paf.setRecoveryDelay(0);
+
+ cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create())
+ .create(REGION_NAME);
+ verifyInternalRegions(region -> {
+ assertEquals(0, region.getAttributes().getPartitionAttributes().getRecoveryDelay());
+ });
+ }
+
+ @Test
+ public void shouldInheritStartupRecoveryDelayFromUserRegion() {
+ createIndex(cache, "text");
+
+ PartitionAttributesFactory paf = new PartitionAttributesFactory();
+ paf.setStartupRecoveryDelay(1);
+
+ cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create())
+ .create(REGION_NAME);
+ verifyInternalRegions(region -> {
+ assertEquals(1, region.getAttributes().getPartitionAttributes().getStartupRecoveryDelay());
+ });
+ }
+
+ @Test
+ public void shouldNotUseDiskStoreWhenUserRegionIsNotPersistent() {
+ createIndex(cache, "text");
+ String diskStoreName = "diskStore";
+ cache.createDiskStoreFactory().setDiskDirs(new File[] {diskDirRule.get()})
+ .create(diskStoreName);
+ cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).setDiskStoreName(diskStoreName)
+ .create(REGION_NAME);
+ verifyInternalRegions(region -> {
+ assertTrue(region.getAttributes().getDiskStoreName() == null);
+ assertTrue(region.getAttributes().getEvictionAttributes().getAction().isNone());
+ });
+ }
+
+ @Test
@Parameters({"true", "false"})
public void shouldUseDiskSynchronousWhenUserRegionHasDiskSynchronous(boolean synchronous) {
createIndex(cache, "text");
[2/2] geode git commit: GEODE-2590 Fix unit tests related to creating
lucene index and chunk regions
Posted by la...@apache.org.
GEODE-2590 Fix unit tests related to creating lucene index and chunk regions
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/4e61799f
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/4e61799f
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/4e61799f
Branch: refs/heads/develop
Commit: 4e61799f918d47340ddb0ecbcf89aaf715723d95
Parents: 24d02a5
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
Authored: Fri Mar 3 14:03:46 2017 -0800
Committer: Lynn Hughes-Godfrey <lh...@pivotal.io>
Committed: Fri Mar 3 14:03:46 2017 -0800
----------------------------------------------------------------------
.../cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/4e61799f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
index 15235eb..93cc0a8 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
@@ -290,6 +290,7 @@ public class LuceneIndexForPartitionedRegionTest {
String regionPath = "regionName";
GemFireCacheImpl cache = Fakes.cache();
RegionAttributes regionAttributes = mock(RegionAttributes.class);
+ when(regionAttributes.getDataPolicy()).thenReturn(DataPolicy.PARTITION);
PartitionAttributes partitionAttributes = initializeAttributes(cache);
LuceneIndexForPartitionedRegion index =
new LuceneIndexForPartitionedRegion(name, regionPath, cache);
@@ -310,6 +311,7 @@ public class LuceneIndexForPartitionedRegionTest {
GemFireCacheImpl cache = Fakes.cache();
PartitionAttributes partitionAttributes = initializeAttributes(cache);
RegionAttributes regionAttributes = mock(RegionAttributes.class);
+ when(regionAttributes.getDataPolicy()).thenReturn(DataPolicy.PARTITION);
LuceneIndexForPartitionedRegion index =
new LuceneIndexForPartitionedRegion(name, regionPath, cache);
LuceneIndexForPartitionedRegion indexSpy = spy(index);