geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [06/12] incubator-geode git commit: GEODE-1212: clean up replicate region support for lucene
Date Wed, 13 Apr 2016 21:10:01 GMT
GEODE-1212: clean up replicate region support for lucene


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

Branch: refs/heads/feature/GEODE-17-2
Commit: 86ab7cda3378e062769b32c2b36504567fc8c752
Parents: 3ac9104
Author: zhouxh <gzhou@pivotal.io>
Authored: Tue Apr 12 09:56:39 2016 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Tue Apr 12 09:57:31 2016 -0700

----------------------------------------------------------------------
 .../LuceneIndexForPartitionedRegion.java         | 19 +++++--------------
 .../cache/lucene/internal/LuceneServiceImpl.java |  2 +-
 .../internal/LuceneQueryImplJUnitTest.java       |  2 +-
 .../internal/LuceneServiceImplJUnitTest.java     | 10 ++++++----
 4 files changed, 13 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/86ab7cda/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index 7002567..25b63a4 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -52,23 +52,14 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
       assert dataRegion != null;
       RegionAttributes ra = dataRegion.getAttributes();
       DataPolicy dp = ra.getDataPolicy();
-      final boolean isPartitionedRegion = (ra.getPartitionAttributes() == null) ? false :
true;
       final boolean withPersistence = dp.withPersistence();
-      final boolean withStorage = isPartitionedRegion?ra.getPartitionAttributes().getLocalMaxMemory()>0:dp.withStorage();
+      final boolean withStorage = ra.getPartitionAttributes().getLocalMaxMemory()>0;
       RegionShortcut regionShortCut;
-      if (isPartitionedRegion) {
-        if (withPersistence) {
-          // TODO: add PartitionedRegionAttributes instead
-          regionShortCut = RegionShortcut.PARTITION_PERSISTENT;
-        } else {
-          regionShortCut = RegionShortcut.PARTITION;
-        }
+      if (withPersistence) {
+        // TODO: add PartitionedRegionAttributes instead
+        regionShortCut = RegionShortcut.PARTITION_PERSISTENT;
       } else {
-        if (withPersistence) {
-          regionShortCut = RegionShortcut.REPLICATE_PERSISTENT;
-        } else {
-          regionShortCut = RegionShortcut.REPLICATE;
-        }
+        regionShortCut = RegionShortcut.PARTITION;
       }
 
       // final boolean isOffHeap = ra.getOffHeap();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/86ab7cda/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
index 1a5dd1a..9d6aed4 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
@@ -182,7 +182,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
       index = new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
     } else {
       // replicated region
-      index = new LuceneIndexForReplicatedRegion(indexName, regionPath, cache);
+      throw new UnsupportedOperationException("Lucene indexes on replicated regions are not
supported");
     }
     return index;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/86ab7cda/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImplJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImplJUnitTest.java
index 3975ac3..2439645 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImplJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImplJUnitTest.java
@@ -54,7 +54,7 @@ public class LuceneQueryImplJUnitTest {
   @Before
   public void createCache() {
     cache = new CacheFactory().set("mcast-port", "0").create();
-    region = cache.createRegionFactory(RegionShortcut.REPLICATE).create("region");
+    region = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).create("region");
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/86ab7cda/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImplJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImplJUnitTest.java
index 159fd46..3a6f38c 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImplJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImplJUnitTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -216,11 +217,12 @@ public class LuceneServiceImplJUnitTest {
     assertTrue(chunkPR != null);
   }
   
-  @Test
+  @Test (expected=UnsupportedOperationException.class)
   public void testCreateIndexForRR() throws IOException, ParseException {
-//    service.createIndex("index1", "RR1", "field1", "field2", "field3");
-  
-    
+    getService();
+    service.createIndex("index1", "RR1", "field1", "field2", "field3");
+    createRR("RR1", false);
+    fail("Expect UnsupportedOperationException");
   }
 
 }


Mime
View raw message