geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject incubator-geode git commit: GEODE-11: Fixing creation of replicated region after index creation.
Date Mon, 01 Aug 2016 22:32:15 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop b9387fb57 -> 2cab2ee70


GEODE-11: Fixing creation of replicated region after index creation.

If a replicated region is created after a lucene index is defined, an error is thrown but
the region is created (since this check is done in the afterCreate method). This was fixed
by moving the check to the beforeCreate method of the region listener.

Signed-off-by: Gester Zhou <gzhou@pivotal.io>


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

Branch: refs/heads/develop
Commit: 2cab2ee70c5fd05c76b8806a4e6033e3277d6664
Parents: b9387fb
Author: Aparna Dharmakkan <adharmakkan@pivotal.io>
Authored: Mon Aug 1 14:54:39 2016 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Mon Aug 1 15:18:41 2016 -0700

----------------------------------------------------------------------
 .../lucene/internal/LuceneServiceImpl.java      | 36 +++++++++-----------
 1 file changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2cab2ee7/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 5cce2f8..b0da08d 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
@@ -153,7 +153,22 @@ public class LuceneServiceImpl implements InternalLuceneService {
           RegionAttributes attrs, InternalRegionArguments internalRegionArgs) {
         RegionAttributes updatedRA = attrs;
         String path = parent == null ? "/" + regionName : parent.getFullPath() + "/" + regionName;
+
         if(path.equals(dataRegionPath)) {
+
+          if (!attrs.getDataPolicy().withPartitioning()) {
+            // replicated region
+            throw new UnsupportedOperationException("Lucene indexes on replicated regions
are not supported");
+          }
+
+          //For now we cannot support eviction with local destroy.
+          //Eviction with overflow to disk still needs to be supported
+          EvictionAttributes evictionAttributes = attrs.getEvictionAttributes();
+          EvictionAlgorithm evictionAlgorithm = evictionAttributes.getAlgorithm();
+          if (evictionAlgorithm != EvictionAlgorithm.NONE && evictionAttributes.getAction().isLocalDestroy())
{
+            throw new UnsupportedOperationException("Lucene indexes on regions with eviction
and action local destroy are not supported");
+          }
+
           String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, dataRegionPath);
           if (!attrs.getAsyncEventQueueIds().contains(aeqId)) {
             AttributesFactory af = new AttributesFactory(attrs);
@@ -175,7 +190,6 @@ public class LuceneServiceImpl implements InternalLuceneService {
         }
       }
     });
-    
   }
 
 
@@ -202,26 +216,8 @@ public class LuceneServiceImpl implements InternalLuceneService {
       return null;
     }
     //Convert the region name into a canonical form
-    
     regionPath = dataregion.getFullPath();
-    LuceneIndexImpl index = null;
-
-    //For now we cannot support eviction with local destroy.
-    //Eviction with overflow to disk still needs to be supported
-    EvictionAttributes evictionAttributes = dataregion.getAttributes().getEvictionAttributes();
-    EvictionAlgorithm evictionAlgorithm = evictionAttributes.getAlgorithm();
-    if (evictionAlgorithm != EvictionAlgorithm.NONE && evictionAttributes.getAction().isLocalDestroy())
{
-      throw new UnsupportedOperationException("Lucene indexes on regions with eviction and
action local destroy are not supported");
-    }
-
-    if (dataregion instanceof PartitionedRegion) {
-      // partitioned region
-      index = new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
-    } else {
-      // replicated region
-      throw new UnsupportedOperationException("Lucene indexes on replicated regions are not
supported");
-    }
-    return index;
+    return new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
   }
 
   private void registerDefinedIndex(final String regionAndIndex, final LuceneIndexCreationProfile
luceneIndexCreationProfile) {


Mime
View raw message