You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by yz...@apache.org on 2015/10/19 15:27:07 UTC
[1/3] ignite git commit: Debugging slowdowns
Repository: ignite
Updated Branches:
refs/heads/ignite-1.4-slow-server-debug 498f83c1d -> 7aa851b5b
Debugging slowdowns
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d6eff397
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d6eff397
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d6eff397
Branch: refs/heads/ignite-1.4-slow-server-debug
Commit: d6eff397ab0f8da51655ac6d3f399b30cb2e1de1
Parents: 498f83c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Oct 19 15:29:18 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Oct 19 15:29:18 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 55 ++++++-----
.../processors/cache/GridCacheMvccManager.java | 98 ++++++++++++--------
.../distributed/GridDistributedCacheEntry.java | 2 +-
.../GridDistributedTxRemoteAdapter.java | 6 +-
.../near/GridNearTxFinishFuture.java | 72 +++++++-------
.../cache/distributed/near/GridNearTxLocal.java | 4 +-
.../cache/transactions/IgniteTxAdapter.java | 1 +
.../transactions/IgniteTxLocalAdapter.java | 27 +++---
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
.../processors/cache/GridCacheTestEntryEx.java | 3 +-
11 files changed, 141 insertions(+), 133 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 430590a..77b8c97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -362,7 +362,6 @@ public interface GridCacheEntryEx {
* @param tx Cache transaction.
* @param evtNodeId ID of node responsible for this change.
* @param affNodeId Partitioned node iD.
- * @param writeThrough If {@code true}, persist to the storage.
* @param retval {@code True} if value should be returned (and unmarshalled if needed).
* @param evt Flag to signal event notification.
* @param metrics Flag to signal metrics notification.
@@ -381,7 +380,6 @@ public interface GridCacheEntryEx {
@Nullable IgniteInternalTx tx,
UUID evtNodeId,
UUID affNodeId,
- boolean writeThrough,
boolean retval,
boolean evt,
boolean metrics,
@@ -970,4 +968,4 @@ public interface GridCacheEntryEx {
* Calls {@link GridDhtLocalPartition#onUnlock()} for this entry's partition.
*/
public void onUnlock();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 4bf0aa1..650fea7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -1056,7 +1056,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
CacheLazyEntry e = new CacheLazyEntry(cctx, key, old);
- Object interceptorVal = cctx.config().getInterceptor().onBeforePut(new CacheLazyEntry(cctx, key, old),
+ Object interceptorVal = cctx.config().getInterceptor().onBeforePut(
+ new CacheLazyEntry(cctx, key, old),
val0);
key0 = e.key();
@@ -1160,7 +1161,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
@Nullable IgniteInternalTx tx,
UUID evtNodeId,
UUID affNodeId,
- boolean writeThrough,
boolean retval,
boolean evt,
boolean metrics,
@@ -1191,6 +1191,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
Cache.Entry entry0 = null;
+ boolean deferred;
+
+ boolean marked = false;
+
synchronized (this) {
checkObsolete();
@@ -1288,40 +1292,33 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
cctx.continuousQueries().onEntryUpdated(this, key, null, old, false);
cctx.dataStructures().onEntryUpdated(key, true);
- }
-
- // Persist outside of synchronization. The correctness of the
- // value will be handled by current transaction.
- if (writeThrough)
- cctx.store().remove(tx, keyValue(false));
- if (cctx.deferredDelete() && !detached() && !isInternal())
- cctx.onDeferredDelete(this, newVer);
- else {
- boolean marked = false;
+ deferred = cctx.deferredDelete() && !detached() && !isInternal();
- synchronized (this) {
+ if (!deferred) {
// If entry is still removed.
- if (newVer == ver) {
- if (obsoleteVer == null || !(marked = markObsolete0(obsoleteVer, true))) {
- if (log.isDebugEnabled())
- log.debug("Entry could not be marked obsolete (it is still used): " + this);
- }
- else {
- recordNodeId(affNodeId, topVer);
+ assert newVer == ver;
- // If entry was not marked obsolete, then removed lock
- // will be registered whenever removeLock is called.
- cctx.mvcc().addRemoved(cctx, obsoleteVer);
+ if (obsoleteVer == null || !(marked = markObsolete0(obsoleteVer, true))) {
+ if (log.isDebugEnabled())
+ log.debug("Entry could not be marked obsolete (it is still used): " + this);
+ }
+ else {
+ recordNodeId(affNodeId, topVer);
- if (log.isDebugEnabled())
- log.debug("Entry was marked obsolete: " + this);
- }
+ if (log.isDebugEnabled())
+ log.debug("Entry was marked obsolete: " + this);
}
}
+ }
- if (marked)
- onMarkedObsolete();
+ if (deferred)
+ cctx.onDeferredDelete(this, newVer);
+
+ if (marked) {
+ assert !deferred;
+
+ onMarkedObsolete();
}
if (intercept)
@@ -4132,4 +4129,4 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
return "IteratorEntry [key=" + key + ']';
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index 1731802..8bcfdc1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -90,7 +90,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
private ConcurrentMap<Long, GridCacheExplicitLockSpan> pendingExplicit;
/** Set of removed lock versions. */
- private Collection<GridCacheVersion> rmvLocks =
+ private GridBoundedConcurrentLinkedHashSet<GridCacheVersion> rmvLocks =
new GridBoundedConcurrentLinkedHashSet<>(MAX_REMOVED_LOCKS, MAX_REMOVED_LOCKS, 0.75f, 16, PER_SEGMENT_Q);
/** Current local candidates. */
@@ -116,7 +116,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
private final ConcurrentMap<GridCacheVersion, GridCacheVersion> near2dht = newMap();
/** Finish futures. */
- //private final Queue<FinishLockFuture> finishFuts = new ConcurrentLinkedDeque8<>();
+ private final ConcurrentLinkedDeque8<FinishLockFuture> finishFuts = new ConcurrentLinkedDeque8<>();
/** Logger. */
@SuppressWarnings( {"FieldAccessedSynchronizedAndUnsynchronized"})
@@ -176,8 +176,10 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
else if (log.isDebugEnabled())
log.debug("Failed to find transaction for changed owner: " + owner);
-// for (FinishLockFuture f : finishFuts)
-// f.recheck(entry);
+ if (!finishFuts.isEmptyx()) {
+ for (FinishLockFuture f : finishFuts)
+ f.recheck(entry);
+ }
}
/** {@inheritDoc} */
@@ -277,7 +279,15 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @return Collection of active futures.
*/
public Collection<GridCacheFuture<?>> activeFutures() {
- return F.flatCollections(futs.values());
+ ArrayList<GridCacheFuture<?>> col = new ArrayList<>();
+
+ for (Collection<GridCacheFuture<?>> verFuts : futs.values()) {
+ synchronized (verFuts) {
+ col.addAll(verFuts);
+ }
+ }
+
+ return col;
}
/**
@@ -448,23 +458,27 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
return true;
while (true) {
- Collection<GridCacheFuture<?>> col = new HashSet<GridCacheFuture<?>>(U.capacity(4), 0.75f) {
- {
- // Make sure that we add future to queue before
- // adding queue to the map of futures.
- add(fut);
- }
+ Collection<GridCacheFuture<?>> old = futs.get(fut.version());
+
+ if (old == null) {
+ Collection<GridCacheFuture<?>> col = new HashSet<GridCacheFuture<?>>(U.capacity(4), 0.75f) {
+ {
+ // Make sure that we add future to queue before
+ // adding queue to the map of futures.
+ add(fut);
+ }
- @Override public int hashCode() {
- return System.identityHashCode(this);
- }
+ @Override public int hashCode() {
+ return System.identityHashCode(this);
+ }
- @Override public boolean equals(Object obj) {
- return obj == this;
- }
- };
+ @Override public boolean equals(Object obj) {
+ return obj == this;
+ }
+ };
- Collection<GridCacheFuture<?>> old = futs.putIfAbsent(fut.version(), col);
+ old = futs.putIfAbsent(fut.version(), col);
+ }
if (old != null) {
boolean empty, dup = false;
@@ -636,7 +650,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
if (cacheCtx.isNear() || cacheCtx.isLocal())
return true;
- boolean ret = true;//rmvLocks.add(ver);
+ boolean ret = rmvLocks.add(ver);
if (log.isDebugEnabled())
log.debug("Added removed lock version: " + ver);
@@ -945,12 +959,12 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
@Override public void printMemoryStats() {
X.println(">>> ");
X.println(">>> Mvcc manager memory stats [grid=" + cctx.gridName() + ']');
- X.println(">>> rmvLocksSize: " + rmvLocks.size());
+ X.println(">>> rmvLocksSize: " + rmvLocks.sizex());
X.println(">>> dhtLocCandsSize: " + dhtLocCands.size());
X.println(">>> lockedSize: " + locked.size());
X.println(">>> futsSize: " + futs.size());
X.println(">>> near2dhtSize: " + near2dht.size());
-// X.println(">>> finishFutsSize: " + finishFuts.size());
+ X.println(">>> finishFutsSize: " + finishFuts.sizex());
}
/**
@@ -970,10 +984,12 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
public Map<IgniteTxKey, Collection<GridCacheMvccCandidate>> unfinishedLocks(AffinityTopologyVersion topVer) {
Map<IgniteTxKey, Collection<GridCacheMvccCandidate>> cands = new HashMap<>();
-// for (FinishLockFuture fut : finishFuts) {
-// if (fut.topologyVersion().equals(topVer))
-// cands.putAll(fut.pendingLocks());
-// }
+ if (!finishFuts.isEmptyx()) {
+ for (FinishLockFuture fut : finishFuts) {
+ if (fut.topologyVersion().equals(topVer))
+ cands.putAll(fut.pendingLocks());
+ }
+ }
return cands;
}
@@ -1047,7 +1063,10 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @param topVer Topology version.
* @return Future that signals when all locks for given partitions will be released.
*/
- private IgniteInternalFuture<?> finishLocks(@Nullable final IgnitePredicate<KeyCacheObject> keyFilter, AffinityTopologyVersion topVer) {
+ private IgniteInternalFuture<?> finishLocks(
+ @Nullable final IgnitePredicate<KeyCacheObject> keyFilter,
+ AffinityTopologyVersion topVer
+ ) {
assert topVer.topologyVersion() != 0;
if (topVer.equals(AffinityTopologyVersion.NONE))
@@ -1058,6 +1077,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
locked() :
F.view(locked(),
new P1<GridDistributedCacheEntry>() {
+ @SuppressWarnings("unchecked")
@Override public boolean apply(GridDistributedCacheEntry e) {
return F.isAll(e.key(), keyFilter);
}
@@ -1065,17 +1085,13 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
),
topVer);
-// finishFuts.add(finishFut);
-//
-// finishFut.listen(new CI1<IgniteInternalFuture<?>>() {
-// @Override public void apply(IgniteInternalFuture<?> e) {
-// finishFuts.remove(finishFut);
-//
-// // This call is required to make sure that the concurrent queue
-// // clears memory occupied by internal nodes.
-// finishFuts.peek();
-// }
-// });
+ finishFuts.add(finishFut);
+
+ finishFut.listen(new CI1<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> e) {
+ finishFuts.remove(finishFut);
+ }
+ });
finishFut.recheck();
@@ -1089,8 +1105,10 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
if (exchLog.isDebugEnabled())
exchLog.debug("Rechecking pending locks for completion.");
-// for (FinishLockFuture fut : finishFuts)
-// fut.recheck();
+ if (!finishFuts.isEmptyx()) {
+ for (FinishLockFuture fut : finishFuts)
+ fut.recheck();
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index 6904e56..a043124 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -402,7 +402,7 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
doomed = mvcc == null ? null : mvcc.candidate(ver);
- if (doomed == null || doomed.dhtLocal() || (!doomed.local() && !doomed.nearLocal()))
+ if (doomed == null)
addRemoved(ver);
GridCacheVersion obsoleteVer = obsoleteVersionExtras();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index f969737..3cbee5d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -572,7 +572,8 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
if (op == CREATE || op == UPDATE) {
// Invalidate only for near nodes (backups cannot be invalidated).
if (isSystemInvalidate() || (isInvalidate() && cacheCtx.isNear()))
- cached.innerRemove(this, eventNodeId(), nodeId, false, false, true, true,
+ cached.innerRemove(this, eventNodeId(), nodeId,
+ false, true, true,
topVer, null, replicate ? DR_BACKUP : DR_NONE,
near() ? null : explicitVer, CU.subjectId(this, cctx),
resolveTaskName());
@@ -597,7 +598,8 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
}
}
else if (op == DELETE) {
- cached.innerRemove(this, eventNodeId(), nodeId, false, false, true, true,
+ cached.innerRemove(this, eventNodeId(), nodeId,
+ false, true, true,
topVer, null, replicate ? DR_BACKUP : DR_NONE,
near() ? null : explicitVer, CU.subjectId(this, cctx), resolveTaskName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/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 d058b67..5e21450 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
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
@@ -176,38 +175,6 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
}
/**
- * @param e Error.
- */
- void onError(Throwable e) {
- tx.commitError(e);
-
- if (err.compareAndSet(null, e)) {
- boolean marked = tx.setRollbackOnly();
-
- if (e instanceof IgniteTxRollbackCheckedException) {
- if (marked) {
- try {
- tx.rollback();
- }
- catch (IgniteCheckedException ex) {
- U.error(log, "Failed to automatically rollback transaction: " + tx, ex);
- }
- }
- }
- else if (tx.implicit() && tx.isSystemInvalidate()) { // Finish implicit transaction on heuristic error.
- try {
- tx.close();
- }
- catch (IgniteCheckedException ex) {
- U.error(log, "Failed to invalidate transaction: " + tx, ex);
- }
- }
-
- onComplete();
- }
- }
-
- /**
* @param nodeId Sender.
* @param res Result.
*/
@@ -247,6 +214,33 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
/** {@inheritDoc} */
@Override public boolean onDone(IgniteInternalTx tx0, Throwable err) {
+ if (err != null) {
+ tx.commitError(err);
+
+ if (this.err.compareAndSet(null, err)) {
+ boolean marked = tx.setRollbackOnly();
+
+ if (err instanceof IgniteTxRollbackCheckedException) {
+ if (marked) {
+ try {
+ tx.rollback();
+ }
+ catch (IgniteCheckedException ex) {
+ U.error(log, "Failed to automatically rollback transaction: " + tx, ex);
+ }
+ }
+ }
+ else if (tx.implicit() && tx.isSystemInvalidate()) { // Finish implicit transaction on heuristic error.
+ try {
+ tx.close();
+ }
+ catch (IgniteCheckedException ex) {
+ U.error(log, "Failed to invalidate transaction: " + tx, ex);
+ }
+ }
+ }
+ }
+
if ((initialized() || err != null) && !isDone()) {
if (tx.needCheckBackup()) {
assert tx.onePhaseCommit();
@@ -365,15 +359,15 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
}
}
else
- onError(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(tx)));
+ onDone(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(tx)));
}
catch (Error | RuntimeException e) {
- onError(e);
+ onDone(e);
throw e;
}
catch (IgniteCheckedException e) {
- onError(e);
+ onDone(e);
}
}
@@ -518,9 +512,9 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
if (m.node().isLocal()) {
IgniteInternalFuture<IgniteInternalTx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx);
- // Add new future.
- if (fut != null)
- add(fut);
+ // Add new future. TODO: revisit
+// if (fut != null)
+// add(fut);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/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 17e3ac1..ef06dd5 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
@@ -775,14 +775,14 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
catch (Error | RuntimeException e) {
commitErr.compareAndSet(null, e);
- fut0.onError(e);
+ fut0.onDone(e);
throw e;
}
catch (IgniteCheckedException e) {
commitErr.compareAndSet(null, e);
- fut0.onError(e);
+ fut0.onDone(e);
}
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 88752a2..453bafd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -100,6 +100,7 @@ import static org.apache.ignite.transactions.TransactionState.ROLLING_BACK;
/**
* Managed transaction adapter.
+ * TODO: scytheout
*/
public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
implements IgniteInternalTx, Externalizable {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 6ca1f72..555e2c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -116,6 +116,7 @@ import static org.apache.ignite.transactions.TransactionState.UNKNOWN;
/**
* Transaction adapter for cache transactions.
+ * TODO scytheout
*/
public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
implements IgniteTxLocalEx {
@@ -202,21 +203,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
int taskNameHash
) {
super(
- cctx,
- xidVer,
- implicit,
- implicitSingle,
- /*local*/true,
- sys,
+ cctx,
+ xidVer,
+ implicit,
+ implicitSingle,
+ /*local*/true,
+ sys,
plc,
- concurrency,
- isolation,
+ concurrency,
+ isolation,
timeout,
invalidate,
- storeEnabled,
- onePhaseCommit,
- txSize,
- subjId,
+ storeEnabled,
+ onePhaseCommit,
+ txSize,
+ subjId,
taskNameHash
);
@@ -957,7 +958,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
eventNodeId(),
txEntry.nodeId(),
false,
- false,
evt,
metrics,
topVer,
@@ -974,7 +974,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
nodeId,
false,
false,
- false,
metrics,
topVer,
CU.empty0(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 2a64963..197f071 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4833,7 +4833,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
TransactionIsolation txIsolation)
throws Exception
{
- log.info("Test tx skip store [concurrency=" + txConcurrency + ", isolation=" + txIsolation + ']');
+ info("Test tx skip store [concurrency=" + txConcurrency + ", isolation=" + txIsolation + ']');
cache.removeAll(data.keySet());
checkEmpty(cache, cacheSkipStore);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d6eff397/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 1fef4d5..641fbf6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -519,7 +519,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
@Nullable IgniteInternalTx tx,
UUID evtNodeId,
UUID affNodeId,
- boolean writeThrough,
boolean retval,
boolean evt,
boolean metrics,
@@ -857,4 +856,4 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
@Override public void onUnlock() {
// No-op.
}
-}
\ No newline at end of file
+}
[3/3] ignite git commit: Debugging slowdowns
Posted by yz...@apache.org.
Debugging slowdowns
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7aa851b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7aa851b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7aa851b5
Branch: refs/heads/ignite-1.4-slow-server-debug
Commit: 7aa851b5b64278c5d9dfe95306223d63bbcc3e12
Parents: f580ef9
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Oct 19 16:27:06 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Oct 19 16:27:06 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/Bench.java | 1 -
.../cache/transactions/IgniteTxManager.java | 186 +++++++++----------
.../internal/util/GridConcurrentFactory.java | 12 +-
3 files changed, 94 insertions(+), 105 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7aa851b5/modules/core/src/main/java/org/apache/ignite/internal/Bench.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/Bench.java b/modules/core/src/main/java/org/apache/ignite/internal/Bench.java
index 1d5f544..cc021bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/Bench.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/Bench.java
@@ -48,7 +48,6 @@ public class Bench {
Thread.sleep(2000);
-
final LongAdder8 cnt = new LongAdder8();
final AtomicLong time = new AtomicLong(U.currentTimeMillis());
http://git-wip-us.apache.org/repos/asf/ignite/blob/7aa851b5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 032e043..a80980e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -143,7 +143,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
/** Committed local transactions. */
private final GridBoundedConcurrentOrderedMap<GridCacheVersion, Boolean> completedVers =
- new GridBoundedConcurrentOrderedMap<>(Integer.getInteger(IGNITE_MAX_COMPLETED_TX_COUNT, DFLT_MAX_COMPLETED_TX_CNT));
+ new GridBoundedConcurrentOrderedMap<>(
+ Integer.getInteger(IGNITE_MAX_COMPLETED_TX_COUNT, DFLT_MAX_COMPLETED_TX_CNT));
/** Transaction finish synchronizer. */
private GridCacheTxFinishSync txFinishSync;
@@ -851,10 +852,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
GridCacheVersion finishTn = cctx.versions().last();
// Add future to prepare queue only on first prepare call.
-// if (tx.markPreparing())
-// prepareQ.offer(tx);
-
- tx.markPreparing();
+ if (tx.markPreparing())
+ prepareQ.offer(tx);
// Check that our read set does not intersect with write set
// of all transactions that completed their write phase
@@ -890,50 +889,50 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
// Check that our read and write sets do not intersect with write
// sets of all active transactions.
-// for (Iterator<IgniteInternalTx> iter = prepareQ.iterator(); iter.hasNext();) {
-// IgniteInternalTx prepareTx = iter.next();
-//
-// if (prepareTx == tx)
-// // Skip yourself.
-// continue;
-//
-// // Optimistically remove completed transactions.
-// if (prepareTx.done()) {
-// iter.remove();
-//
-// if (log.isDebugEnabled())
-// log.debug("Removed finished transaction from active queue: " + prepareTx);
-//
-// continue;
-// }
-//
-// // Check if originating node left.
-// if (cctx.discovery().node(prepareTx.nodeId()) == null) {
-// iter.remove();
-//
-// rollbackTx(prepareTx);
-//
-// if (log.isDebugEnabled())
-// log.debug("Removed and rolled back transaction because sender node left grid: " +
-// CU.txString(prepareTx));
-//
-// continue;
-// }
-//
-// if (tx.serializable() && !prepareTx.isRollbackOnly()) {
-// Set<IgniteTxKey> prepareWriteSet = prepareTx.writeSet();
-//
-// if (GridFunc.intersects(prepareWriteSet, readSet, writeSet)) {
-// // Remove from active set.
-// iter.remove();
-//
-// tx.setRollbackOnly();
-//
-// throw new IgniteTxOptimisticCheckedException(
-// "Failed to prepare transaction (read-set/write-set conflict): " + tx);
-// }
-// }
-// }
+ for (Iterator<IgniteInternalTx> iter = prepareQ.iterator(); iter.hasNext();) {
+ IgniteInternalTx prepareTx = iter.next();
+
+ if (prepareTx == tx)
+ // Skip yourself.
+ continue;
+
+ // Optimistically remove completed transactions.
+ if (prepareTx.done()) {
+ iter.remove();
+
+ if (log.isDebugEnabled())
+ log.debug("Removed finished transaction from active queue: " + prepareTx);
+
+ continue;
+ }
+
+ // Check if originating node left.
+ if (cctx.discovery().node(prepareTx.nodeId()) == null) {
+ iter.remove();
+
+ rollbackTx(prepareTx);
+
+ if (log.isDebugEnabled())
+ log.debug("Removed and rolled back transaction because sender node left grid: " +
+ CU.txString(prepareTx));
+
+ continue;
+ }
+
+ if (tx.serializable() && !prepareTx.isRollbackOnly()) {
+ Set<IgniteTxKey> prepareWriteSet = prepareTx.writeSet();
+
+ if (GridFunc.intersects(prepareWriteSet, readSet, writeSet)) {
+ // Remove from active set.
+ iter.remove();
+
+ tx.setRollbackOnly();
+
+ throw new IgniteTxOptimisticCheckedException(
+ "Failed to prepare transaction (read-set/write-set conflict): " + tx);
+ }
+ }
+ }
}
// Optimistic.
@@ -1099,24 +1098,23 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
* @return If transaction was not already present in completed set.
*/
public boolean addCommittedTx(GridCacheVersion xidVer, @Nullable GridCacheVersion nearXidVer) {
-// if (nearXidVer != null)
-// xidVer = new CommittedVersion(xidVer, nearXidVer);
-//
-// Boolean committed = completedVers.putIfAbsent(xidVer, true);
-//
-// if (committed == null || committed) {
-// if (log.isDebugEnabled())
-// log.debug("Added transaction to committed version set: " + xidVer);
-//
-// return true;
-// }
-// else {
-// if (log.isDebugEnabled())
-// log.debug("Transaction is already present in rolled back version set: " + xidVer);
-//
-// return false;
-// }
- return true;
+ if (nearXidVer != null)
+ xidVer = new CommittedVersion(xidVer, nearXidVer);
+
+ Boolean committed = completedVers.putIfAbsent(xidVer, true);
+
+ if (committed == null || committed) {
+ if (log.isDebugEnabled())
+ log.debug("Added transaction to committed version set: " + xidVer);
+
+ return true;
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Transaction is already present in rolled back version set: " + xidVer);
+
+ return false;
+ }
}
/**
@@ -1124,22 +1122,20 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
* @return If transaction was not already present in completed set.
*/
public boolean addRolledbackTx(GridCacheVersion xidVer) {
+ Boolean committed = completedVers.putIfAbsent(xidVer, false);
- return true;
-// Boolean committed = completedVers.putIfAbsent(xidVer, false);
-//
-// if (committed == null || !committed) {
-// if (log.isDebugEnabled())
-// log.debug("Added transaction to rolled back version set: " + xidVer);
-//
-// return true;
-// }
-// else {
-// if (log.isDebugEnabled())
-// log.debug("Transaction is already present in committed version set: " + xidVer);
-//
-// return false;
-// }
+ if (committed == null || !committed) {
+ if (log.isDebugEnabled())
+ log.debug("Added transaction to rolled back version set: " + xidVer);
+
+ return true;
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Transaction is already present in committed version set: " + xidVer);
+
+ return false;
+ }
}
/**
@@ -1266,19 +1262,19 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
* so we don't do it here.
*/
-// Boolean committed = completedVers.get(tx.xidVersion());
-//
-// // 1. Make sure that committed version has been recorded.
-// if (!((committed != null && committed) || tx.writeSet().isEmpty() || tx.isSystemInvalidate())) {
-// uncommitTx(tx);
-//
-// GridCacheVersion first = completedVers.isEmpty() ? null : completedVers.firstKey();
-// GridCacheVersion last = completedVers.isEmpty() ? null : completedVers.lastKey();
-//
-// throw new IgniteException("Missing commit version (consider increasing " +
-// IGNITE_MAX_COMPLETED_TX_COUNT + " system property) [ver=" + tx.xidVersion() + ", firstVer=" +
-// first + ", lastVer=" + last + ", tx=" + tx.xid() + ']');
-// }
+ Boolean committed = completedVers.get(tx.xidVersion());
+
+ // 1. Make sure that committed version has been recorded.
+ if (!((committed != null && committed) || tx.writeSet().isEmpty() || tx.isSystemInvalidate())) {
+ uncommitTx(tx);
+
+ GridCacheVersion first = completedVers.isEmpty() ? null : completedVers.firstKey();
+ GridCacheVersion last = completedVers.isEmpty() ? null : completedVers.lastKey();
+
+ throw new IgniteException("Missing commit version (consider increasing " +
+ IGNITE_MAX_COMPLETED_TX_COUNT + " system property) [ver=" + tx.xidVersion() + ", firstVer=" +
+ first + ", lastVer=" + last + ", tx=" + tx.xid() + ']');
+ }
ConcurrentMap<GridCacheVersion, IgniteInternalTx> txIdMap = transactionMap(tx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7aa851b5/modules/core/src/main/java/org/apache/ignite/internal/util/GridConcurrentFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridConcurrentFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridConcurrentFactory.java
index 6e0e876..bb933fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridConcurrentFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridConcurrentFactory.java
@@ -17,19 +17,14 @@
package org.apache.ignite.internal.util;
-import java.util.concurrent.ConcurrentMap;
-import org.apache.ignite.IgniteSystemProperties;
import org.jsr166.ConcurrentHashMap8;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_MAP_CONCURRENCY_LEVEL;
+import java.util.concurrent.ConcurrentMap;
/**
* Concurrent map factory.
*/
public class GridConcurrentFactory {
- /** Default concurrency level. */
- private static final int CONCURRENCY_LEVEL = IgniteSystemProperties.getInteger(IGNITE_MAP_CONCURRENCY_LEVEL, 256);
-
/**
* Ensure singleton.
*/
@@ -43,7 +38,6 @@ public class GridConcurrentFactory {
* @return New concurrent map.
*/
public static <K, V> ConcurrentMap<K, V> newMap() {
- return new ConcurrentHashMap8<>(16 * CONCURRENCY_LEVEL, 0.75f, CONCURRENCY_LEVEL);
+ return new ConcurrentHashMap8<>();
}
-
-}
\ No newline at end of file
+}
[2/3] ignite git commit: Debugging slowdowns
Posted by yz...@apache.org.
Debugging slowdowns
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f580ef99
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f580ef99
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f580ef99
Branch: refs/heads/ignite-1.4-slow-server-debug
Commit: f580ef9957f21a1a6046b10e4edc8de51f8b9c1c
Parents: d6eff39
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Oct 19 15:58:28 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Oct 19 15:58:28 2015 +0300
----------------------------------------------------------------------
.../near/GridCachePartitionedMultiNodeFullApiSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f580ef99/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index c04bf2e..b6ffbcc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -476,4 +476,4 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
assertFalse(affinity(cache).isPrimaryOrBackup(other, key));
}
}
-}
\ No newline at end of file
+}