geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [3/3] geode git commit: GEODE-2278: Fix an NPE with inconsistent lucene indexes
Date Tue, 10 Jan 2017 17:20:37 GMT
GEODE-2278: Fix an NPE with inconsistent lucene indexes

If a member without a lucene index is created first, we should throw a
reasonable error rather than an NPE.


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

Branch: refs/heads/develop
Commit: 262e6ee1c13df60c38ec373247a4b212f40440f7
Parents: 041a82f
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Thu Jan 5 17:44:35 2017 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Mon Jan 9 17:28:24 2017 -0800

----------------------------------------------------------------------
 .../org/apache/geode/internal/cache/LocalRegion.java    |  5 +++--
 .../cache/lucene/LuceneIndexCreationDUnitTest.java      | 12 ++++++++++++
 .../geode/cache/lucene/test/LuceneTestUtilities.java    |  2 ++
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/262e6ee1/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 1343395..00401e9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -621,8 +621,9 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
     this.isUsedForParallelGatewaySenderQueue =
         internalRegionArgs.isUsedForParallelGatewaySenderQueue();
     this.serialGatewaySender = internalRegionArgs.getSerialGatewaySender();
-    this.cacheServiceProfiles = internalRegionArgs.getCacheServiceProfiles() == null ? null
-        : Collections.unmodifiableMap(internalRegionArgs.getCacheServiceProfiles());
+    this.cacheServiceProfiles =
+        internalRegionArgs.getCacheServiceProfiles() == null ? Collections.emptyMap()
+            : Collections.unmodifiableMap(internalRegionArgs.getCacheServiceProfiles());
 
     if (!isUsedForMetaRegion && !isUsedForPartitionedRegionAdmin
         && !isUsedForPartitionedRegionBucket && !isUsedForSerialGatewaySenderQueue

http://git-wip-us.apache.org/repos/asf/geode/blob/262e6ee1/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
index 7e50636..e58f713 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
@@ -194,6 +194,7 @@ public class LuceneIndexCreationDUnitTest extends LuceneDUnitTest {
         .invoke(() -> initDataStore(createIndex2, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_INDEXES_1));
   }
 
+
   @Test
   public void verifyDifferentIndexesFails2() {
     SerializableRunnableIF createIndex1 = getFieldsIndexWithOneField();
@@ -209,6 +210,17 @@ public class LuceneIndexCreationDUnitTest extends LuceneDUnitTest {
   }
 
   @Test
+  public void verifyMemberWithoutIndexCreatedFirstFails() {
+    SerializableRunnableIF createIndex1 = () -> {
+      /* Do nothing */};
+    dataStore1.invoke(() -> initDataStore(createIndex1));
+
+    SerializableRunnableIF createIndex2 = getFieldsIndexWithOneField();
+    dataStore2
+        .invoke(() -> initDataStore(createIndex2, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_INDEXES_3));
+  }
+
+  @Test
   @Parameters(method = "getIndexes")
   public void verifySameIndexesSucceeds(SerializableRunnableIF createIndex) {
     dataStore1.invoke(() -> initDataStore(createIndex));

http://git-wip-us.apache.org/repos/asf/geode/blob/262e6ee1/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
index cb28e88..d8816a3 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
@@ -61,6 +61,8 @@ public class LuceneTestUtilities {
       "Cannot create Region /region with [] async event ids because another cache has the
same region defined with [index#_region] async event ids";
   public static final String CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_INDEXES_2 =
       "Cannot create Region /region with [index#_region, index2#_region] async event ids
because another cache has the same region defined with [index#_region] async event ids";
+  public static final String CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_INDEXES_3 =
+      "Cannot create Region /region with [index#_region] async event ids because another
cache has the same region defined with [] async event ids";
 
   public static void verifyInternalRegions(LuceneService luceneService, Cache cache,
       Consumer<LocalRegion> verify) {


Mime
View raw message