geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bogle...@apache.org
Subject geode git commit: GEODE-2404: Modified to support destroying an index while puts are occurring
Date Fri, 31 Mar 2017 16:23:59 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 50f6d1e39 -> 1f07ec76d


GEODE-2404: Modified to support destroying an index while puts are occurring


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

Branch: refs/heads/develop
Commit: 1f07ec76da27952c12547742bca00247116105ec
Parents: 50f6d1e
Author: Barry Oglesby <boglesby@pivotal.io>
Authored: Sun Mar 26 19:38:22 2017 -0700
Committer: Barry Oglesby <boglesby@pivotal.io>
Committed: Fri Mar 31 09:06:34 2017 -0700

----------------------------------------------------------------------
 .../geode/internal/cache/AbstractRegion.java    | 20 +++++
 .../internal/cache/CacheServiceProfile.java     | 10 +++
 .../internal/cache/CreateRegionProcessor.java   | 45 +++++++---
 .../geode/internal/cache/DistributedRegion.java |  6 +-
 .../internal/cache/InternalRegionArguments.java | 16 ++++
 .../geode/internal/cache/LocalRegion.java       |  4 +
 .../geode/internal/cache/PartitionedRegion.java |  6 +-
 .../geode/internal/i18n/LocalizedStrings.java   |  7 ++
 .../internal/LuceneIndexCreationProfile.java    | 86 ++++++++++----------
 .../lucene/internal/LuceneRegionListener.java   |  3 +
 .../lucene/LuceneIndexDestroyDUnitTest.java     | 80 ++++++++++++++++--
 .../cache/lucene/test/LuceneTestUtilities.java  |  8 +-
 12 files changed, 220 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index 7dffee2..e69f801 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -140,6 +140,8 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
Attrib
 
   protected Set<String> asyncEventQueueIds;
 
+  protected Set<String> visibleAsyncEventQueueIds;
+
   protected Set<String> allGatewaySenderIds;
 
   protected boolean enableSubscriptionConflation;
@@ -540,6 +542,10 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
Attrib
     return this.asyncEventQueueIds;
   }
 
+  public Set<String> getVisibleAsyncEventQueueIds() {
+    return this.visibleAsyncEventQueueIds;
+  }
+
   public final Set<String> getAllGatewaySenderIds() {
     return Collections.unmodifiableSet(this.allGatewaySenderIds);
   }
@@ -901,11 +907,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
Attrib
 
   public void addAsyncEventQueueId(String asyncEventQueueId) {
     getAsyncEventQueueIds().add(asyncEventQueueId);
+    getVisibleAsyncEventQueueIds().add(asyncEventQueueId);
     setAllGatewaySenderIds();
   }
 
   public void removeAsyncEventQueueId(String asyncEventQueueId) {
     getAsyncEventQueueIds().remove(asyncEventQueueId);
+    getVisibleAsyncEventQueueIds().remove(asyncEventQueueId);
     setAllGatewaySenderIds();
   }
 
@@ -921,6 +929,17 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
Attrib
     allGatewaySenderIds = tmp;
   }
 
