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/09 12:11:20 UTC
ignite git commit: IgniteCacheLockPartitionOnAffinityRunTest: fixed
test to properly iterate over cache data.
Repository: ignite
Updated Branches:
refs/heads/ignite-3477 c42fc65f3 -> 715821b29
IgniteCacheLockPartitionOnAffinityRunTest: fixed test to properly iterate over cache data.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/715821b2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/715821b2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/715821b2
Branch: refs/heads/ignite-3477
Commit: 715821b29cad0b33dd0dac1ce7aff2b511898cb6
Parents: c42fc65
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jan 9 15:11:25 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jan 9 15:11:25 2017 +0300
----------------------------------------------------------------------
...niteCacheLockPartitionOnAffinityRunTest.java | 36 ++++++++++++++------
1 file changed, 26 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/715821b2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
index 168b25c..c61413f 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
@@ -30,13 +30,14 @@ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJobMasterLeaveAware;
import org.apache.ignite.compute.ComputeTaskSession;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.database.CacheDataRow;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteRunnable;
@@ -81,10 +82,16 @@ public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPa
.localPartition(part, AffinityTopologyVersion.NONE, false);
int cnt = 0;
- for (GridCacheMapEntry e : pOrgs.entries()) {
- Integer k = (Integer)e.keyValue(false);
- Organization org = e.val.value(ignite.context().cacheObjects().contextForCache(
- cacheAdapterOrg.cacheCfg), false);
+
+ GridCursor<? extends CacheDataRow> c = pOrgs.dataStore().cursor();
+
+ CacheObjectContext ctx = cacheAdapterOrg.context().cacheObjectContext();
+
+ while (c.next()) {
+ CacheDataRow e = c.get();
+
+ Integer k = e.key().value(ctx, false);
+ Organization org = e.value().value(ctx, false);
if (org != null && org.getId() == orgId)
++cnt;
@@ -111,10 +118,16 @@ public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPa
.localPartition(part, AffinityTopologyVersion.NONE, false);
int cnt = 0;
- for (GridCacheMapEntry e : pPers.entries()) {
- Person.Key k = (Person.Key)e.keyValue(false);
- Person p = e.val.value(ignite.context().cacheObjects().contextForCache(
- cacheAdapterPers.cacheCfg), false);
+
+ GridCursor<? extends CacheDataRow> c = pPers.dataStore().cursor();
+
+ CacheObjectContext ctx = cacheAdapterPers.context().cacheObjectContext();
+
+ while (c.next()) {
+ CacheDataRow e = c.get();
+
+ Person.Key k = e.key().value(ctx, false);
+ Person p = e.value().value(ctx, false);
if (p != null && p.getOrgId() == orgId && k.orgId == orgId)
++cnt;
@@ -317,12 +330,15 @@ public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPa
return getPersonsCountMultipleCache(ignite, log, orgId);
}
};
- // Run restart threads: start re-balancing
+
+ // Run restart threads: start re-balancing.
beginNodesRestart();
IgniteInternalFuture<Long> affFut = null;
+
try {
final AtomicInteger threadNum = new AtomicInteger(0);
+
affFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
@Override public void run() {
if (threadNum.getAndIncrement() % 2 == 0) {