geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [09/32] geode git commit: GEODE-2384: not to create AEQ for accessor
Date Fri, 03 Feb 2017 18:35:38 GMT
GEODE-2384: not to create AEQ for accessor


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

Branch: refs/heads/feature/GEODE-1930-2
Commit: 1aec1f835003f4ccdd73b7e811686bb58c8f32ea
Parents: 72739d8
Author: zhouxh <gzhou@pivotal.io>
Authored: Mon Jan 30 16:36:17 2017 -0800
Committer: zhouxh <gzhou@pivotal.io>
Committed: Tue Jan 31 13:58:34 2017 -0800

----------------------------------------------------------------------
 .../cache/lucene/internal/LuceneIndexImpl.java  |  8 ++++
 .../geode/cache/lucene/LuceneQueriesPRBase.java |  6 ++-
 .../LuceneQueriesPeerPROverflowDUnitTest.java   |  4 +-
 .../LuceneQueriesPeerPRPersistentDUnitTest.java | 41 ++++++++++++++++++++
 .../cache/lucene/test/LuceneTestUtilities.java  |  6 +++
 5 files changed, 62 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/1aec1f83/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
index 0b6685d..8d24a83 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
@@ -166,6 +166,11 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex
{
     AsyncEventQueueFactoryImpl factory =
         (AsyncEventQueueFactoryImpl) cache.createAsyncEventQueueFactory();
     if (dataRegion instanceof PartitionedRegion) {
+      PartitionedRegion pr = (PartitionedRegion) dataRegion;
+      if (pr.getPartitionAttributes().getLocalMaxMemory() == 0) {
+        // accessor will not create AEQ
+        return null;
+      }
       factory.setParallel(true); // parallel AEQ for PR
     } else {
       factory.setParallel(false); // TODO: not sure if serial AEQ working or not
@@ -183,6 +188,9 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
   }
 
   private AsyncEventQueue createAEQ(AsyncEventQueueFactoryImpl factory) {
+    if (factory == null) {
+      return null;
+    }
     LuceneEventListener listener = new LuceneEventListener(repositoryManager);
     String aeqId = LuceneServiceImpl.getUniqueIndexName(getName(), regionPath);
     AsyncEventQueue indexQueue = factory.create(aeqId, listener);

http://git-wip-us.apache.org/repos/asf/geode/blob/1aec1f83/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPRBase.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPRBase.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPRBase.java
index 1e965da..c877f93 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPRBase.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPRBase.java
@@ -93,7 +93,8 @@ public abstract class LuceneQueriesPRBase extends LuceneQueriesBase {
     putEntryInEachBucket();
 
     dataStore2.invoke(() -> initDataStore(createIndex));
-    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
+    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, 60000)); // accessor?
+    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
 
     rebalanceRegion(dataStore2);
 
@@ -117,7 +118,8 @@ public abstract class LuceneQueriesPRBase extends LuceneQueriesBase {
     rebalanceRegion(dataStore2);
     dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
 
-    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
+    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, 60000)); // accessor?
+    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
 
     executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/1aec1f83/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPROverflowDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPROverflowDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPROverflowDUnitTest.java
index 254156f..86ce713 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPROverflowDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPROverflowDUnitTest.java
@@ -39,6 +39,8 @@ public class LuceneQueriesPeerPROverflowDUnitTest extends LuceneQueriesPRBase
{
 
   @Override
   protected void initAccessor(final SerializableRunnableIF createIndex) throws Exception
{
-    initDataStore(createIndex);
+    createIndex.run();
+    getCache().createRegionFactory(RegionShortcut.PARTITION_PROXY)
+        .setPartitionAttributes(getPartitionAttributes(true)).create(REGION_NAME);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/1aec1f83/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPRPersistentDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPRPersistentDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPRPersistentDUnitTest.java
new file mode 100644
index 0000000..4e809ce
--- /dev/null
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesPeerPRPersistentDUnitTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information
regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version
2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain
a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
+ * or implied. See the License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.geode.cache.lucene;
+
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.test.dunit.SerializableRunnableIF;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
+
+@Category(DistributedTest.class)
+public class LuceneQueriesPeerPRPersistentDUnitTest extends LuceneQueriesPRBase {
+
+  @Override
+  protected void initDataStore(final SerializableRunnableIF createIndex) throws Exception
{
+    createIndex.run();
+    getCache().createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+        .setPartitionAttributes(getPartitionAttributes(false)).create(REGION_NAME);
+  }
+
+  @Override
+  protected void initAccessor(final SerializableRunnableIF createIndex) throws Exception
{
+    createIndex.run();
+    getCache().createRegionFactory(RegionShortcut.PARTITION_PROXY)
+        .setPartitionAttributes(getPartitionAttributes(true)).create(REGION_NAME);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/1aec1f83/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 c4081c5..9f062bb 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
@@ -224,6 +224,9 @@ public class LuceneTestUtilities {
 
   public static void pauseSender(final Cache cache) {
     final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue(cache);
+    if (queue == null) {
+      return;
+    }
     queue.getSender().pause();
 
     AbstractGatewaySender sender = (AbstractGatewaySender) queue.getSender();
@@ -232,6 +235,9 @@ public class LuceneTestUtilities {
 
   public static void resumeSender(final Cache cache) {
     final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue(cache);
+    if (queue == null) {
+      return;
+    }
     queue.getSender().resume();
   }
 }


Mime
View raw message