You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2018/04/19 18:00:44 UTC
[geode] branch feature/GEODE-925 updated: GEODE-925: spotless
This is an automated email from the ASF dual-hosted git repository.
udo pushed a commit to branch feature/GEODE-925
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-925 by this push:
new c151f94 GEODE-925: spotless
c151f94 is described below
commit c151f948e262b2e1066a3a1d1cca7362e0c6e3bc
Author: Udo Kohlmeyer <uk...@pivotal.io>
AuthorDate: Thu Apr 19 11:00:33 2018 -0700
GEODE-925: spotless
---
.../dunit/QueryDataInconsistencyDUnitTest.java | 158 ++++++++++-----------
1 file changed, 76 insertions(+), 82 deletions(-)
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
index 18bb508..cc7c336 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
@@ -52,7 +52,6 @@ import org.apache.geode.test.dunit.AsyncInvocation;
import org.apache.geode.test.dunit.Host;
import org.apache.geode.test.dunit.Invoke;
import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.dunit.ThreadUtils;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
@@ -74,7 +73,7 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
private static String PartitionedRegionName1 = "TestPartitionedRegion1"; // default name
private static String repRegionName = "TestRepRegion"; // default name
public static String[] queries =
- new String[]{"select * from /" + PartitionedRegionName1 + " where ID=1",};
+ new String[] {"select * from /" + PartitionedRegionName1 + " where ID=1",};
private static volatile boolean hooked = false;
private Logger logger = LogService.getLogger(QueryDataInconsistencyDUnitTest.class.getName());
@@ -123,13 +122,12 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
// Invoke update from client and stop in updateIndex
// first before updating the RegionEntry and second after updating
// the RegionEntry.
- AsyncInvocation putThread =
- server.invokeAsync("update a Region Entry", () -> {
- Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
- IndexManager.testHook = new IndexManagerTestHook();
- repRegion.put(new Integer("1"), new Portfolio(cntDest + 1));
- // above call must be hooked in BEFORE_UPDATE_OP call.
- });
+ AsyncInvocation putThread = server.invokeAsync("update a Region Entry", () -> {
+ Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
+ IndexManager.testHook = new IndexManagerTestHook();
+ repRegion.put(new Integer("1"), new Portfolio(cntDest + 1));
+ // above call must be hooked in BEFORE_UPDATE_OP call.
+ });
server.invoke("query on server", () -> {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
Awaitility.await().until(() -> hooked);
@@ -176,7 +174,7 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
hooked = false;// Let client put go further.
});
Awaitility.await().until(joinThread(putThread));
-// ThreadUtils.join(putThread, 200);
+ // ThreadUtils.join(putThread, 200);
}
@Test
@@ -209,15 +207,14 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
// Invoke update from client and stop in updateIndex
// first before updating the RegionEntry and second after updating
// the RegionEntry.
- AsyncInvocation putThread =
- server.invokeAsync("update a Region Entry", () -> {
- Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
- IndexManager.testHook = new IndexManagerTestHook();
- Portfolio newPort = new Portfolio(cntDest + 1);
- CacheFactory.getAnyInstance().getLogger().fine("Shobhit: New Portfolio" + newPort);
- repRegion.put(new Integer("1"), newPort);
- // above call must be hooked in BEFORE_UPDATE_OP call.
- });
+ AsyncInvocation putThread = server.invokeAsync("update a Region Entry", () -> {
+ Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
+ IndexManager.testHook = new IndexManagerTestHook();
+ Portfolio newPort = new Portfolio(cntDest + 1);
+ CacheFactory.getAnyInstance().getLogger().fine("Shobhit: New Portfolio" + newPort);
+ repRegion.put(new Integer("1"), newPort);
+ // above call must be hooked in BEFORE_UPDATE_OP call.
+ });
server.invoke("query on server", () -> {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
@@ -262,7 +259,7 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
}
});
Awaitility.await().until(joinThread(putThread));
-// ThreadUtils.join(putThread, 200);
+ // ThreadUtils.join(putThread, 200);
}
@Category(FlakyTest.class) // GEODE-925: time sensitive, async actions, short timeouts
@@ -284,8 +281,8 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
try {
- Index index = qs.createIndex("posIndex", "pos.secId", "/" + repRegionName
- + " p, p.collectionHolderMap.values coll, p.positions.values pos");
+ Index index = qs.createIndex("posIndex", "pos.secId",
+ "/" + repRegionName + " p, p.collectionHolderMap.values coll, p.positions.values pos");
assertEquals(12, index.getStatistics().getNumberOfKeys());
} catch (Exception e) {
fail("Index creation failed");
@@ -294,59 +291,58 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
// Invoke update from client and stop in updateIndex
// first before updating the RegionEntry and second after updating
// the RegionEntry.
- AsyncInvocation putThread =
- server.invokeAsync("update a Region Entry", () -> {
- Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
- IndexManager.testHook = new IndexManagerTestHook();
- // This portfolio with same ID must have different positions.
- repRegion.put(new Integer("1"), new Portfolio(1));
- // above call must be hooked in BEFORE_UPDATE_OP call.
- });
+ AsyncInvocation putThread = server.invokeAsync("update a Region Entry", () -> {
+ Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
+ IndexManager.testHook = new IndexManagerTestHook();
+ // This portfolio with same ID must have different positions.
+ repRegion.put(new Integer("1"), new Portfolio(1));
+ // above call must be hooked in BEFORE_UPDATE_OP call.
+ });
server.invoke("query on server", () -> {
- QueryService qs = CacheFactory.getAnyInstance().getQueryService();
- Position pos1 = null;
- Awaitility.await().until(() -> hooked);
- try {
- Object rs = qs.newQuery("<trace> select pos from /" + repRegionName
- + " p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
- CacheFactory.getAnyInstance().getLogger().fine("Shobhit: " + rs);
- assertTrue(rs instanceof SelectResults);
- pos1 = (Position) ((SelectResults) rs).iterator().next();
- if (!pos1.secId.equals("APPL")) {
- fail("Query thread did not verify index results even when RE is under update");
- IndexManager.testHook = null;
- }
- } catch (Exception e) {
- logger.error(e);
- fail("Query execution failed on server.");
- IndexManager.testHook = null;
- } finally {
- hooked = false;// Let client put go further.
- }
- Awaitility.await().until(() -> hooked);
- try {
- Object rs = qs.newQuery("select pos from /" + repRegionName
- + " p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
- assertTrue(rs instanceof SelectResults);
- if (((SelectResults) rs).size() > 0) {
- Position pos2 = (Position) ((SelectResults) rs).iterator().next();
- if (pos2.equals(pos1)) {
- fail("Query thread did not verify index results even when RE is under update and "
- + "RegionEntry value has been modified before releasing the lock");
- }
- }
- } catch (Exception e) {
- logger.error(e);
- fail("Query execution failed on server.");
- } finally {
- hooked = false;// Let client put go further.
- IndexManager.testHook = null;
+ QueryService qs = CacheFactory.getAnyInstance().getQueryService();
+ Position pos1 = null;
+ Awaitility.await().until(() -> hooked);
+ try {
+ Object rs = qs.newQuery("<trace> select pos from /" + repRegionName
+ + " p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
+ CacheFactory.getAnyInstance().getLogger().fine("Shobhit: " + rs);
+ assertTrue(rs instanceof SelectResults);
+ pos1 = (Position) ((SelectResults) rs).iterator().next();
+ if (!pos1.secId.equals("APPL")) {
+ fail("Query thread did not verify index results even when RE is under update");
+ IndexManager.testHook = null;
+ }
+ } catch (Exception e) {
+ logger.error(e);
+ fail("Query execution failed on server.");
+ IndexManager.testHook = null;
+ } finally {
+ hooked = false;// Let client put go further.
+ }
+ Awaitility.await().until(() -> hooked);
+ try {
+ Object rs = qs.newQuery("select pos from /" + repRegionName
+ + " p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
+ assertTrue(rs instanceof SelectResults);
+ if (((SelectResults) rs).size() > 0) {
+ Position pos2 = (Position) ((SelectResults) rs).iterator().next();
+ if (pos2.equals(pos1)) {
+ fail("Query thread did not verify index results even when RE is under update and "
+ + "RegionEntry value has been modified before releasing the lock");
}
}
- );
+ } catch (Exception e) {
+ logger.error(e);
+ fail("Query execution failed on server.");
+ } finally {
+ hooked = false;// Let client put go further.
+ IndexManager.testHook = null;
+ }
+ });
Awaitility.await().until(joinThread(putThread));
-// ThreadUtils.join(putThread, 200); // GEODE-925 occurs here and this is very short join 200 millis
+ // ThreadUtils.join(putThread, 200); // GEODE-925 occurs here and this is very short join 200
+ // millis
}
@Test
@@ -377,14 +373,13 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
// Invoke update from client and stop in updateIndex
// first before updating the RegionEntry and second after updating
// the RegionEntry.
- AsyncInvocation putThread =
- server.invokeAsync("update a Region Entry", () -> {
- Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
- IndexManager.testHook = new IndexManagerTestHook();
- // This portfolio with same ID must have different positions.
- repRegion.put(new Integer("1"), new Portfolio(1));
- // above call must be hooked in BEFORE_UPDATE_OP call.
- });
+ AsyncInvocation putThread = server.invokeAsync("update a Region Entry", () -> {
+ Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName);
+ IndexManager.testHook = new IndexManagerTestHook();
+ // This portfolio with same ID must have different positions.
+ repRegion.put(new Integer("1"), new Portfolio(1));
+ // above call must be hooked in BEFORE_UPDATE_OP call.
+ });
server.invoke("query on server", () -> {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
@@ -433,7 +428,7 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
}
});
Awaitility.await().until(joinThread(putThread));
-// ThreadUtils.join(putThread, 200);
+ // ThreadUtils.join(putThread, 200);
}
private Callable<Boolean> joinThread(AsyncInvocation thread) {
@@ -476,12 +471,11 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
/**
* This function puts portfolio objects into the created Region (PR or Local) *
+ *
* @return cacheSerializable object
*/
public CacheSerializableRunnable getCacheSerializableRunnableForPRPuts(final String regionName,
- final Object[] portfolio,
- final int from,
- final int to) {
+ final Object[] portfolio, final int from, final int to) {
SerializableRunnable puts = new CacheSerializableRunnable("Region Puts") {
@Override
public void run2() throws CacheException {
--
To stop receiving notification emails like this one, please contact
udo@apache.org.