+  private void initializeVisibleAsyncEventQueueIds(InternalRegionArguments internalRegionArgs)
{
+    Set<String> asyncEventQueueIds = new CopyOnWriteArraySet<>();
+    // Add all configured aeqIds
+    asyncEventQueueIds.addAll(getAsyncEventQueueIds());
+    // Remove all internal aeqIds from internal region args if necessary
+    if (internalRegionArgs.getInternalAsyncEventQueueIds() != null) {
+      asyncEventQueueIds.removeAll(internalRegionArgs.getInternalAsyncEventQueueIds());
+    }
+    this.visibleAsyncEventQueueIds = asyncEventQueueIds;
+  }
+
   public void addCacheListener(CacheListener cl) {
     checkReadiness();
     if (cl == null) {
@@ -1599,6 +1618,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
Attrib
     this.earlyAck = attrs.getEarlyAck();
     this.gatewaySenderIds = attrs.getGatewaySenderIds();
     this.asyncEventQueueIds = attrs.getAsyncEventQueueIds();
+    initializeVisibleAsyncEventQueueIds(internalRegionArgs);
     setAllGatewaySenderIds();
     this.enableSubscriptionConflation = attrs.getEnableSubscriptionConflation();
     this.publisher = attrs.getPublisher();

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServiceProfile.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServiceProfile.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServiceProfile.java
index b3ebe30..ac6d8f6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServiceProfile.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServiceProfile.java
@@ -36,4 +36,14 @@ public interface CacheServiceProfile {
    * @return A string message of incompatibility or null if the profiles are compatible
    */
   String checkCompatibility(String regionPath, CacheServiceProfile profile);
+
+  /**
+   * Answers the missing profile message to be returned when a profile exists in one member
but not
+   * another
+   * 
+   * @param existsInThisMember Whether or not the profile exists in this member
+   * @return the missing profile message to be returned when a profile exists in one member
but not
+   *         another
+   */
+  String getMissingProfileMessage(boolean existsInThisMember);
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
index 811e852..b1dd003 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
@@ -564,7 +564,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor
{
         }
       }
 
-      Set<String> otherAsynEventQueueIds = ((LocalRegion) rgn).getAsyncEventQueueIds();
+      Set<String> otherAsynEventQueueIds = ((LocalRegion) rgn).getVisibleAsyncEventQueueIds();
       Set<String> myAsyncEventQueueIds = profile.asyncEventQueueIds;
       if (!isLocalOrRemoteAccessor(rgn, profile)
           && !otherAsynEventQueueIds.equals(myAsyncEventQueueIds)) {
@@ -610,22 +610,43 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor
{
       }
 
       String cspResult = null;
-      // TODO Compares set sizes and equivalent entries.
-      if (profile.cacheServiceProfiles != null) {
-        for (CacheServiceProfile remoteProfile : profile.cacheServiceProfiles) {
-          CacheServiceProfile localProfile =
-              ((LocalRegion) rgn).getCacheServiceProfile(remoteProfile.getId());
+      Map<String, CacheServiceProfile> myProfiles = ((LocalRegion) rgn).getCacheServiceProfiles();
+      // Iterate and compare the remote CacheServiceProfiles to the local ones
+      for (CacheServiceProfile remoteProfile : profile.cacheServiceProfiles) {
+        CacheServiceProfile localProfile = myProfiles.get(remoteProfile.getId());
+        if (localProfile == null) {
+          cspResult = remoteProfile.getMissingProfileMessage(true);
+        } else {
           cspResult = remoteProfile.checkCompatibility(rgn.getFullPath(), localProfile);
-          if (cspResult != null) {
-            break;
-          }
         }
-        // Don't overwrite result with null in case it has already been set in a previous
-        // compatibility check.
         if (cspResult != null) {
-          result = cspResult;
+          break;
+        }
+      }
+
+      // If the comparison result is null, compare the local profiles to the remote ones.
If there
+      // are more local profiles than remote ones (meaning there are ones defined locally
that are
+      // not defined remotely), then compare those. This should produce an informative error
message
+      // (as opposed to returning something like 'the profiles don't match').
+      if (cspResult == null) {
+        if (myProfiles.size() > profile.cacheServiceProfiles.size()) {
+          for (CacheServiceProfile localProfile : myProfiles.values()) {
+            if (!profile.cacheServiceProfiles.stream()
+                .anyMatch(remoteProfile -> remoteProfile.getId().equals(localProfile.getId())))
{
+              cspResult = localProfile.getMissingProfileMessage(false);
+              break;
+            }
+          }
         }
       }
+
+      // If the comparison result is not null, set the final result.
+      // Note: Be careful not to overwrite the final result with null in case it has already
been
+      // set in a previous compatibility check.
+      if (cspResult != null) {
+        result = cspResult;
+      }
+
       if (logger.isDebugEnabled()) {
         logger.debug("CreateRegionProcessor.checkCompatibility: this={}; other={}; result={}",
rgn,
             profile, result);

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index b9cdfd7..fa02574 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -2175,7 +2175,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
     profile.requiresOldValueInEvents = this.dataPolicy.withReplication()
         && this.filterProfile != null && this.filterProfile.hasCQs();
     profile.gatewaySenderIds = getGatewaySenderIds();
-    profile.asyncEventQueueIds = getAsyncEventQueueIds();
+    profile.asyncEventQueueIds = getVisibleAsyncEventQueueIds();
     profile.isOffHeap = getOffHeap();
   }
 
@@ -2724,8 +2724,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
                   new Object[] {this.getName(), senderIds.get(0), senderIds.get(1)}));
     }
 
-    List asycnQueueIds =
-        this.getCacheDistributionAdvisor().adviseSameAsyncEventQueueIds(getAsyncEventQueueIds());
+    List asycnQueueIds = this.getCacheDistributionAdvisor()
+        .adviseSameAsyncEventQueueIds(getVisibleAsyncEventQueueIds());
     if (!asycnQueueIds.isEmpty()) {
       throw new GatewaySenderConfigurationException(
           LocalizedStrings.Region_REGION_0_HAS_1_ASYNC_EVENT_QUEUE_IDS_ANOTHER_CACHE_HAS_THE_SAME_REGION_WITH_2_ASYNC_EVENT_QUEUE_IDS_FOR_REGION_ACROSS_ALL_MEMBERS_IN_DS_ASYNC_EVENT_QUEUE_IDS_SHOULD_BE_SAME

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/cache/InternalRegionArguments.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalRegionArguments.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalRegionArguments.java
index aa096a0..ba9d1d8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalRegionArguments.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalRegionArguments.java
@@ -16,8 +16,10 @@ package org.apache.geode.internal.cache;
 
 import java.io.InputStream;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.LocalRegion.TestCallable;
@@ -66,6 +68,8 @@ public final class InternalRegionArguments {
 
   private Map<String, CacheServiceProfile> cacheServiceProfiles;
 
+  private Set<String> internalAsyncEventQueueIds;
+
   /* methods that set and retrieve internal state used to configure a Region */
 
   public InternalRegionArguments setIsUsedForPartitionedRegionAdmin(boolean adminFlag) {
@@ -304,6 +308,18 @@ public final class InternalRegionArguments {
     return this.cacheServiceProfiles;
   }
 
+  public InternalRegionArguments addInternalAsyncEventQueueId(String aeqId) {
+    if (this.internalAsyncEventQueueIds == null) {
+      this.internalAsyncEventQueueIds = new HashSet<>();
+    }
+    this.internalAsyncEventQueueIds.add(aeqId);
+    return this;
+  }
+
+  public Set<String> getInternalAsyncEventQueueIds() {
+    return this.internalAsyncEventQueueIds;
+  }
+
   public boolean isInternalRegion() {
     return isInternalRegion;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/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 45540ee..957038c 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
@@ -10714,6 +10714,10 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
     return this.cacheServiceProfiles.get(id);
   }
 
+  public Map<String, CacheServiceProfile> getCacheServiceProfiles() {
+    return Collections.unmodifiableMap(this.cacheServiceProfiles);
+  }
+
   public LoaderHelper createLoaderHelper(Object key, Object callbackArgument,
       boolean netSearchAllowed, boolean netLoadAllowed, SearchLoadAndWriteProcessor searcher)
{
     return new LoaderHelperImpl(this, key, callbackArgument, netSearchAllowed, netLoadAllowed,

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 173f35c..0f5e316 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -1136,8 +1136,8 @@ public class PartitionedRegion extends LocalRegion
                   new Object[] {this.getName(), senderIds.get(0), senderIds.get(1)}));
     }
 
-    List asycnQueueIds =
-        this.getCacheDistributionAdvisor().adviseSameAsyncEventQueueIds(getAsyncEventQueueIds());
+    List asycnQueueIds = this.getCacheDistributionAdvisor()
+        .adviseSameAsyncEventQueueIds(getVisibleAsyncEventQueueIds());
     if (!asycnQueueIds.isEmpty()) {
       throw new GatewaySenderConfigurationException(
           LocalizedStrings.Region_REGION_0_HAS_1_ASYNC_EVENT_QUEUE_IDS_ANOTHER_CACHE_HAS_THE_SAME_REGION_WITH_2_ASYNC_EVENT_QUEUE_IDS_FOR_REGION_ACROSS_ALL_MEMBERS_IN_DS_ASYNC_EVENT_QUEUE_IDS_SHOULD_BE_SAME
@@ -5063,7 +5063,7 @@ public class PartitionedRegion extends LocalRegion
     profile.hasCacheServer = ((this.cache.getCacheServers().size() > 0) ? true : false);
     profile.filterProfile = getFilterProfile();
     profile.gatewaySenderIds = getGatewaySenderIds();
-    profile.asyncEventQueueIds = getAsyncEventQueueIds();
+    profile.asyncEventQueueIds = getVisibleAsyncEventQueueIds();
 
     if (dataPolicy.withPersistence()) {
       profile.persistentID = getDiskStore().generatePersistentID(null);

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
b/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
index 499bf8e..fb0919f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java
@@ -7679,6 +7679,13 @@ public class LocalizedStrings {
 
   public static final StringId LuceneService_NO_INDEXES_WERE_FOUND_IN_REGION_0 =
       new StringId(6654, "No Lucene indexes were found in region {0}");
+
+  public static final StringId LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_BECAUSE_IT_IS_NOT_DEFINED_IN_ANOTHER_MEMBER
=
+      new StringId(6655,
+          "Cannot create Lucene index {0} on region {1} because it is not defined in another
member.");
+  public static final StringId LuceneService_MUST_DEFINE_INDEX_0_ON_REGION_1_BECAUSE_IT_IS_DEFINED_IN_ANOTHER_MEMBER
=
+      new StringId(6656,
+          "Must create Lucene index {0} on region {1} because it is defined in another member.");
   /** Testing strings, messageId 90000-99999 **/
 
   /**

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
index 0e28bab..26d28cc 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfile.java
@@ -89,49 +89,44 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile,
DataSeri
   public String checkCompatibility(String regionPath, CacheServiceProfile profile) {
     String result = null;
     LuceneIndexCreationProfile remoteProfile = (LuceneIndexCreationProfile) profile;
-    if (remoteProfile == null) {
-      // TODO This can occur if one member defines no indexes but another one does. Currently
this
-      // is caught by the async event id checks.
-    } else {
-      // Verify fields are the same
-      if (!Arrays.equals(remoteProfile.getFieldNames(), getFieldNames())) {
+
+    // Verify fields are the same
+    if (!Arrays.equals(remoteProfile.getFieldNames(), getFieldNames())) {
+      return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
+          .toString(getIndexName(), regionPath, Arrays.toString(getFieldNames()),
+              Arrays.toString(remoteProfile.getFieldNames()));
+    }
+
+    // Verify the analyzer class is the same
+    // Note: This test will currently only fail if per-field analyzers are used in one member
but
+    // not another,
+    // This condition will be caught in the tests below so this test is commented out. If
we ever
+    // allow the user
+    // to configure a single analyzer for all fields, then this test will be useful again.
+    /*
+     * if (!remoteLuceneIndexProfile.getAnalyzerClass().isInstance(getAnalyzer())) { result
=
+     * LocalizedStrings.
+     * LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_3
+     * .toString(indexName, regionPath, remoteLuceneIndexProfile.getAnalyzerClass().getName(),
+     * analyzer.getClass().getName()); }
+     */
+
+    // Iterate the existing analyzers and compare them to the input analyzers
+    // Note: This is currently destructive to the input field analyzers map which should
be ok
+    // since its a transient object.
+    if (!getFieldAnalyzers().equals(remoteProfile.getFieldAnalyzers())) {
+      if (getFieldAnalyzers().size() != remoteProfile.getFieldAnalyzers().size()) {
         return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
-            .toString(getIndexName(), regionPath, Arrays.toString(getFieldNames()),
-                Arrays.toString(remoteProfile.getFieldNames()));
+            .toString(getIndexName(), regionPath,
+                Arrays.toString(getFieldAnalyzers().keySet().toArray()),
+                Arrays.toString(remoteProfile.getFieldAnalyzers().keySet().toArray()));
       }
-
-      // Verify the analyzer class is the same
-      // Note: This test will currently only fail if per-field analyzers are used in one
member but
-      // not another,
-      // This condition will be caught in the tests below so this test is commented out.
If we ever
-      // allow the user
-      // to configure a single analyzer for all fields, then this test will be useful again.
-      /*
-       * if (!remoteLuceneIndexProfile.getAnalyzerClass().isInstance(getAnalyzer())) { result
=
-       * LocalizedStrings.
-       * LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_3
-       * .toString(indexName, regionPath, remoteLuceneIndexProfile.getAnalyzerClass().getName(),
-       * analyzer.getClass().getName()); }
-       */
-
-      // Iterate the existing analyzers and compare them to the input analyzers
-      // Note: This is currently destructive to the input field analyzers map which should
be ok
-      // since its a transient object.
-      if (!getFieldAnalyzers().equals(remoteProfile.getFieldAnalyzers())) {
-        if (getFieldAnalyzers().size() != remoteProfile.getFieldAnalyzers().size()) {
-          return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_FIELDS_2_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_FIELDS_3
-              .toString(getIndexName(), regionPath,
-                  Arrays.toString(getFieldAnalyzers().keySet().toArray()),
-                  Arrays.toString(remoteProfile.getFieldAnalyzers().keySet().toArray()));
-        }
-        // now the 2 maps should have the same size
-        for (String field : getFieldAnalyzers().keySet()) {
-          if (!remoteProfile.getFieldAnalyzers().get(field)
-              .equals(getFieldAnalyzers().get(field))) {
-            return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_ON_FIELD_3_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_4_ON_THAT_FIELD
-                .toString(getIndexName(), regionPath, getFieldAnalyzers().get(field), field,
-                    remoteProfile.getFieldAnalyzers().get(field));
-          }
+      // now the 2 maps should have the same size
+      for (String field : getFieldAnalyzers().keySet()) {
+        if (!remoteProfile.getFieldAnalyzers().get(field).equals(getFieldAnalyzers().get(field)))
{
+          return LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_WITH_ANALYZER_2_ON_FIELD_3_BECAUSE_ANOTHER_MEMBER_DEFINES_THE_SAME_INDEX_WITH_ANALYZER_4_ON_THAT_FIELD
+              .toString(getIndexName(), regionPath, getFieldAnalyzers().get(field), field,
+                  remoteProfile.getFieldAnalyzers().get(field));
         }
       }
     }
@@ -139,6 +134,15 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile,
DataSeri
   }
 
   @Override
+  public String getMissingProfileMessage(boolean existsInThisMember) {
+    return existsInThisMember
+        ? LocalizedStrings.LuceneService_CANNOT_CREATE_INDEX_0_ON_REGION_1_BECAUSE_IT_IS_NOT_DEFINED_IN_ANOTHER_MEMBER
+            .toString(getIndexName(), regionPath)
+        : LocalizedStrings.LuceneService_MUST_DEFINE_INDEX_0_ON_REGION_1_BECAUSE_IT_IS_DEFINED_IN_ANOTHER_MEMBER
+            .toString(getIndexName(), regionPath);
+  }
+
+  @Override
   public void toData(DataOutput out) throws IOException {
     DataSerializer.writeString(this.indexName, out);
     DataSerializer.writeString(this.regionPath, out);

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
index c2109e4..326c85c 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
@@ -95,6 +95,9 @@ public class LuceneRegionListener implements RegionListener {
       // Add index creation profile
       internalRegionArgs.addCacheServiceProfile(new LuceneIndexCreationProfile(this.indexName,
           this.regionPath, this.fields, this.analyzer, this.fieldAnalyzers));
+
+      // Add internal async event id
+      internalRegionArgs.addInternalAsyncEventQueueId(aeqId);
     }
     return updatedRA;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
index c878fb7..694d3f1 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
@@ -17,6 +17,7 @@ package org.apache.geode.cache.lucene;
 import junitparams.JUnitParamsRunner;
 import junitparams.Parameters;
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionDestroyedException;
 import org.apache.geode.cache.lucene.internal.LuceneIndexForPartitionedRegion;
 import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
 import org.apache.geode.cache.lucene.test.TestObject;
@@ -25,7 +26,9 @@ import org.apache.geode.cache.snapshot.SnapshotOptions;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.SerializableRunnableIF;
+import org.apache.geode.test.dunit.ThreadUtils;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.awaitility.Awaitility;
@@ -51,7 +54,9 @@ import static org.junit.Assert.assertTrue;
 @RunWith(JUnitParamsRunner.class)
 public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
 
-  private volatile boolean STOP_PUTS = false;
+  private static volatile boolean STOP_PUTS = false;
+
+  private static int NUM_PUTS_COMPLETED = 0;
 
   protected VM accessor;
 
@@ -125,12 +130,13 @@ public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
     }
   }
 
-  @Ignore
-  // Destroying an index while puts are occurring currently fails with a
-  // GatewaySenderConfigurationException.
-  @Parameters(method = "getListOfServerRegionTestTypes")
+  @Test
+  @Parameters(method = "getListOfRegionTestTypes")
   public void verifyDestroySingleIndexWhileDoingPuts(RegionTestableType regionType)
       throws Exception {
+    // Add ignored exceptions to ignore RegionDestroyExceptions
+    IgnoredException.addIgnoredException(RegionDestroyedException.class.getSimpleName());
+
     // Create index and region
     dataStore1.invoke(() -> initDataStore(createIndex(), regionType));
     dataStore2.invoke(() -> initDataStore(createIndex(), regionType));
@@ -154,7 +160,56 @@ public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
 
     // End puts
     dataStore1.invoke(() -> stopPuts());
-    putter.join();
+
+    // Wait for the putter to complete and verify no exception has occurred
+    ThreadUtils.join(putter, 60 * 1000);
+    if (putter.exceptionOccurred()) {
+      fail(putter.getException());
+    }
+
+    // Verify region size
+    dataStore1.invoke(() -> verifyRegionSize());
+  }
+
+  @Test
+  @Parameters(method = "getListOfRegionTestTypes")
+  public void verifyDestroyAllIndexesWhileDoingPuts(RegionTestableType regionType)
+      throws Exception {
+    // Add ignored exceptions to ignore RegionDestroyExceptions
+    IgnoredException.addIgnoredException(RegionDestroyedException.class.getSimpleName());
+
+    // Create indexes and region
+    dataStore1.invoke(() -> initDataStore(createIndexes(), regionType));
+    dataStore2.invoke(() -> initDataStore(createIndexes(), regionType));
+
+    // Verify indexes created
+    dataStore1.invoke(() -> verifyIndexesCreated());
+    dataStore2.invoke(() -> verifyIndexesCreated());
+
+    // Start puts
+    AsyncInvocation putter = dataStore1.invokeAsync(() -> doPutsUntilStopped());
+
+    // Wait until puts have started
+    dataStore1.invoke(() -> waitUntilPutsHaveStarted());
+
+    // Destroy indexes (only needs to be done on one member)
+    dataStore1.invoke(() -> destroyIndexes());
+
+    // Verify indexes destroyed
+    dataStore1.invoke(() -> verifyIndexesDestroyed());
+    dataStore2.invoke(() -> verifyIndexesDestroyed());
+
+    // End puts
+    dataStore1.invoke(() -> stopPuts());
+
+    // Wait for the putter to complete and verify no exception has occurred
+    ThreadUtils.join(putter, 60 * 1000);
+    if (putter.exceptionOccurred()) {
+      fail(putter.getException());
+    }
+
+    // Verify region size
+    dataStore1.invoke(() -> verifyRegionSize());
   }
 
   @Test
@@ -368,18 +423,27 @@ public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
   }
 
   private void doPutsUntilStopped() throws Exception {
+    allowPuts();
     Region region = getCache().getRegion(REGION_NAME);
     int i = 0;
     while (!STOP_PUTS) {
       region.put(i++, new TestObject());
-      // Thread.sleep(50);
+      NUM_PUTS_COMPLETED = i;
     }
   }
 
-  private void stopPuts() {
+  private static void stopPuts() {
     STOP_PUTS = true;
   }
 
+  private static void allowPuts() {
+    STOP_PUTS = false;
+  }
+
+  private void verifyRegionSize() {
+    assertEquals(NUM_PUTS_COMPLETED, getCache().getRegion(REGION_NAME).size());
+  }
+
   private void waitUntilPutsHaveStarted() {
     Awaitility.waitAtMost(30, TimeUnit.SECONDS)
         .until(() -> getCache().getRegion(REGION_NAME).size() > 0);

http://git-wip-us.apache.org/repos/asf/geode/blob/1f07ec76/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 e9b9369..5563112 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
@@ -69,13 +69,13 @@ public class LuceneTestUtilities {
   public static final String CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_ANALYZERS_3 =
       "Cannot create Lucene index index on region /region with analyzer KeywordAnalyzer on
field field2 because another member defines the same index with analyzer StandardAnalyzer
on that field.";
   public static final String CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_NAMES =
-      "Cannot create Region /region with [index2#_region] async event ids because another
cache has the same region defined with [index1#_region] async event ids";
+      "Cannot create Lucene index index2 on region /region because it is not defined in another
member.";
   public static final String CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_INDEXES_1 =
-      "Cannot create Region /region with [] async event ids because another cache has the
same region defined with [index#_region] async event ids";
+      "Must create Lucene index index on region /region because it is defined in another
member.";
   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";
+      "Cannot create Lucene index index2 on region /region because it is not defined in another
member.";
   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";
+      "Cannot create Lucene index index on region /region because it is not defined in another
member.";
 
   public static String Quarter1 = "Q1";
   public static String Quarter2 = "Q2";


Mime
View raw message