http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java deleted file mode 100644 index ead2f3b..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockFailoverSelfTest.java +++ /dev/null @@ -1,533 +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; - -import com.google.common.collect.*; -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -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.spi.failover.*; -import org.apache.ignite.spi.failover.always.*; -import org.apache.ignite.testframework.junits.common.*; - -import java.util.*; -import java.util.concurrent.*; - -import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; - -/** - * Tests group lock transaction failover. - */ -public class GridCacheGroupLockFailoverSelfTest extends GridCommonAbstractTest { - /** IP finder. */ - private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); - - /** Size of the test map. */ - private static final int TEST_MAP_SIZE = 200000; - - /** Cache name. */ - private static final String CACHE_NAME = "partitioned"; - - /** Size of data chunk, sent to a remote node. */ - private static final int DATA_CHUNK_SIZE = 1000; - - /** Number of chunk on which to fail worker node. */ - public static final int FAIL_ON_CHUNK_NO = (TEST_MAP_SIZE / DATA_CHUNK_SIZE) / 3; - - /** */ - private static final int FAILOVER_PUSH_GAP = 30; - - /** Master node name. */ - private static final String MASTER = "master"; - - /** Near enabled flag. */ - private boolean nearEnabled; - - /** Backups count. */ - private int backups; - - /** Filter to include only worker nodes. */ - private static final IgnitePredicate<ClusterNode> workerNodesFilter = new PN() { - @SuppressWarnings("unchecked") - @Override public boolean apply(ClusterNode n) { - return "worker".equals(n.attribute("segment")); - } - }; - - /** - * Result future queue (restrict the queue size - * to 50 in order to prevent in-memory data grid from over loading). - */ - private final BlockingQueue<ComputeTaskFuture<?>> resQueue = new LinkedBlockingQueue<>(10); - - /** - * @return {@code True} if test should use optimistic transactions. - */ - protected boolean optimisticTx() { - return false; - } - - /** - * @throws Exception If failed. - */ - public void testPutAllFailoverGroupLockNearEnabledOneBackup() throws Exception { - checkPutAllFailoverGroupLock(true, 3, 1); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllFailoverGroupLockNearDisabledOneBackup() throws Exception { - checkPutAllFailoverGroupLock(false, 3, 1); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllFailoverGroupLockNearEnabledTwoBackups() throws Exception { - checkPutAllFailoverGroupLock(true, 5, 2); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllFailoverGroupLockNearDisabledTwoBackups() throws Exception { - checkPutAllFailoverGroupLock(false, 5, 2); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllFailoverGroupLockNearEnabledThreeBackups() throws Exception { - checkPutAllFailoverGroupLock(true, 7, 3); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllFailoverGroupLockNearDisabledThreeBackups() throws Exception { - checkPutAllFailoverGroupLock(false, 7, 3); - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return super.getTestTimeout() * 5; - } - - /** - * Tests putAll() method along with failover and cache backup. - * - * Checks that the resulting primary cache size is the same as - * expected. - * - * @param near {@code True} for near enabled. - * @param workerCnt Workers count. - * @param shutdownCnt Shutdown count. - * @throws Exception If failed. - */ - public void checkPutAllFailoverGroupLock(boolean near, int workerCnt, int shutdownCnt) throws Exception { - nearEnabled = near; - backups = shutdownCnt; - - Collection<Integer> testKeys = generateTestKeys(); - - Ignite master = startGrid(MASTER); - - List<Ignite> workers = new ArrayList<>(workerCnt); - - for (int i = 1; i <= workerCnt; i++) - workers.add(startGrid("worker" + i)); - - info("Master: " + master.cluster().localNode().id()); - - List<Ignite> runningWorkers = new ArrayList<>(workerCnt); - - for (int i = 1; i <= workerCnt; i++) { - UUID id = workers.get(i - 1).cluster().localNode().id(); - - info(String.format("Worker%d: %s", i, id)); - - runningWorkers.add(workers.get(i - 1)); - } - - try { - // Dummy call to fetch affinity function from remote node - master.cluster().mapKeyToNode(CACHE_NAME, "Dummy"); - - Map<UUID, Collection<Integer>> dataChunks = new HashMap<>(); - - int chunkCntr = 0; - - int failoverPushGap = 0; - - for (Integer key : testKeys) { - ClusterNode mappedNode = master.cluster().mapKeyToNode(CACHE_NAME, key); - - UUID nodeId = mappedNode.id(); - - Collection<Integer> data = dataChunks.get(nodeId); - - if (data == null) { - data = new ArrayList<>(DATA_CHUNK_SIZE); - - dataChunks.put(nodeId, data); - } - - data.add(key); - - if (data.size() == DATA_CHUNK_SIZE) { // time to send data - chunkCntr++; - - info("Pushing data chunk: " + chunkCntr); - - submitDataChunk(master, nodeId, data); - - data = new ArrayList<>(DATA_CHUNK_SIZE); - - dataChunks.put(nodeId, data); - - if (chunkCntr >= FAIL_ON_CHUNK_NO) { - if (workerCnt - runningWorkers.size() < shutdownCnt) { - if (failoverPushGap > 0) - failoverPushGap--; - else { - Ignite victim = runningWorkers.remove(0); - - info("Shutting down node: " + victim.cluster().localNode().id()); - - stopGrid(victim.name()); - - // Fail next node after some jobs have been pushed. - failoverPushGap = FAILOVER_PUSH_GAP; - } - } - } - } - } - - // Submit the rest of data. - for (Map.Entry<UUID, Collection<Integer>> entry : dataChunks.entrySet()) - submitDataChunk(master, entry.getKey(), entry.getValue()); - - // Wait for queue to empty. - info("Waiting for empty queue..."); - - long seenSize = resQueue.size(); - - while (true) { - U.sleep(10000); - - if (!resQueue.isEmpty()) { - long size = resQueue.size(); - - if (seenSize == size) { - info(">>> Failed to wait for queue to empty."); - - break; - } - - seenSize = size; - } - else - break; - } - - Collection<Integer> absentKeys = findAbsentKeys(runningWorkers.get(0), testKeys); - - info(">>> Absent keys: " + absentKeys); - - assertTrue(absentKeys.isEmpty()); - - // Actual primary cache size. - int primaryCacheSize = 0; - - for (Ignite g : runningWorkers) { - info(">>>>> " + g.jcache(CACHE_NAME).localSize()); - - primaryCacheSize += ((IgniteKernal)g).internalCache(CACHE_NAME).primarySize(); - } - - assertTrue(TEST_MAP_SIZE <= primaryCacheSize); - } - finally { - stopAllGrids(); - } - } - - /** - * Does remapping. - * @param master Master grid. - * @param keys Keys. - * @throws IgniteCheckedException If failed. - */ - private void remap(final Ignite master, Iterable<Integer> keys) throws IgniteCheckedException { - Map<UUID, Collection<Integer>> dataChunks = new HashMap<>(); - - for (Integer key : keys) { - ClusterNode mappedNode = master.cluster().mapKeyToNode(CACHE_NAME, key); - - UUID nodeId = mappedNode.id(); - - Collection<Integer> data = dataChunks.get(nodeId); - - if (data == null) { - data = new ArrayList<>(DATA_CHUNK_SIZE); - - dataChunks.put(nodeId, data); - } - - data.add(key); - } - - for (Map.Entry<UUID, Collection<Integer>> entry : dataChunks.entrySet()) - submitDataChunk(master, entry.getKey(), entry.getValue()); - } - - /** - * Submits next data chunk as grid task. Blocks if queue is full. - * - * @param master Master node to submit from. - * @param preferredNodeId Node id to execute job on. - * @param dataChunk Data chunk to put in cache. - * @throws IgniteCheckedException If failed. - */ - private void submitDataChunk(final Ignite master, UUID preferredNodeId, final Collection<Integer> dataChunk) - throws IgniteCheckedException { - ClusterGroup prj = master.cluster().forPredicate(workerNodesFilter); - - IgniteCompute comp = master.compute(prj).withAsync(); - - comp.execute(new GridCacheGroupLockPutTask(preferredNodeId, CACHE_NAME, optimisticTx()), dataChunk); - - ComputeTaskFuture<Void> fut = comp.future(); - - fut.listenAsync(new CI1<IgniteFuture<Void>>() { - @Override public void apply(IgniteFuture<Void> f) { - ComputeTaskFuture taskFut = (ComputeTaskFuture)f; - - boolean fail = false; - - try { - f.get(); //if something went wrong - we'll get exception here - } - catch (IgniteException ignore) { - info("Put task failed, going to remap keys: " + dataChunk.size()); - - fail = true; - } - finally { - // Remove complete future from queue to allow other jobs to proceed. - resQueue.remove(taskFut); - - try { - if (fail) - remap(master, dataChunk); - } - catch (IgniteCheckedException e) { - info("Failed to remap task [data=" + dataChunk.size() + ", e=" + e + ']'); - } - } - } - }); - - try { - resQueue.put(fut); - - if (fut.isDone()) - resQueue.remove(fut); - } - catch (InterruptedException ignored) { - info(">>>> Failed to wait for future submission: " + fut); - - Thread.currentThread().interrupt(); - } - } - - /** - * Tries to find keys, that are absent in cache. - * - * @param workerNode Worker node. - * @param keys Keys that are suspected to be absent - * @return List of absent keys. If no keys are absent, the list is empty. - * @throws IgniteCheckedException If error occurs. - */ - private Collection<Integer> findAbsentKeys(Ignite workerNode, - Collection<Integer> keys) throws IgniteCheckedException { - - Collection<Integer> ret = new ArrayList<>(keys.size()); - - IgniteCache<Object, Object> cache = workerNode.jcache(CACHE_NAME); - - for (Integer key : keys) { - if (cache.get(key) == null) // Key is absent. - ret.add(key); - } - - return ret; - } - - /** - * Generates a test keys collection. - * - * @return A test keys collection. - */ - private Collection<Integer> generateTestKeys() { - Collection<Integer> ret = new ArrayList<>(TEST_MAP_SIZE); - - for (int i = 0; i < TEST_MAP_SIZE; i++) - ret.add(i); - - return ret; - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setPeerClassLoadingEnabled(false); - - cfg.setDeploymentMode(DeploymentMode.CONTINUOUS); - - TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi(); - - discoverySpi.setAckTimeout(60000); - discoverySpi.setIpFinder(ipFinder); - - cfg.setDiscoverySpi(discoverySpi); - - if (gridName.startsWith("master")) { - cfg.setUserAttributes(ImmutableMap.of("segment", "master")); - - GridTestFailoverSpi failoverSpi = new GridTestFailoverSpi(true, (IgnitePredicate)workerNodesFilter); - - // For sure. - failoverSpi.setMaximumFailoverAttempts(50); - - cfg.setFailoverSpi(failoverSpi); - } - else if (gridName.startsWith("worker")) { - GridTestFailoverSpi failoverSpi = new GridTestFailoverSpi(false); - - cfg.setFailoverSpi(failoverSpi); - - cfg.setUserAttributes(ImmutableMap.of("segment", "worker")); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - cacheCfg.setName("partitioned"); - cacheCfg.setCacheMode(CacheMode.PARTITIONED); - cacheCfg.setStartSize(4500000); - cacheCfg.setBackups(backups); - cacheCfg.setStoreValueBytes(true); - cacheCfg.setDistributionMode(nearEnabled ? NEAR_PARTITIONED : PARTITIONED_ONLY); - cacheCfg.setQueryIndexEnabled(false); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cacheCfg.setAtomicityMode(TRANSACTIONAL); - - cfg.setCacheConfiguration(cacheCfg); - } - else - throw new IllegalStateException("Unexpected grid name: " + gridName); - - return cfg; - } - - /** - * Test failover SPI that remembers the job contexts of failed jobs. - */ - private class GridTestFailoverSpi extends AlwaysFailoverSpi { - /** */ - private static final String FAILOVER_NUMBER_ATTR = "failover:number:attr"; - - /** */ - private final boolean master; - - /** */ - private Set<ComputeJobContext> failedOverJobs = new HashSet<>(); - - /** Node filter. */ - private IgnitePredicate<? super ClusterNode>[] filter; - - /** - * @param master Master flag. - * @param filter Filters. - */ - @SafeVarargs - GridTestFailoverSpi(boolean master, IgnitePredicate<? super ClusterNode>... filter) { - this.master = master; - this.filter = filter; - } - - /** {@inheritDoc} */ - @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) { - List<ClusterNode> cp = null; - if (master) { - failedOverJobs.add(ctx.getJobResult().getJobContext()); - - // Clear failed nodes list - allow to failover on the same node. - ctx.getJobResult().getJobContext().setAttribute(FAILED_NODE_LIST_ATTR, null); - - // Account for maximum number of failover attempts since we clear failed node list. - Integer failoverCnt = ctx.getJobResult().getJobContext().getAttribute(FAILOVER_NUMBER_ATTR); - - if (failoverCnt == null) - ctx.getJobResult().getJobContext().setAttribute(FAILOVER_NUMBER_ATTR, 1); - else { - if (failoverCnt >= getMaximumFailoverAttempts()) { - info("Job failover failed because number of maximum failover attempts is exceeded " + - "[failedJob=" + ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + - getMaximumFailoverAttempts() + ']'); - - return null; - } - - ctx.getJobResult().getJobContext().setAttribute(FAILOVER_NUMBER_ATTR, failoverCnt + 1); - } - - cp = new ArrayList<>(top); - - // Keep collection type. - F.retain(cp, false, new IgnitePredicate<ClusterNode>() { - @Override public boolean apply(ClusterNode node) { - return F.isAll(node, filter); - } - }); - } - - return super.failover(ctx, cp); //use cp to ensure we don't failover on failed node - } - - /** - * @return Job contexts for failed over jobs. - */ - public Set<ComputeJobContext> getFailedOverJobs() { - return failedOverJobs; - } - } -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockMultiNodeAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockMultiNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockMultiNodeAbstractSelfTest.java deleted file mode 100644 index f581a0a..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockMultiNodeAbstractSelfTest.java +++ /dev/null @@ -1,28 +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; - -/** - * Abstract test for multi-node group lock tests. - */ -public abstract class GridCacheGroupLockMultiNodeAbstractSelfTest extends GridCacheGroupLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 3; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockPutTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockPutTask.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockPutTask.java deleted file mode 100644 index 5c96fcc..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockPutTask.java +++ /dev/null @@ -1,161 +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; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.resources.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; - -/** - * Puts all the passed data into partitioned cache in small chunks. - */ -class GridCacheGroupLockPutTask extends ComputeTaskAdapter<Collection<Integer>, Void> { - /** Preferred node. */ - private final UUID preferredNode; - - /** Cache name. */ - private final String cacheName; - - /** Optimistic transaction flag. */ - private final boolean optimistic; - - /** - * - * @param preferredNode A node that we'd prefer to take from grid. - * @param cacheName A name of the cache to work with. - * @param optimistic Optimistic transaction flag. - */ - GridCacheGroupLockPutTask(UUID preferredNode, String cacheName, boolean optimistic) { - this.preferredNode = preferredNode; - this.cacheName = cacheName; - this.optimistic = optimistic; - } - - /** - * This method is called to map or split grid task into multiple grid jobs. This is the first method that gets called - * when task execution starts. - * - * @param data Task execution argument. Can be {@code null}. This is the same argument as the one passed into {@code - * Grid#execute(...)} methods. - * @param subgrid Nodes available for this task execution. Note that order of nodes is guaranteed to be randomized by - * container. This ensures that every time you simply iterate through grid nodes, the order of nodes - * will be random which over time should result into all nodes being used equally. - * @return Map of grid jobs assigned to subgrid node. Unless {@link org.apache.ignite.compute.ComputeTaskContinuousMapper} is injected into task, if - * {@code null} or empty map is returned, exception will be thrown. - * @throws IgniteCheckedException If mapping could not complete successfully. This exception will be thrown out of {@link - * org.apache.ignite.compute.ComputeTaskFuture#get()} method. - */ - @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, - @Nullable final Collection<Integer> data) { - assert !subgrid.isEmpty(); - - // Give preference to wanted node. Otherwise, take the first one. - ClusterNode targetNode = F.find(subgrid, subgrid.get(0), new IgnitePredicate<ClusterNode>() { - @Override public boolean apply(ClusterNode e) { - return preferredNode.equals(e.id()); - } - }); - - return Collections.singletonMap( - new ComputeJobAdapter() { - @LoggerResource - private IgniteLogger log; - - @IgniteInstanceResource - private Ignite ignite; - - @Override public Object execute() { - try { - log.info("Going to put data: " + data.size()); - - IgniteCache<Object, Object> cache = ignite.jcache(cacheName); - - assert cache != null; - - Map<Integer, T2<Integer, Collection<Integer>>> putMap = groupData(data); - - for (Map.Entry<Integer, T2<Integer, Collection<Integer>>> entry : putMap.entrySet()) { - T2<Integer, Collection<Integer>> pair = entry.getValue(); - - Object affKey = pair.get1(); - - // Group lock partition. - try (IgniteTx tx = ignite.transactions().txStartPartition(cacheName, - ignite.affinity(cacheName).partition(affKey), optimistic ? OPTIMISTIC : PESSIMISTIC, - REPEATABLE_READ, 0, pair.get2().size())) { - for (Integer val : pair.get2()) - cache.put(val, val); - - tx.commit(); - } - } - - log.info("Finished put data: " + data.size()); - - return data; - } - catch (Exception e) { - throw new IgniteException(e); - } - } - - /** - * Groups values by partitions. - * - * @param data Data to put. - * @return Grouped map. - */ - private Map<Integer, T2<Integer, Collection<Integer>>> groupData(Iterable<Integer> data) { - Map<Integer, T2<Integer, Collection<Integer>>> res = new HashMap<>(); - - for (Integer val : data) { - int part = ignite.affinity(cacheName).partition(val); - - T2<Integer, Collection<Integer>> tup = res.get(part); - - if (tup == null) { - tup = new T2<Integer, Collection<Integer>>(val, new LinkedList<Integer>()); - - res.put(part, tup); - } - - tup.get2().add(val); - } - - return res; - } - }, - targetNode); - } - - /** {@inheritDoc} */ - @Nullable @Override public Void reduce(List<ComputeJobResult> results) { - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockColocatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockColocatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockColocatedSelfTest.java deleted file mode 100644 index 949d658..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockColocatedSelfTest.java +++ /dev/null @@ -1,38 +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.distributed.dht; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.*; - -import static org.apache.ignite.cache.CacheMode.*; - -/** - * Group lock test for colocated cache. - */ -public class GridCacheGroupLockColocatedSelfTest extends GridCacheGroupLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - return false; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockMultiNodeColocatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockMultiNodeColocatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockMultiNodeColocatedSelfTest.java deleted file mode 100644 index f1ca6bc..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockMultiNodeColocatedSelfTest.java +++ /dev/null @@ -1,29 +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.distributed.dht; - -/** - * Multi node group lock test for colocated cache. - */ -public class GridCacheGroupLockMultiNodeColocatedSelfTest extends - GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - return false; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java deleted file mode 100644 index a5d7e71..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java +++ /dev/null @@ -1,137 +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.distributed.dht; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.testframework.*; -import org.apache.ignite.transactions.*; - -import javax.cache.*; -import java.util.*; -import java.util.concurrent.*; - -import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; - -/** - * Group lock abstract test for partitioned cache. - */ -public abstract class GridCacheGroupLockPartitionedAbstractSelfTest extends GridCacheGroupLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - public void testUpdateEntryPessimisticReadCommitted() throws Exception { - checkUpdateEntry(PESSIMISTIC, READ_COMMITTED); - } - - /** - * @throws Exception If failed. - */ - public void testUpdateEntryPessimisticRepeatableRead() throws Exception { - checkUpdateEntry(PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - public void testUpdateEntryOptimisticReadCommitted() throws Exception { - checkUpdateEntry(OPTIMISTIC, READ_COMMITTED); - } - - /** - * @throws Exception If failed. - */ - public void testUpdateEntryOptimisticRepeatableRead() throws Exception { - checkUpdateEntry(OPTIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - private void checkUpdateEntry(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) throws Exception { - UUID affinityKey = primaryKeyForCache(grid(0)); - - GridCache<CacheAffinityKey<Integer>, Integer> cache = cache(0); - - assert cache.isEmpty(); - - // Put initial values. - for (int i = 0; i < 10; i++) - cache.put(new CacheAffinityKey<>(i, affinityKey), i); - - for (int i = 0; i < 3; i++) { - try (IgniteTx tx = ignite(0).transactions().txStartAffinity(null, affinityKey, concurrency, isolation, 0, 10)) { - Set<Cache.Entry<CacheAffinityKey<Integer>, Integer>> set = - cache.entrySet(ignite(0).affinity(null).partition(affinityKey)); - - for (Cache.Entry<CacheAffinityKey<Integer>, Integer> entry : set) { - Integer old = entry.getValue(); - - if (old != null) - cache.putx(entry.getKey(), old + 1); - else { - Object key = entry.getKey(); - - assert key.equals(affinityKey); - } - } - - tx.commit(); - } - } - } - - /** - * @throws Exception If failed. - */ - public void testGroupLockWrongPartition() throws Exception { - assert cacheMode() == PARTITIONED; - - final UUID affinityKey = primaryKeyForCache(grid(0)); - - final IgniteCache<UUID, String> cache = grid(0).jcache(null); - - try (IgniteTx tx = grid(0).transactions().txStartPartition(null, affinity(cache).partition(affinityKey), - PESSIMISTIC, REPEATABLE_READ, 0, 2)) { - GridTestUtils.assertThrows(log, new Callable<Object>() { - @Override public Object call() throws Exception { - UUID key1; - - do { - key1 = UUID.randomUUID(); - } - while (affinity(cache).partition(key1) == affinity(cache).partition(affinityKey)); - - // Key with affinity key different from enlisted on tx start should raise exception. - cache.put(key1, "val1"); - - return null; - } - }, IgniteCheckedException.class, null); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java deleted file mode 100644 index e66a512..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest.java +++ /dev/null @@ -1,174 +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.distributed.dht; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.transactions.*; - -import java.util.*; - -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; - -/** - * Multi-node test for group locking. - */ -public abstract class GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest extends - GridCacheGroupLockPartitionedAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 3; - } - - /** - * @throws Exception If failed. - */ - public void testNonLocalKeyOptimistic() throws Exception { - checkNonLocalKey(OPTIMISTIC); - } - - /** - * @throws Exception If failed. - */ - public void testNonLocalKeyPessimistic() throws Exception { - checkNonLocalKey(PESSIMISTIC); - } - - /** - * @throws Exception If failed. - */ - private void checkNonLocalKey(IgniteTxConcurrency concurrency) throws Exception { - final UUID key = primaryKeyForCache(grid(1)); - - IgniteCache<Object, Object> cache = grid(0).jcache(null); - - IgniteTx tx = null; - try { - tx = grid(0).transactions().txStartAffinity(null, key, concurrency, READ_COMMITTED, 0, 2); - - cache.put(new CacheAffinityKey<>("1", key), "2"); - - tx.commit(); - - fail("Exception should be thrown."); - } - catch (IgniteException ignored) { - // Expected exception. - } - finally { - if (tx != null) - tx.close(); - - assertNull(grid(0).transactions().tx()); - } - } - - /** - * @throws Exception If failed. - */ - public void testNearReadersUpdateWithAffinityReaderOptimistic() throws Exception { - checkNearReadersUpdate(true, OPTIMISTIC); - } - - /** - * @throws Exception If failed. - */ - public void testNearReadersUpdateWithAffinityReaderPessimistic() throws Exception { - checkNearReadersUpdate(true, PESSIMISTIC); - } - - /** - * @throws Exception If failed. - */ - public void testNearReaderUpdateWithoutAffinityReaderOptimistic() throws Exception { - checkNearReadersUpdate(false, OPTIMISTIC); - } - - /** - * @throws Exception If failed. - */ - public void testNearReaderUpdateWithoutAffinityReaderPessimistic() throws Exception { - checkNearReadersUpdate(false, PESSIMISTIC); - } - - /** - * @throws Exception If failed. - */ - private void checkNearReadersUpdate(boolean touchAffKey, IgniteTxConcurrency concurrency) throws Exception { - UUID affinityKey = primaryKeyForCache(grid(0)); - - CacheAffinityKey<String> key1 = new CacheAffinityKey<>("key1", affinityKey); - CacheAffinityKey<String> key2 = new CacheAffinityKey<>("key2", affinityKey); - CacheAffinityKey<String> key3 = new CacheAffinityKey<>("key3", affinityKey); - - grid(0).jcache(null).put(affinityKey, "aff"); - - IgniteCache<CacheAffinityKey<String>, String> cache = grid(0).jcache(null); - - cache.putAll(F.asMap( - key1, "val1", - key2, "val2", - key3, "val3") - ); - - Ignite reader = null; - - for (int i = 0; i < gridCount(); i++) { - if (!grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), affinityKey)) - reader = grid(i); - } - - assert reader != null; - - info(">>> Reader is " + reader.cluster().localNode().id()); - - // Add reader. - if (touchAffKey) - assertEquals("aff", reader.jcache(null).get(affinityKey)); - - assertEquals("val1", reader.jcache(null).get(key1)); - assertEquals("val2", reader.jcache(null).get(key2)); - assertEquals("val3", reader.jcache(null).get(key3)); - - if (nearEnabled()) { - assertEquals("val1", reader.jcache(null).localPeek(key1, CachePeekMode.ONHEAP)); - assertEquals("val2", reader.jcache(null).localPeek(key2, CachePeekMode.ONHEAP)); - assertEquals("val3", reader.jcache(null).localPeek(key3, CachePeekMode.ONHEAP)); - } - - try (IgniteTx tx = grid(0).transactions() - .txStartAffinity(null, affinityKey, concurrency, READ_COMMITTED, 0, 3)) { - cache.putAll(F.asMap( - key1, "val01", - key2, "val02", - key3, "val03") - ); - - tx.commit(); - } - - if (nearEnabled()) { - assertEquals("val01", reader.jcache(null).localPeek(key1, CachePeekMode.ONHEAP)); - assertEquals("val02", reader.jcache(null).localPeek(key2, CachePeekMode.ONHEAP)); - assertEquals("val03", reader.jcache(null).localPeek(key3, CachePeekMode.ONHEAP)); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java deleted file mode 100644 index b34eab0..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockMultiNodeNearSelfTest.java +++ /dev/null @@ -1,30 +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.distributed.near; - -import org.apache.ignite.internal.processors.cache.distributed.dht.*; - -/** - * Multi-node test for group lock in near cache. - */ -public class GridCacheGroupLockMultiNodeNearSelfTest extends GridCacheGroupLockPartitionedMultiNodeAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockNearSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockNearSelfTest.java deleted file mode 100644 index 1a8fde9..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGroupLockNearSelfTest.java +++ /dev/null @@ -1,38 +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.distributed.near; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.*; - -import static org.apache.ignite.cache.CacheMode.*; - -/** - * Group lock test for near cache. - */ -public class GridCacheGroupLockNearSelfTest extends GridCacheGroupLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - return true; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockMultiNodeReplicatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockMultiNodeReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockMultiNodeReplicatedSelfTest.java deleted file mode 100644 index 7f42570..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockMultiNodeReplicatedSelfTest.java +++ /dev/null @@ -1,45 +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.distributed.replicated; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.*; - -import static org.apache.ignite.cache.CacheMode.*; - -/** - * Multi-node test for group locking in replicated cache. - */ -public class GridCacheGroupLockMultiNodeReplicatedSelfTest extends - GridCacheGroupLockMultiNodeAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - // Near is not defined for replicated cache. - return false; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } - - /** {@inheritDoc} */ - @Override public void testGroupLockWithExternalLockOptimistic() { - // TODO: GG-6333 - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockReplicatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockReplicatedSelfTest.java deleted file mode 100644 index 9cfd78f..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheGroupLockReplicatedSelfTest.java +++ /dev/null @@ -1,39 +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.distributed.replicated; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.*; - -import static org.apache.ignite.cache.CacheMode.*; - -/** - * Single-node test for replicated cache. - */ -public class GridCacheGroupLockReplicatedSelfTest extends GridCacheGroupLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - // Near cache is not defined for replicated cache. - return false; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java index 5d0c06e..e8fa27e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java @@ -222,100 +222,6 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ - public void testGroupLock() throws Exception { - plc = new CacheFifoEvictionPolicy<>(100); - - try { - Ignite g = startGrid(1); - - Integer affKey = 1; - - IgniteCache<CacheAffinityKey<Object>, Integer> cache = g.jcache(null); - - IgniteTx tx = g.transactions().txStartAffinity(cache.getName(), affKey, PESSIMISTIC, REPEATABLE_READ, 0, 5); - - try { - for (int i = 0; i < 5; i++) - cache.put(new CacheAffinityKey<Object>(i, affKey), i); - - tx.commit(); - } - finally { - tx.close(); - } - - assertEquals(5, ((CacheFifoEvictionPolicy)plc).queue().size()); - - tx = g.transactions().txStartAffinity(cache.getName(), affKey, PESSIMISTIC, REPEATABLE_READ, 0, 5); - - try { - for (int i = 0; i < 5; i++) - cache.remove(new CacheAffinityKey<Object>(i, affKey)); - - tx.commit(); - } - finally { - tx.close(); - } - - assertEquals(0, ((CacheFifoEvictionPolicy)plc).queue().size()); - } - finally { - stopAllGrids(); - } - } - - /** - * @throws Exception If failed. - */ - public void testPartitionGroupLock() throws Exception { - plc = new CacheFifoEvictionPolicy<>(100); - - try { - Ignite g = startGrid(1); - - Integer affKey = 1; - - IgniteCache<Object, Integer> cache = g.jcache(null); - - IgniteTx tx = g.transactions().txStartPartition(cache.getName(), - g.affinity(cache.getName()).partition(affKey), PESSIMISTIC, REPEATABLE_READ, 0, 5); - - try { - for (int i = 0; i < 5; i++) - cache.put(new CacheAffinityKey<Object>(i, affKey), i); - - tx.commit(); - } - finally { - tx.close(); - } - - assertEquals(5, ((CacheFifoEvictionPolicy)plc).queue().size()); - - tx = g.transactions().txStartPartition(cache.getName(), g.affinity(cache.getName()).partition(affKey), - PESSIMISTIC, REPEATABLE_READ, 0, 5); - - try { - for (int i = 0; i < 5; i++) - cache.remove(new CacheAffinityKey<Object>(i, affKey)); - - tx.commit(); - } - finally { - tx.close(); - } - - assertEquals(0, ((CacheFifoEvictionPolicy)plc).queue().size()); - } - finally { - stopAllGrids(); - } - } - - /** - * @throws Exception If failed. - */ public void testReload() throws Exception { plc = new CacheFifoEvictionPolicy<Object, Object>(100); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderPerformanceTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderPerformanceTest.java index 23f9289..1945912 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderPerformanceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderPerformanceTest.java @@ -52,9 +52,6 @@ public class GridDataLoaderPerformanceTest extends GridCommonAbstractTest { private boolean useCache; /** */ - private boolean useGrpLock; - - /** */ private String[] vals = new String[2048]; /** {@inheritDoc} */ @@ -120,17 +117,6 @@ public class GridDataLoaderPerformanceTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testPerformance() throws Exception { - useGrpLock = false; - - doTest(); - } - - /** - * @throws Exception If failed. - */ - public void testPerformanceGroupLock() throws Exception { - useGrpLock = true; - doTest(); } @@ -154,8 +140,7 @@ public class GridDataLoaderPerformanceTest extends GridCommonAbstractTest { final IgniteDataLoader<Integer, String> ldr = ignite.dataLoader(null); ldr.perNodeBufferSize(8192); - ldr.updater(useGrpLock ? GridDataLoadCacheUpdaters.<Integer, String>groupLocked() : - GridDataLoadCacheUpdaters.<Integer, String>batchedSorted()); + ldr.updater(GridDataLoadCacheUpdaters.<Integer, String>batchedSorted()); ldr.autoFlushFrequency(0); final LongAdder cnt = new LongAdder(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessorSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessorSelfTest.java index 20a316d..becccdc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessorSelfTest.java @@ -33,6 +33,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; import org.jetbrains.annotations.*; +import javax.cache.Cache; import javax.cache.configuration.*; import java.util.*; import java.util.concurrent.*; @@ -65,9 +66,6 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { private boolean useCache; /** */ - private boolean useGrpLock; - - /** */ private TestStore store; /** {@inheritDoc} */ @@ -141,16 +139,6 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ - public void testPartitionedGroupLock() throws Exception { - mode = PARTITIONED; - useGrpLock = true; - - checkDataLoader(); - } - - /** - * @throws Exception If failed. - */ public void testReplicated() throws Exception { mode = REPLICATED; @@ -160,16 +148,6 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ - public void testReplicatedGroupLock() throws Exception { - mode = REPLICATED; - useGrpLock = true; - - checkDataLoader(); - } - - /** - * @throws Exception If failed. - */ public void testLocal() throws Exception { mode = LOCAL; @@ -195,12 +173,11 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { useCache = true; Ignite g2 = startGrid(2); - Ignite g3 = startGrid(3); + startGrid(3); final IgniteDataLoader<Integer, Integer> ldr = g1.dataLoader(null); - ldr.updater(useGrpLock ? GridDataLoadCacheUpdaters.<Integer, Integer>groupLocked() : - GridDataLoadCacheUpdaters.<Integer, Integer>batchedSorted()); + ldr.updater(GridDataLoadCacheUpdaters.<Integer, Integer>batchedSorted()); final AtomicInteger idxGen = new AtomicInteger(); final int cnt = 400; @@ -242,8 +219,7 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { final IgniteDataLoader<Integer, Integer> rmvLdr = g2.dataLoader(null); - rmvLdr.updater(useGrpLock ? GridDataLoadCacheUpdaters.<Integer, Integer>groupLocked() : - GridDataLoadCacheUpdaters.<Integer, Integer>batchedSorted()); + rmvLdr.updater(GridDataLoadCacheUpdaters.<Integer, Integer>batchedSorted()); final CountDownLatch l2 = new CountDownLatch(threads); @@ -327,16 +303,6 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ - public void testReplicatedMultiThreadedGroupLock() throws Exception { - mode = REPLICATED; - useGrpLock = true; - - checkLoaderMultithreaded(1, 2); - } - - /** - * @throws Exception If failed. - */ public void testPartitionedMultiThreaded() throws Exception { mode = PARTITIONED; @@ -344,16 +310,6 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { } /** - * @throws Exception If failed. - */ - public void testPartitionedMultiThreadedGroupLock() throws Exception { - mode = PARTITIONED; - useGrpLock = true; - - checkLoaderMultithreaded(1, 3); - } - - /** * Tests loader in multithreaded environment with various count of grids started. * * @param nodesCntNoCache How many nodes should be started without cache. @@ -379,8 +335,7 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { // Get and configure loader. final IgniteDataLoader<Integer, Integer> ldr = g1.dataLoader(null); - ldr.updater(useGrpLock ? GridDataLoadCacheUpdaters.<Integer, Integer>groupLocked() : - GridDataLoadCacheUpdaters.<Integer, Integer>individual()); + ldr.updater(GridDataLoadCacheUpdaters.<Integer, Integer>individual()); ldr.perNodeBufferSize(2); // Define count of puts. @@ -862,14 +817,14 @@ public class GridDataLoaderProcessorSelfTest extends GridCommonAbstractTest { /** * */ - private class TestStore extends CacheStoreAdapter<Object, Object> { + private static class TestStore extends CacheStoreAdapter<Object, Object> { /** {@inheritDoc} */ @Nullable @Override public Object load(Object key) { return storeMap.get(key); } /** {@inheritDoc} */ - @Override public void write(javax.cache.Cache.Entry<?, ?> entry) { + @Override public void write(Cache.Entry<?, ?> entry) { storeMap.put(entry.getKey(), entry.getValue()); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAffinityTransactionsOffHeapTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAffinityTransactionsOffHeapTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAffinityTransactionsOffHeapTest.java deleted file mode 100644 index c3e177a..0000000 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAffinityTransactionsOffHeapTest.java +++ /dev/null @@ -1,270 +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.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.configuration.*; -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.transactions.*; - -import java.io.*; -import java.util.*; - -import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.cache.CacheMemoryMode.*; -import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; - -/** - */ -public class GridCacheAffinityTransactionsOffHeapTest { - /** */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - - /** */ - private static final int NODE_CNT = 4; - - /** */ - private static final int THREAD_CNT = 1; - - /** */ - private static final int KEY_CNT = 10; - - /** - * @param args Command line arguments. - * @throws Exception In case of error. - */ - public static void main(String[] args) throws Exception { - startNodes(); - - for (int i = 0; i < KEY_CNT; i++) { - IgniteCache<Object, Integer> c = cache(i); - - c.put((long) i, 0); - c.put(new UserKey(i, 0), 0); - c.put(new UserKey(i, 1), 0); - c.put(new UserKey(i, 2), 0); - } - - assert cache(5).get(5L) != null; - - long key = 5; - - IgniteCache<Object, Integer> c = cache(key); - Ignite ignite = ignite(key); - - try (IgniteTx tx = ignite.transactions().txStartAffinity(c.getName(), key, PESSIMISTIC, REPEATABLE_READ, 0, 0)) { - Integer val = c.get(key); - Integer userVal1 = c.get(new UserKey(key, 0)); - Integer userVal2 = c.get(new UserKey(key, 1)); - Integer userVal3 = c.get(new UserKey(key, 2)); - - assert val != null; - assert userVal1 != null; - assert userVal2 != null; - assert userVal3 != null; - - assert userVal1.equals(val); - assert userVal2.equals(val); - assert userVal3.equals(val); - - int newVal = val + 1; - - c.put(key, newVal); - c.put(new UserKey(key, 0), newVal); - c.put(new UserKey(key, 1), newVal); - c.put(new UserKey(key, 2), newVal); - - tx.commit(); - } - -// final AtomicLong txCnt = new AtomicLong(); -// -// GridTestUtils.runMultiThreaded( -// new Callable<Object>() { -// @Override public Object call() throws Exception { -// Random rnd = new Random(); -// -// while (!Thread.currentThread().isInterrupted()) { -// long key = rnd.nextInt(KEY_CNT); -// -// Cache<Object, Integer> c = cache(key); -// -// try (GridCacheTx tx = c.txStartAffinity(key, PESSIMISTIC, REPEATABLE_READ, 0, 0)) { -// Integer val = c.get(key); -// Integer userVal1 = c.get(new UserKey(key, 0)); -// Integer userVal2 = c.get(new UserKey(key, 1)); -// Integer userVal3 = c.get(new UserKey(key, 2)); -// -// assert val != null; -// assert userVal1 != null; -// assert userVal2 != null; -// assert userVal3 != null; -// -// assert userVal1.equals(val); -// assert userVal2.equals(val); -// assert userVal3.equals(val); -// -// int newVal = val + 1; -// -// c.putx(key, newVal); -// c.putx(new UserKey(key, 0), newVal); -// c.putx(new UserKey(key, 1), newVal); -// c.putx(new UserKey(key, 2), newVal); -// -// tx.commit(); -// } -// -// long txDone = txCnt.incrementAndGet(); -// -// if (txDone % 1000 == 0) -// System.out.println("Transactions done: " + txDone); -// } -// -// return null; -// } -// }, -// THREAD_CNT, -// "test-thread" -// ); - } - - /** - * @param key Key. - * @return Cache. - */ - private static IgniteCache<Object, Integer> cache(long key) { - UUID id = Ignition.ignite("grid-0").affinity(null).mapKeyToNode(key).id(); - - return Ignition.ignite(id).jcache(null); - } - - - /** - * @param key Key. - * @return Cache. - */ - private static Ignite ignite(long key) { - UUID id = Ignition.ignite("grid-0").affinity(null).mapKeyToNode(key).id(); - - return Ignition.ignite(id); - } - - /** - * @throws IgniteCheckedException In case of error. - */ - private static void startNodes() throws IgniteCheckedException { - for (int i = 0; i < NODE_CNT; i++) - Ignition.start(getConfiguration("grid-" + i)); - } - - /** - * @param name Grid name. - * @return Configuration. - */ - private static IgniteConfiguration getConfiguration(String name) { - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.setGridName(name); - - CacheConfiguration cacheCfg = new CacheConfiguration(); - - cacheCfg.setCacheMode(PARTITIONED); - cacheCfg.setAtomicityMode(TRANSACTIONAL); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cacheCfg.setMemoryMode(OFFHEAP_TIERED); - cacheCfg.setOffHeapMaxMemory(0); - cacheCfg.setBackups(1); - - cfg.setCacheConfiguration(cacheCfg); - - TcpDiscoverySpi disco = new TcpDiscoverySpi(); - - disco.setIpFinder(IP_FINDER); - - cfg.setDiscoverySpi(disco); - - return cfg; - } - - /** - */ - private static class UserKey implements Externalizable { - /** */ - @CacheAffinityKeyMapped - private long affKey; - - /** */ - private int idx; - - /** - */ - public UserKey() { - // No-op. - } - - /** - * @param affKey Affinity key. - * @param idx Index. - */ - private UserKey(long affKey, int idx) { - this.affKey = affKey; - this.idx = idx; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeLong(affKey); - out.writeInt(idx); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - affKey = in.readLong(); - idx = in.readInt(); - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - UserKey key = (UserKey)o; - - return affKey == key.affKey && idx == key.idx; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int result = (int)(affKey ^ (affKey >>> 32)); - - result = 31 * result + idx; - - return result; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java deleted file mode 100644 index a4f917f..0000000 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheGroupLockComparisonTest.java +++ /dev/null @@ -1,204 +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.loadtests.cache; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.testframework.*; -import org.apache.ignite.transactions.*; -import org.jetbrains.annotations.*; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; - -/** - * Performance comparison between putAll and group lock. - * - */ -public class GridCacheGroupLockComparisonTest { - /** Batch size. */ - private static final int BATCH_SIZE = Integer.getInteger("TEST_BATCH_SIZE", 25000); - - /** Thread count. */ - private static final int THREADS = Integer.getInteger("TEST_THREAD_COUNT", 16); - - /** Cache name. */ - private static final String CACHE = "partitioned"; - - /** Total number of objects in cache. */ - private static final long OBJECT_CNT = Integer.getInteger("TEST_OBJECT_COUNT", 2000000); - - /** Counter. */ - private static final AtomicLong cntr = new AtomicLong(); - - /** */ - private static final int LOG_MOD = 50000; - - /** - * @param args Arguments. - * @throws Exception If failed. - */ - public static void main(String[] args) throws Exception { - try (Ignite g = G.start("modules/tests/config/load/cache-benchmark.xml")) { - System.out.println("threadCnt=" + THREADS); - System.out.println("objectCnt=" + OBJECT_CNT); - System.out.println("batchSize=" + BATCH_SIZE); - - // Populate and warm-up. - igniteGroupLock(g, OBJECT_CNT, THREADS); - - igniteGroupLock(g, OBJECT_CNT, THREADS); - } - } - - /** - * @param ignite Ignite. - * @param max Maximum cache size. - * @param threads Threads. - * @throws Exception If failed. - */ - private static void ignitePutAll(Ignite ignite, final long max, int threads) throws Exception { - X.println(">>>"); - X.println(">>> Testing putAll"); - X.println(">>>"); - - final IgniteCache<CacheAffinityKey<Long>, Long> cache = ignite.jcache(CACHE); - - assert cache != null; - - final AtomicLong opCnt = new AtomicLong(); - - cntr.set(0); - - final long start = System.currentTimeMillis(); - - GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - while (true) { - Map<CacheAffinityKey<Long>, Long> vals = - new HashMap<>(BATCH_SIZE); - - long start = cntr.getAndAdd(BATCH_SIZE); - - if (start >= max) - break; - - for (long i = start; i < start + BATCH_SIZE; i++) - vals.put(new CacheAffinityKey<>(i % 100000, start), i); - - cache.putAll(vals); - - long ops = opCnt.addAndGet(BATCH_SIZE); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations."); - } - - return null; - } - }, threads, "load-worker"); - - long dur = System.currentTimeMillis() - start; - - X.println(">>>"); - X.println(">> putAll timed results [dur=" + dur + " ms, tx/sec=" + (opCnt.get() * 1000 / dur) + - ", total=" + opCnt.get() + ", duration=" + (dur + 500) / 1000 + "s]"); - X.println(">>>"); - } - - /** - * @param ignite Ignite. - * @param max Maximum cache size. - * @param threads Threads. - * @throws Exception If failed. - */ - private static void igniteGroupLock(final Ignite ignite, final long max, int threads) throws Exception { - X.println(">>>"); - X.println(">>> Testing group lock"); - X.println(">>>"); - - final IgniteCache<CacheAffinityKey<Long>, Long> cache = ignite.jcache(CACHE); - - assert cache != null; - - final AtomicLong opCnt = new AtomicLong(); - - cntr.set(0); - - final AtomicInteger range = new AtomicInteger(); - - final long start = System.currentTimeMillis(); - - GridTestUtils.runMultiThreaded(new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - int affIdx = range.getAndIncrement(); - - String affKey = Thread.currentThread().getName(); - - long rangeCnt = OBJECT_CNT / THREADS; - - long base = affIdx * rangeCnt; - - X.println("Going to put vals in range [" + base + ", " + (base + rangeCnt - 1) + ']'); - - long key = 0; - - while (true) { - long total = cntr.getAndAdd(BATCH_SIZE); - - if (total >= max) - break; - - // Threads should not lock the same key. - - try (IgniteTx tx = ignite.transactions().txStartAffinity(cache.getName(), affKey, PESSIMISTIC, - REPEATABLE_READ, 0, BATCH_SIZE)) { - for (long i = 0; i < BATCH_SIZE; i++) { - cache.put(new CacheAffinityKey<>((key % rangeCnt) + base, affKey), i); - - key++; - } - - tx.commit(); - } - - long ops = opCnt.addAndGet(BATCH_SIZE); - - if (ops % LOG_MOD == 0) - X.println(">>> Performed " + ops + " operations."); - } - - return null; - } - }, threads, "load-worker"); - - long dur = System.currentTimeMillis() - start; - - X.println(">>>"); - X.println(">>> Cache size: " + cache.size()); - X.println(">>> Group lock timed results [dur=" + dur + " ms, tx/sec=" + (opCnt.get() * 1000 / dur) + - ", total=" + opCnt.get() + ", duration=" + (dur + 500) / 1000 + "s]"); - X.println(">>>"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheGroupLockSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheGroupLockSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheGroupLockSelfTestSuite.java deleted file mode 100644 index dd29ad6..0000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheGroupLockSelfTestSuite.java +++ /dev/null @@ -1,48 +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.testsuites; - -import junit.framework.*; -import org.apache.ignite.internal.processors.cache.distributed.dht.*; -import org.apache.ignite.internal.processors.cache.distributed.near.*; -import org.apache.ignite.internal.processors.cache.distributed.replicated.*; - -/** - * Group lock test suite. - */ -public class IgniteCacheGroupLockSelfTestSuite extends TestSuite { - /** - * @return Cache API test suite. - * @throws Exception If failed. - */ - public static TestSuite suite() throws Exception { - TestSuite suite = new TestSuite("Cache Group Lock Test Suite"); - - // One node. - suite.addTest(new TestSuite(GridCacheGroupLockNearSelfTest.class)); - suite.addTest(new TestSuite(GridCacheGroupLockColocatedSelfTest.class)); - suite.addTest(new TestSuite(GridCacheGroupLockReplicatedSelfTest.class)); - - // Multiple nodes. - suite.addTest(new TestSuite(GridCacheGroupLockMultiNodeNearSelfTest.class)); - suite.addTest(new TestSuite(GridCacheGroupLockMultiNodeColocatedSelfTest.class)); - suite.addTest(new TestSuite(GridCacheGroupLockMultiNodeReplicatedSelfTest.class)); - - return suite; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51eefaf7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java index 446d12a..d70f0f7 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java @@ -310,9 +310,6 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTestSuite(GridCacheReferenceCleanupSelfTest.class); suite.addTestSuite(GridCacheReloadSelfTest.class); - // Group locking. - suite.addTest(IgniteCacheGroupLockSelfTestSuite.suite()); - // Full API. suite.addTest(IgniteCacheFullApiSelfTestSuite.suite()); suite.addTestSuite(GridCacheMixedModeSelfTest.class);
