geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasonhu...@apache.org
Subject incubator-geode git commit: GEODE-794: Unable to match iterators when update in progress
Date Fri, 12 Feb 2016 19:23:32 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 09c0c8dd8 -> 781277f31


GEODE-794: Unable to match iterators when update in progress

Adding other types of CompiledValue that could possibly be used to find a runtime iterator


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

Branch: refs/heads/develop
Commit: 781277f31f37388f7247cbdf05025c12de825d2a
Parents: 09c0c8d
Author: Jason Huynh <huynhja@gmail.com>
Authored: Tue Feb 9 14:08:28 2016 -0800
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Fri Feb 12 10:49:58 2016 -0800

----------------------------------------------------------------------
 .../query/internal/index/AbstractIndex.java     |  4 +++
 .../query/internal/index/CompactRangeIndex.java |  4 ++-
 .../index/CompactRangeIndexJUnitTest.java       | 27 +++++++++++++++++++-
 3 files changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/781277f3/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
index f59d078..83a77fd 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/AbstractIndex.java
@@ -46,6 +46,7 @@ import com.gemstone.gemfire.cache.query.internal.Bag;
 import com.gemstone.gemfire.cache.query.internal.CompiledID;
 import com.gemstone.gemfire.cache.query.internal.CompiledIndexOperation;
 import com.gemstone.gemfire.cache.query.internal.CompiledIteratorDef;
+import com.gemstone.gemfire.cache.query.internal.CompiledOperation;
 import com.gemstone.gemfire.cache.query.internal.CompiledPath;
 import com.gemstone.gemfire.cache.query.internal.CompiledValue;
 import com.gemstone.gemfire.cache.query.internal.CqEntry;
@@ -1703,6 +1704,9 @@ public abstract class AbstractIndex implements IndexProtocol
     else if (path instanceof CompiledPath) {
       return getReceiverNameFromPath(path.getReceiver());
     }
+    else if (path instanceof CompiledOperation) {
+      return getReceiverNameFromPath(path.getReceiver());
+    }
     else if (path instanceof CompiledIndexOperation) {
       return getReceiverNameFromPath(((CompiledIndexOperation)path).getReceiver());
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/781277f3/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndex.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndex.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndex.java
index 13c8a8e..1e44bb4 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndex.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndex.java
@@ -93,6 +93,8 @@ public class CompactRangeIndex extends AbstractIndex {
   protected ThreadLocal<OldKeyValuePair> oldKeyValue;
  
   private IndexStore indexStore;
+  
+  static boolean TEST_ALWAYS_UPDATE_IN_PROGRESS = false;
 
   public CompactRangeIndex(String indexName, Region region, String fromClause,
       String indexedExpression, String projectionAttributes,
@@ -883,7 +885,7 @@ public class CompactRangeIndex extends AbstractIndex {
         } else {
           if (value != null) {
             boolean ok = true;
-            if (indexEntry.isUpdateInProgress()) {
+            if (indexEntry.isUpdateInProgress() || TEST_ALWAYS_UPDATE_IN_PROGRESS) {
               IndexInfo indexInfo = (IndexInfo) context
                   .cacheGet(CompiledValue.INDEX_INFO);
               if (runtimeItr == null) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/781277f3/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndexJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndexJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndexJUnitTest.java
index e49ee74..68a946c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndexJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CompactRangeIndexJUnitTest.java
@@ -252,7 +252,32 @@ public class CompactRangeIndexJUnitTest  {
     }
     assertEquals("incorrect number of entries in collection", 0, count);
   }
-  
+
+  @Test
+  public void testUpdateInProgressWithMethodInvocationInIndexClauseShouldNotThrowException()
throws Exception {
+    try {
+      CompactRangeIndex.TEST_ALWAYS_UPDATE_IN_PROGRESS = true;
+      index = utils.createIndex("indexName", "getP1().getSharesOutstanding()", "/exampleRegion");
+      Region region = utils.getCache().getRegion("exampleRegion");
+
+      // create objects
+      int numObjects = 10;
+      for (int i = 1; i <= numObjects; i++) {
+        Portfolio p = new Portfolio(i);
+        p.status = null;
+        region.put("KEY-" + i, p);
+      }
+      // execute query and check result size
+      QueryService qs = utils.getCache().getQueryService();
+      SelectResults results = (SelectResults) qs
+          .newQuery(
+              "<trace>SELECT DISTINCT e.key FROM /exampleRegion AS e WHERE e.ID = 1
AND e.getP1().getSharesOutstanding() >= -1 AND e.getP1().getSharesOutstanding() <= 1000
LIMIT 10 ")
+          .execute();
+    } finally {
+      CompactRangeIndex.TEST_ALWAYS_UPDATE_IN_PROGRESS = false;
+    }
+  }
+
   private class MemoryIndexStoreREToIndexElemTestHook implements TestHook {
 
     private CountDownLatch readyToStartRemoveLatch;


Mime
View raw message