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-1061: Synchronized update operations and executeCQ happens before updates
Date Tue, 05 Apr 2016 20:58:34 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop e92bf7073 -> 80af53d91


GEODE-1061: Synchronized update operations and executeCQ happens before updates

* Moved function execution of executeCQ before region updates because if all the updates finish
before executeCQ, the test will fail because the cache map size will be zero. This is a feature
for PR regions.
* Made all update operations to be synchronous rather than using sleep and infinite while
loop to wait.

This closes #121


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

Branch: refs/heads/develop
Commit: 80af53d91053facb803a616e7b32bfdb52302e6d
Parents: e92bf70
Author: nabarun <nnag@pivotal.io>
Authored: Thu Mar 31 13:47:59 2016 -0700
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Tue Apr 5 13:58:01 2016 -0700

----------------------------------------------------------------------
 .../cache/query/internal/cq/ServerCQImpl.java   |  7 +++++-
 .../cq/dunit/CqResultSetUsingPoolDUnitTest.java | 24 ++++----------------
 2 files changed, 10 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80af53d9/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/ServerCQImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/ServerCQImpl.java
b/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/ServerCQImpl.java
index 1acb23c..57cd650 100644
--- a/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/ServerCQImpl.java
+++ b/geode-cq/src/main/java/com/gemstone/gemfire/cache/query/internal/cq/ServerCQImpl.java
@@ -69,7 +69,12 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable,
Serve
    * This holds the keys that are part of the CQ query results.
    * Using this CQ engine can determine whether to execute 
    * query on old value from EntryEvent, which is an expensive
-   * operation. 
+   * operation.
+   *
+   * NOTE:
+   * In case of RR this map is populated and used as intended.
+   * In case of PR this map will not be populated. If executeCQ happens after update operations
+   * this map will remain empty.
    */
   private volatile HashMap<Object, Object> cqResultKeys;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80af53d9/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqResultSetUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqResultSetUsingPoolDUnitTest.java
b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqResultSetUsingPoolDUnitTest.java
index 37b7949..a94b72b 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqResultSetUsingPoolDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqResultSetUsingPoolDUnitTest.java
@@ -764,9 +764,11 @@ public class CqResultSetUsingPoolDUnitTest extends CacheTestCase {
         }
       }
     });
-    
+
+    cqDUnitTest.executeCQ(client, cqName, true, null);
+
     // Keep updating region (async invocation).
-    server2.invokeAsync(new CacheSerializableRunnable("Update Region"){
+    server2.invoke(new CacheSerializableRunnable("Update Region"){
       public void run2()throws CacheException {
         Region region = getCache().getRegion("/root/" + cqDUnitTest.regions[0]);
         // Update (totalObjects - 1) entries.
@@ -790,10 +792,6 @@ public class CqResultSetUsingPoolDUnitTest extends CacheTestCase {
       }
     });
 
-    // Execute CQ.
-    // While region operation is in progress execute CQ.
-    cqDUnitTest.executeCQ(client, cqName, true, null);
-    
     // Verify CQ Cache results.
     server1.invoke(new CacheSerializableRunnable("Verify CQ Cache results"){
       public void run2()throws CacheException {
@@ -804,20 +802,6 @@ public class CqResultSetUsingPoolDUnitTest extends CacheTestCase {
           LogWriterUtils.getLogWriter().info("Failed to get the internal CqService.", ex);
           Assert.fail ("Failed to get the internal CqService.", ex);
         }
-        
-        // Wait till all the region update is performed.
-        Region region = getCache().getRegion("/root/" + cqDUnitTest.regions[0]);
-        while(true){
-          if (region.get(""+ totalObjects) == null){
-            try {
-              Thread.sleep(50);
-            } catch (Exception ex){
-              //ignore.
-            }
-            continue;
-          }
-          break;
-        }
         Collection<? extends InternalCqQuery> cqs = cqService.getAllCqs();
         for (InternalCqQuery cq: cqs){
           ServerCQImpl cqQuery = (ServerCQImpl)cq;


Mime
View raw message