Repository: ignite Updated Branches: refs/heads/ignite-1.4.2-slow-server-debug 38af93fae -> 2ab78f917
added debug for benchmark investigation Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ab78f91 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ab78f91 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ab78f91 Branch: refs/heads/ignite-1.4.2-slow-server-debug Commit: 2ab78f917cceb6d84761a8c3e491431e6142177e Parents: 38af93f Author: Yakov Zhdanov <[email protected]> Authored: Thu Oct 8 19:01:36 2015 +0300 Committer: Yakov Zhdanov <[email protected]> Committed: Thu Oct 8 19:01:36 2015 +0300 ---------------------------------------------------------------------- .../distributed/dht/GridDhtTxPrepareFuture.java | 6 ++- .../near/GridNearTxFinishFuture.java | 6 +-- .../near/GridNearTxFinishResponse.java | 2 +- .../cache/distributed/near/GridNearTxLocal.java | 6 +-- .../junits/common/GridCommonAbstractTest.java | 4 +- .../yardstick/cache/IgnitePutTxBenchmark.java | 2 +- .../IgnitePutTxSkipLocalBackupBenchmark.java | 56 ++++++++++++++++++++ 7 files changed, 71 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index 8080db6..57d5d19 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -32,6 +32,7 @@ import javax.cache.processor.EntryProcessor; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteInterruptedException; import org.apache.ignite.IgniteLogger; +import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; @@ -788,6 +789,9 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter onComplete(res); } + // TODO Remove + static boolean debug = IgniteSystemProperties.getBoolean("TX_DEBUG"); + /** * Initializes future. * @@ -809,7 +813,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter this.txNodes = txNodes; // TODO Remove (for debug only) - if (writes != null && writes.size() == 1) { + if (debug && txNodes.size() > 2 && writes != null && writes.size() == 1) { U.debug( log, "\n>>>\n>>> TX nodes [txNodes=" + txNodes + ", txFut=" + this + ']'); http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java index ab6dc3c..b62bbea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java @@ -247,7 +247,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu /** {@inheritDoc} */ @Override public boolean onDone(IgniteInternalTx tx0, Throwable err) { - if ((initialized() || err != null)) { + if ((initialized() || err != null) && !isDone()) { if (tx.needCheckBackup()) { assert tx.onePhaseCommit(); @@ -352,7 +352,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu markInitialized(); - if (!isSync()) { + if (!isSync() && !isDone()) { boolean complete = true; for (IgniteInternalFuture<?> f : pending()) @@ -764,4 +764,4 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error()); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java index c860baa..4904ad8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java @@ -203,4 +203,4 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishResponse { @Override public String toString() { return S.toString(GridNearTxFinishResponse.class, this, "super", super.toString()); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index a4e06c3..216f978 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -216,7 +216,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter { /** {@inheritDoc} */ @Override protected IgniteInternalFuture<Boolean> addReader( - long msgId, + long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer @@ -1128,8 +1128,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter { /** {@inheritDoc} */ @Override protected GridCacheEntryEx entryEx( - GridCacheContext cacheCtx, - IgniteTxKey key, + GridCacheContext cacheCtx, + IgniteTxKey key, AffinityTopologyVersion topVer ) { if (cacheCtx.isColocated()) { http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java index 4bcf51e..03a0a3c 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java @@ -91,7 +91,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA * Super class for all common tests. */ public abstract class GridCommonAbstractTest extends GridAbstractTest { - /**Cache peek modes array that consist of only ONHEAP mode. */ + /** Cache peek modes array that consist of only ONHEAP mode. */ protected static final CachePeekMode[] ONHEAP_PEEK_MODES = new CachePeekMode[] {CachePeekMode.ONHEAP}; /** @@ -1048,4 +1048,4 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest { } } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java index 53bd60c..0645b05 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java @@ -39,4 +39,4 @@ public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark { @Override protected IgniteCache<Integer, Object> cache() { return ignite().cache("tx"); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab78f91/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java new file mode 100644 index 0000000..a92898d --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxSkipLocalBackupBenchmark.java @@ -0,0 +1,56 @@ +/* + * 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.yardstick.cache; + +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.affinity.Affinity; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.yardstick.cache.model.SampleValue; + +import java.util.Map; + +/** + * Ignite benchmark that performs transactional put operations skipping key if local node is backup. + */ +public class IgnitePutTxSkipLocalBackupBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key; + + Affinity<Object> aff = ignite().affinity("tx"); + ClusterNode locNode = ignite().cluster().localNode(); + + for (;;) { + key = nextRandom(args.range()); + + // Skip key if local node is backup. + if (!aff.isBackup(locNode, key)) + break; + } + + // Implicit transaction is used. + cache.put(key, new SampleValue(key)); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return ignite().cache("tx"); + } +}
