You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/01/12 08:01:47 UTC
[21/24] ignite git commit: ignite-gg-8.0.2.ea2 fix
CacheExpiryTest.iteratorNextShouldCallGetExpiryForAccessedEntry TCK test
ignite-gg-8.0.2.ea2 fix CacheExpiryTest.iteratorNextShouldCallGetExpiryForAccessedEntry TCK test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/43eefb0c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/43eefb0c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/43eefb0c
Branch: refs/heads/ignite-gg-11810
Commit: 43eefb0c77f448af9b3634414bef0e97cb2d7838
Parents: 2266e2a
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Wed Jan 11 15:30:52 2017 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Wed Jan 11 15:30:52 2017 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheQueryManager.java | 23 ++--
...QueryNodeRestartDistributedJoinSelfTest.java | 104 +++++++++++--------
2 files changed, 78 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/43eefb0c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index c584066..081a27c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.database.CacheDataRow;
-import org.apache.ignite.internal.processors.cache.database.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException;
@@ -2897,6 +2896,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
/** */
private GridIterator<CacheDataRow> it;
+ /** Need advance. */
+ private boolean needAdvance;
+
/**
* @param it Iterator.
* @param plc Expiry policy.
@@ -2925,24 +2927,31 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
this.keepBinary = keepBinary;
expiryPlc = cctx.cache().expiryPolicy(plc);
- advance();
+ needAdvance = true;
}
/** {@inheritDoc} */
@Override public boolean onHasNext() {
+ if (needAdvance) {
+ advance();
+
+ needAdvance = false;
+ }
+
return next != null;
}
/** {@inheritDoc} */
@Override public IgniteBiTuple<K, V> onNext() {
+ if (needAdvance)
+ advance();
+ else
+ needAdvance = true;
+
if (next == null)
throw new NoSuchElementException();
- IgniteBiTuple<K, V> next0 = next;
-
- advance();
-
- return next0;
+ return next;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/43eefb0c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartDistributedJoinSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartDistributedJoinSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartDistributedJoinSelfTest.java
index ced28bc..d022b0f 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartDistributedJoinSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartDistributedJoinSelfTest.java
@@ -103,72 +103,86 @@ public class IgniteCacheQueryNodeRestartDistributedJoinSelfTest extends IgniteCa
final AtomicInteger qryCnt = new AtomicInteger();
final AtomicBoolean qrysDone = new AtomicBoolean();
+ final AtomicBoolean fail = new AtomicBoolean();
+
IgniteInternalFuture<?> fut1 = multithreadedAsync(new CAX() {
@Override public void applyx() throws IgniteCheckedException {
GridRandom rnd = new GridRandom();
- while (!qrysDone.get()) {
- int g;
+ try {
+ while (!qrysDone.get()) {
+ int g;
- do {
- g = rnd.nextInt(locks.length());
- }
- while (!locks.compareAndSet(g, 0, 1));
+ do {
+ g = rnd.nextInt(locks.length());
- if (rnd.nextBoolean()) {
- IgniteCache<?, ?> cache = grid(g).cache("pu");
+ if (fail.get())
+ return;
+ }
+ while (!locks.compareAndSet(g, 0, 1));
- SqlFieldsQuery qry;
+ if (rnd.nextBoolean()) {
+ IgniteCache<?, ?> cache = grid(g).cache("pu");
- if (broadcastQry)
- qry = new SqlFieldsQuery(QRY_0_BROADCAST).setDistributedJoins(true).setEnforceJoinOrder(true);
- else
- qry = new SqlFieldsQuery(QRY_0).setDistributedJoins(true);
+ SqlFieldsQuery qry;
- boolean smallPageSize = rnd.nextBoolean();
+ if (broadcastQry)
+ qry = new SqlFieldsQuery(QRY_0_BROADCAST).setDistributedJoins(true).setEnforceJoinOrder(true);
+ else
+ qry = new SqlFieldsQuery(QRY_0).setDistributedJoins(true);
- qry.setPageSize(smallPageSize ? 30 : 1000);
+ boolean smallPageSize = rnd.nextBoolean();
- try {
- assertEquals(pRes, cache.query(qry).getAll());
- }
- catch (CacheException e) {
- assertTrue("On large page size must retry.", smallPageSize);
+ qry.setPageSize(smallPageSize ? 30 : 1000);
+
+ try {
+ assertEquals(pRes, cache.query(qry).getAll());
+ }
+ catch (CacheException e) {
+ assertTrue("On large page size must retry.", smallPageSize);
- boolean failedOnRemoteFetch = false;
+ boolean failedOnRemoteFetch = false;
- for (Throwable th = e; th != null; th = th.getCause()) {
- if (!(th instanceof CacheException))
- continue;
+ for (Throwable th = e; th != null; th = th.getCause()) {
+ if (!(th instanceof CacheException))
+ continue;
- if (th.getMessage() != null &&
- th.getMessage().startsWith("Failed to fetch data from node:")) {
- failedOnRemoteFetch = true;
+ if (th.getMessage() != null &&
+ th.getMessage().startsWith("Failed to fetch data from node:")) {
+ failedOnRemoteFetch = true;
- break;
+ break;
+ }
}
- }
- if (!failedOnRemoteFetch) {
- e.printStackTrace();
+ if (!failedOnRemoteFetch) {
+ e.printStackTrace();
- fail("Must fail inside of GridResultPage.fetchNextPage or subclass.");
+ fail("Must fail inside of GridResultPage.fetchNextPage or subclass.");
+ }
}
}
- }
- else {
- IgniteCache<?, ?> cache = grid(g).cache("co");
+ else {
+ IgniteCache<?, ?> cache = grid(g).cache("co");
- assertEquals(rRes, cache.query(qry1).getAll());
- }
+ assertEquals(rRes, cache.query(qry1).getAll());
+ }
- locks.set(g, 0);
+ locks.set(g, 0);
- int c = qryCnt.incrementAndGet();
+ int c = qryCnt.incrementAndGet();
- if (c % logFreq == 0)
- info("Executed queries: " + c);
+ if (c % logFreq == 0)
+ info("Executed queries: " + c);
+ }
+ }catch (Throwable e){
+ e.printStackTrace();
+
+ error("Got exception: " + e.getMessage());
+
+ fail.set(true);
}
+
}
}, qryThreadNum, "query-thread");
@@ -186,6 +200,9 @@ public class IgniteCacheQueryNodeRestartDistributedJoinSelfTest extends IgniteCa
do {
g = rnd.nextInt(locks.length());
+
+ if (fail.get())
+ return null;
}
while (!locks.compareAndSet(g, 0, -1));
@@ -215,7 +232,7 @@ public class IgniteCacheQueryNodeRestartDistributedJoinSelfTest extends IgniteCa
Thread.sleep(duration);
- info("Stopping..");
+ info("Stopping...");
restartsDone.set(true);
qrysDone.set(true);
@@ -223,6 +240,9 @@ public class IgniteCacheQueryNodeRestartDistributedJoinSelfTest extends IgniteCa
fut2.get();
fut1.get();
+ if (fail.get())
+ fail("See message above");
+
info("Stopped.");
}
}
\ No newline at end of file