Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D027D17215 for ; Tue, 12 May 2015 12:00:08 +0000 (UTC) Received: (qmail 7961 invoked by uid 500); 12 May 2015 12:00:08 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 7930 invoked by uid 500); 12 May 2015 12:00:08 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 7921 invoked by uid 99); 12 May 2015 12:00:08 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 12:00:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 3EB95C0DF2 for ; Tue, 12 May 2015 12:00:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id fA6DgPn2sKzV for ; Tue, 12 May 2015 12:00:06 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id DB2DC20D7C for ; Tue, 12 May 2015 12:00:04 +0000 (UTC) Received: (qmail 7917 invoked by uid 99); 12 May 2015 12:00:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 12:00:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C76E6E17E7; Tue, 12 May 2015 12:00:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Tue, 12 May 2015 12:00:07 -0000 Message-Id: <8e885b3822414279b5a85afb309479ad@git.apache.org> In-Reply-To: <26866d85ec064672b4bf298aecd81514@git.apache.org> References: <26866d85ec064672b4bf298aecd81514@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/5] incubator-ignite git commit: # ignite-373 # ignite-373 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ceb28354 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ceb28354 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ceb28354 Branch: refs/heads/ignite-373 Commit: ceb283542744a8a51fadc1ea9f70de1cfd7b024f Parents: bf78538 Author: sboikov Authored: Tue May 12 14:53:53 2015 +0300 Committer: sboikov Committed: Tue May 12 14:57:05 2015 +0300 ---------------------------------------------------------------------- .../GridDistributedCacheAdapter.java | 43 +++--- .../CacheContinuousQueryRestartSelfTest.java | 145 ------------------- ...ridCacheContinuousQueryAbstractSelfTest.java | 4 +- .../IgniteCacheQuerySelfTestSuite.java | 1 - 4 files changed, 21 insertions(+), 172 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ceb28354/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java index 91b7be8..d10ab56 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java @@ -314,33 +314,31 @@ public abstract class GridDistributedCacheAdapter extends GridCacheAdapter dataLdr.receiver(DataStreamerCacheUpdaters.batched()); - for (int part = 0; part < dht.affinity().partitions(); ++part) { - if (ctx.affinity().belongs(ctx.localNode(), part, topVer)) { - GridDhtLocalPartition locPart = dht.topology().localPartition(part, topVer, false); - - if (locPart == null || locPart.state() != OWNING || !locPart.reserve()) - return false; - - try { - if (!locPart.isEmpty() && locPart.primary(topVer)) { - for (GridDhtCacheEntry o : locPart.entries()) { - if (!o.obsoleteOrDeleted()) - dataLdr.removeDataInternal(o.key()); - } - } + for (int part : ctx.affinity().primaryPartitions(ctx.localNodeId(), topVer)) { + GridDhtLocalPartition locPart = dht.topology().localPartition(part, topVer, false); - GridCloseableIterator> iter = - ctx.swap().iterator(part); + if (locPart == null || locPart.state() != OWNING || !locPart.reserve()) + return false; - if (iter != null) { - for (Map.Entry e : iter) - dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey())); + try { + if (!locPart.isEmpty()) { + for (GridDhtCacheEntry o : locPart.entries()) { + if (!o.obsoleteOrDeleted()) + dataLdr.removeDataInternal(o.key()); } } - finally { - locPart.release(); + + GridCloseableIterator> iter = + ctx.swap().iterator(part); + + if (iter != null) { + for (Map.Entry e : iter) + dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey())); } } + finally { + locPart.release(); + } } } @@ -357,9 +355,6 @@ public abstract class GridDistributedCacheAdapter extends GridCacheAdapter ctx.gate().leave(); } - if (!ctx.affinity().affinityTopologyVersion().equals(topVer)) - return false; - return true; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ceb28354/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRestartSelfTest.java deleted file mode 100644 index bd03489..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRestartSelfTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.query.continuous; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.query.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.marshaller.optimized.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.testframework.*; -import org.apache.ignite.testframework.junits.common.*; -import org.jsr166.*; - -import javax.cache.*; -import javax.cache.event.*; - -import java.util.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.cache.CacheRebalanceMode.*; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; - -/** - * Continuous queries test. - */ -public class CacheContinuousQueryRestartSelfTest extends GridCommonAbstractTest { - /** IP finder. */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - - /** Grid count. */ - private static final int GRID_COUNT = 3; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(CacheMode.PARTITIONED); - cacheCfg.setBackups(2); - cacheCfg.setRebalanceMode(ASYNC); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cacheCfg.setReadThrough(true); - cacheCfg.setWriteThrough(true); - cacheCfg.setCacheStoreFactory(new GridCacheContinuousQueryAbstractSelfTest.StoreFactory()); - cacheCfg.setLoadPreviousValue(true); - - cfg.setCacheConfiguration(cacheCfg); - - TcpDiscoverySpi disco = new TcpDiscoverySpi(); - - disco.setIpFinder(IP_FINDER); - - cfg.setDiscoverySpi(disco); - - cfg.setMarshaller(new OptimizedMarshaller(false)); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - startGrids(GRID_COUNT); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @throws Exception If failed. - */ - public void testNodeJoin() throws Exception { - final ContinuousQuery qry = new ContinuousQuery<>(); - - final Collection> all = new ConcurrentLinkedDeque8<>(); - - qry.setLocalListener(new CacheEntryUpdatedListener() { - @Override public void onUpdated(Iterable> evts) { - for (CacheEntryEvent evt : evts) - all.add(evt); - } - }); - - final AtomicInteger id = new AtomicInteger(GRID_COUNT); - - final int keyCount = 1000; - - final Random random = new Random(keyCount); - - IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Runnable() { - @Override public void run() { - for (int i = 0; i < 2; ++i) { - IgniteCache cache = grid(0).cache(null); - - int gridId = id.getAndIncrement(); - - try (QueryCursor> ignored = grid(0).cache(null).query(qry)) { - cache.put(0, 0); - - startGrid(gridId); - - for (int j = 1; j < 40; j++) - cache.put(random.nextInt(), j); - } - catch (Exception e) { - throw new IgniteException(e); - } - } - } - }, 5, "QueryThread"); - - fut.get(); - - for (int i = 0; i < id.get(); i++) { - IgniteCache cache = grid(i).cache(null); - - cache.removeAll(); - } - - for (int i = 0; i < GRID_COUNT; i++) - assertEquals("Cache is not empty [entrySet=" + grid(i).cache(null).localEntries() + - ", i=" + i + ']', 0, grid(i).cache(null).localSize()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ceb28354/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 86f6c9c..5a78f9f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -993,7 +993,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo /** * */ - public static class StoreFactory implements Factory { + private static class StoreFactory implements Factory { @Override public CacheStore create() { return new TestStore(); } @@ -1002,7 +1002,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo /** * Store. */ - public static class TestStore extends CacheStoreAdapter { + private static class TestStore extends CacheStoreAdapter { /** {@inheritDoc} */ @Override public void loadCache(IgniteBiInClosure clo, Object... args) { for (int i = 0; i < 10; i++) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ceb28354/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java index c781193..f42963a 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java @@ -93,7 +93,6 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite { suite.addTestSuite(GridCacheContinuousQueryAtomicSelfTest.class); suite.addTestSuite(GridCacheContinuousQueryAtomicNearEnabledSelfTest.class); suite.addTestSuite(GridCacheContinuousQueryAtomicP2PDisabledSelfTest.class); - suite.addTestSuite(CacheContinuousQueryRestartSelfTest.class); // Reduce fields queries. suite.addTestSuite(GridCacheReduceFieldsQueryLocalSelfTest.class);