You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2023/08/04 14:57:43 UTC

[ignite] branch master updated: IGNITE-20094 IgniteTxManager initial cleanup (#10864)

This is an automated email from the ASF dual-hosted git repository.

av pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new f025cc18cc2 IGNITE-20094 IgniteTxManager initial cleanup (#10864)
f025cc18cc2 is described below

commit f025cc18cc2250b4a023ecfa3aa1baaaf26510d3
Author: Anton Vinogradov <av...@apache.org>
AuthorDate: Fri Aug 4 17:57:37 2023 +0300

    IGNITE-20094 IgniteTxManager initial cleanup (#10864)
---
 .../processors/cache/GridCacheAdapter.java         |   9 +-
 .../internal/processors/cache/mvcc/MvccUtils.java  |   3 +-
 .../cache/transactions/IgniteTransactionsImpl.java |   3 +-
 .../cache/transactions/IgniteTxManager.java        | 248 ++++++---------------
 .../cache/transactions/TxDeadlockDetection.java    |   3 +-
 .../platform/client/tx/ClientTxStartRequest.java   |   3 +-
 .../TxDataConsistencyOnCommitFailureTest.java      |   2 +-
 .../TxDeadlockDetectionNoHangsTest.java            |  44 ++--
 .../processors/cache/jta/CacheJtaManager.java      |   3 +-
 9 files changed, 104 insertions(+), 214 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 55cd09b4e94..f24ed990762 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4254,8 +4254,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                     !ctx.skipStore(),
                     ctx.mvccEnabled(),
                     0,
-                    null,
-                    false
+                    null
                 );
 
                 assert tx != null;
@@ -4373,8 +4372,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                     !skipStore,
                     ctx.mvccEnabled(),
                     0,
-                    null,
-                    false);
+                    null);
 
                 return asyncOp(tx, op, opCtx, /*retry*/false);
             }
@@ -5403,8 +5401,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 opCtx == null || !opCtx.skipStore(),
                 ctx.mvccEnabled(),
                 0,
-                null,
-                false);
+                null);
 
             IgniteInternalFuture<T> fut = asyncOp(tx, op, opCtx, retry);
 
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
index 9830bc4f6d5..301cede38a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
@@ -772,8 +772,7 @@ public class MvccUtils {
             cctx == null || !cctx.skipStore(),
             true,
             0,
-            null,
-            false
+            null
         );
 
         tx.syncMode(FULL_SYNC);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
index f36cb17f567..a9cff2baf99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
@@ -194,8 +194,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx {
                 true,
                 null,
                 txSize,
-                lb,
-                tracingEnabled
+                lb
             );
 
             assert tx != null;
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 ca331ad3e41..1ee1bb38cc5 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
@@ -193,18 +193,12 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         Integer.getInteger(IGNITE_SLOW_TX_WARN_TIMEOUT, DFLT_SLOW_TX_WARN_TIMEOUT);
 
     /** Returns {@code true} if transaction has completed states. */
-    public static final Predicate<TxRecord> COMPLETED_TX_STATES = new Predicate<TxRecord>() {
-        @Override public boolean test(TxRecord txRec) {
-            return txRec.state() == COMMITTED || txRec.state() == ROLLED_BACK;
-        }
-    };
+    public static final Predicate<TxRecord> COMPLETED_TX_STATES =
+        txRec -> txRec.state() == COMMITTED || txRec.state() == ROLLED_BACK;
 
     /** Returns {@code true} if transaction has prepared states. */
-    public static final Predicate<TxRecord> PREPARED_TX_STATES = new Predicate<TxRecord>() {
-        @Override public boolean test(TxRecord txRec) {
-            return txRec.state() == PREPARED || txRec.state() == PREPARING;
-        }
-    };
+    public static final Predicate<TxRecord> PREPARED_TX_STATES =
+        txRec -> txRec.state() == PREPARED || txRec.state() == PREPARING;
 
     /** Uncommited tx states. */
     private Set<GridCacheVersion> uncommitedTx = new HashSet<>();
@@ -225,13 +219,13 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     /** @see IgniteSystemProperties#IGNITE_DUMP_TX_COLLISIONS_INTERVAL */
     public static final int DFLT_DUMP_TX_COLLISIONS_INTERVAL = 1000;
 
-    /** Deadlock detection maximum iterations. */
-    static int DEADLOCK_MAX_ITERS =
-        IgniteSystemProperties.getInteger(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, DFLT_TX_DEADLOCK_DETECTION_MAX_ITERS);
-
     /** Lower tx collisions queue size threshold. */
     private static final int COLLISIONS_QUEUE_THRESHOLD = 100;
 
+    /** Deadlock detection maximum iterations. */
+    final int deadlockMaxIters =
+        IgniteSystemProperties.getInteger(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, DFLT_TX_DEADLOCK_DETECTION_MAX_ITERS);
+
     /** Committing transactions. */
     private final ThreadLocal<IgniteInternalTx> threadCtx = new ThreadLocal<>();
 
@@ -277,7 +271,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     private int slowTxWarnTimeout = SLOW_TX_WARN_TIMEOUT;
 
     /** */
-    private TxDumpsThrottling txDumpsThrottling = new TxDumpsThrottling();
+    private final TxDumpsThrottling txDumpsThrottling = new TxDumpsThrottling();
 
     /**
      * Near version to DHT version map. Note that we initialize to 5K size from get go,
@@ -296,7 +290,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     private volatile boolean suspendResumeForPessimisticSupported;
 
     /** The futures for changing transaction timeout on partition map exchange. */
-    private ConcurrentMap<UUID, TxTimeoutOnPartitionMapExchangeChangeFuture> txTimeoutOnPartitionMapExchangeFuts =
+    private final ConcurrentMap<UUID, TxTimeoutOnPartitionMapExchangeChangeFuture> txTimeoutOnPartitionMapExchangeFuts =
         new ConcurrentHashMap<>();
 
     /** Timeout operations. */
@@ -330,7 +324,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override protected void start0() throws IgniteCheckedException {
+    @Override protected void start0() {
         txHnd = new IgniteTxHandler(cctx);
 
         deferredAckMsgSnd = new GridDeferredAckMessageSender<GridCacheVersion>(cctx.time(), cctx.kernalContext().closure()) {
@@ -366,30 +360,28 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         cctx.gridEvents().addDiscoveryEventListener(new TransactionRecoveryListener(), EVT_NODE_FAILED, EVT_NODE_LEFT);
 
         cctx.gridEvents().addDiscoveryEventListener(
-            new DiscoveryEventListener() {
-                @Override public void onEvent(DiscoveryEvent evt, DiscoCache discoCache) {
-                    if (evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT) {
-                        UUID nodeId = evt.eventNode().id();
+            (DiscoveryEvent evt, DiscoCache discoCache) -> {
+                if (evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT) {
+                    UUID nodeId = evt.eventNode().id();
 
-                        for (TxDeadlockFuture fut : deadlockDetectFuts.values())
-                            fut.onNodeLeft(nodeId);
+                    for (TxDeadlockFuture fut : deadlockDetectFuts.values())
+                        fut.onNodeLeft(nodeId);
 
-                        for (Map.Entry<GridCacheVersion, Object> entry : completedVersHashMap.entrySet()) {
-                            Object obj = entry.getValue();
+                    for (Map.Entry<GridCacheVersion, Object> entry : completedVersHashMap.entrySet()) {
+                        Object obj = entry.getValue();
 
-                            if (obj instanceof GridCacheReturnCompletableWrapper &&
-                                nodeId.equals(((GridCacheReturnCompletableWrapper)obj).nodeId()))
-                                removeTxReturn(entry.getKey());
-                        }
+                        if (obj instanceof GridCacheReturnCompletableWrapper &&
+                            nodeId.equals(((GridCacheReturnCompletableWrapper)obj).nodeId()))
+                            removeTxReturn(entry.getKey());
                     }
-
-                    suspendResumeForPessimisticSupported = IgniteFeatures.allNodesSupports(
-                        cctx.discovery().remoteNodes(), IgniteFeatures.SUSPEND_RESUME_PESSIMISTIC_TX);
                 }
+
+                suspendResumeForPessimisticSupported = IgniteFeatures.allNodesSupports(
+                    cctx.discovery().remoteNodes(), IgniteFeatures.SUSPEND_RESUME_PESSIMISTIC_TX);
             },
             EVT_NODE_FAILED, EVT_NODE_LEFT, EVT_NODE_JOINED);
 
-        this.txDeadlockDetection = new TxDeadlockDetection(cctx);
+        txDeadlockDetection = new TxDeadlockDetection(cctx);
 
         cctx.gridIO().addMessageListener(TOPIC_TX, new DeadlockDetectionListener());
 
@@ -478,7 +470,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      *     tx.currentPrepareFuture().onDone(new IgniteTxRollbackCheckedException())
      * </pre>
      *
-     * It is assumed that the given transaction did not acquired any locks.
+     * It is assumed that the given transaction did not acquire any locks.
      *
      * @param tx Transaction.
      * @return Rollback future.
@@ -569,7 +561,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * Sets if dump requests from local node to near node are allowed, when long running transaction
+     * Sets if dump requests from local node to near node are allowed, when long-running transaction
      * is found. If allowed, the compute request to near node will be made to get thread dump of transaction
      * owner thread.
      *
@@ -579,17 +571,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         return distributedTransactionConfiguration.txOwnerDumpRequestsAllowed();
     }
 
-    /**
-     * Sets if dump requests from local node to near node are allowed, when long running transaction
-     * is found. If allowed, the compute request to near node will be made to get thread dump of transaction
-     * owner thread.
-     *
-     * @param allowed whether allowed
-     */
-    public void setTxOwnerDumpRequestsAllowed(boolean allowed) {
-        distributedTransactionConfiguration.updateTxOwnerDumpRequestsAllowedLocal(allowed);
-    }
-
     /**
      * Threshold timeout for long transactions, if transaction exceeds it, it will be dumped in log with
      * information about how much time did it spent in system time (time while aquiring locks, preparing,
@@ -602,21 +583,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         return distributedTransactionConfiguration.longTransactionTimeDumpThreshold();
     }
 
-    /**
-     * Sets threshold timeout for long transactions, if transaction exceeds it, it will be dumped in log with
-     * information about how much time did it spent in system time (time while aquiring locks, preparing,
-     * commiting, etc) and user time (time when client node runs some code while holding transaction and not
-     * waiting it). Can be set to 0 - no transactions will be dumped in log in this case.
-     *
-     * @param longTransactionTimeDumpThreshold Value of threshold timeout in milliseconds.
-     */
-    public void longTransactionTimeDumpThreshold(long longTransactionTimeDumpThreshold) {
-        assert longTransactionTimeDumpThreshold >= 0
-            : "longTransactionTimeDumpThreshold must be greater than or equal to 0.";
-
-        distributedTransactionConfiguration.updateLongTransactionTimeDumpThresholdLocal(longTransactionTimeDumpThreshold);
-    }
-
     /**
      * The coefficient for samples of completed transactions that will be dumped in log.
      */
@@ -624,16 +590,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         return distributedTransactionConfiguration.transactionTimeDumpSamplesCoefficient();
     }
 
-    /**
-     * Sets the coefficient for samples of completed transactions that will be dumped in log.
-     */
-    public void transactionTimeDumpSamplesCoefficient(double transactionTimeDumpSamplesCoefficient) {
-        assert transactionTimeDumpSamplesCoefficient >= 0.0 && transactionTimeDumpSamplesCoefficient <= 1.0
-            : "transactionTimeDumpSamplesCoefficient value must be between 0.0 and 1.0 inclusively.";
-
-        this.distributedTransactionConfiguration.updateTransactionTimeDumpSamplesCoefficientLocal(transactionTimeDumpSamplesCoefficient);
-    }
-
     /**
      * The limit of samples of completed transactions that will be dumped in log per second, if
      * {@link #transactionTimeDumpSamplesCoefficient} is above <code>0.0</code>. Must be integer value
@@ -643,19 +599,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         return distributedTransactionConfiguration.longTransactionTimeDumpSamplesPerSecondLimit();
     }
 
-    /**
-     * Sets the limit of samples of completed transactions that will be dumped in log per second, if
-     * {@link #transactionTimeDumpSamplesCoefficient} is above <code>0.0</code>. Must be integer value
-     * greater than <code>0</code>.
-     */
-    public void transactionTimeDumpSamplesPerSecondLimit(int transactionTimeDumpSamplesPerSecondLimit) {
-        assert transactionTimeDumpSamplesPerSecondLimit > 0
-            : "transactionTimeDumpSamplesPerSecondLimit must be integer value greater than 0.";
-
-        distributedTransactionConfiguration.updateLongTransactionTimeDumpSamplesPerSecondLimitLocal(
-                transactionTimeDumpSamplesPerSecondLimit);
-    }
-
     /**
      * Invalidates transaction.
      *
@@ -765,8 +708,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         boolean storeEnabled,
         Boolean mvccOp,
         int txSize,
-        @Nullable String lb,
-        boolean tracingEnabled
+        @Nullable String lb
     ) {
         assert sysCacheCtx == null || sysCacheCtx.systemTx();
 
@@ -793,7 +735,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         if (tx.system()) {
             AffinityTopologyVersion topVer = cctx.tm().lockedTopologyVersion(Thread.currentThread().getId(), tx);
 
-            // If there is another system transaction in progress, use it's topology version to prevent deadlock.
+            // If there is another system transaction in progress, use its topology version to prevent deadlock.
             if (topVer != null)
                 tx.topologyVersion(topVer);
         }
@@ -832,7 +774,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                         sysThreadMap.put(new TxThreadKey(tx.threadId(), cacheCtx.cacheId()), tx);
                 }
 
-                ((GridNearTxLocal)tx).recordStateChangedEvent(EVT_TX_STARTED);
+                ((IgniteTxAdapter)tx).recordStateChangedEvent(EVT_TX_STARTED);
             }
 
             // Handle mapped versions.
@@ -942,26 +884,25 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
 
     /**
      * Creates a future that will wait for finishing all tx updates on backups after all local transactions are finished.
-     *
      * NOTE:
      * As we send finish request to backup nodes after transaction successfully completed on primary node
      * it's important to ensure that all updates from primary to backup are finished or at least remote transaction has created
      * on backup node.
      *
-     * @param finishLocalTxsFuture Local transactions finish future.
+     * @param finishLocTxsFut Local transactions finish future.
      * @param topVer Topology version.
      * @return Future that will be completed when all ongoing transactions are finished.
      */
-    public IgniteInternalFuture<?> finishAllTxs(IgniteInternalFuture<?> finishLocalTxsFuture, AffinityTopologyVersion topVer) {
-        final GridCompoundFuture finishAllTxsFuture = new CacheObjectsReleaseFuture("AllTx", topVer);
+    public IgniteInternalFuture<?> finishAllTxs(IgniteInternalFuture<?> finishLocTxsFut, AffinityTopologyVersion topVer) {
+        final GridCompoundFuture finishAllTxsFut = new CacheObjectsReleaseFuture("AllTx", topVer);
 
         // After finishing all local updates, wait for finishing all tx updates on backups.
-        finishLocalTxsFuture.listen(future -> {
-            finishAllTxsFuture.add(cctx.mvcc().finishRemoteTxs(topVer));
-            finishAllTxsFuture.markInitialized();
+        finishLocTxsFut.listen(future -> {
+            finishAllTxsFut.add(cctx.mvcc().finishRemoteTxs(topVer));
+            finishAllTxsFut.markInitialized();
         });
 
-        return finishAllTxsFuture;
+        return finishAllTxsFut;
     }
 
     /**
@@ -1311,8 +1252,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         }
 
         return new IgnitePair<>(
-            committed == null ? Collections.<GridCacheVersion>emptyList() : committed,
-            rolledback == null ? Collections.<GridCacheVersion>emptyList() : rolledback);
+            committed == null ? Collections.emptyList() : committed,
+            rolledback == null ? Collections.emptyList() : rolledback);
     }
 
     /**
@@ -1357,7 +1298,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      * @param tx Committed transaction.
      */
     public void addCommittedTxReturn(IgniteInternalTx tx, GridCacheReturnCompletableWrapper ret) {
-        addCommittedTxReturn(tx.nearXidVersion(), null, ret);
+        addCommittedTxReturn(tx.nearXidVersion(), ret);
     }
 
     /**
@@ -1390,26 +1331,21 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             assert b == null;
         }
 
-        Boolean committed = committed0 != null && !committed0.equals(Boolean.FALSE);
+        boolean committed = committed0 != null && !committed0.equals(Boolean.FALSE);
 
         return committed0 == null || committed;
     }
 
     /**
      * @param xidVer Completed transaction version.
-     * @param nearXidVer Optional near transaction ID.
      * @param retVal Invoke result.
      */
     private void addCommittedTxReturn(
         GridCacheVersion xidVer,
-        @Nullable GridCacheVersion nearXidVer,
         GridCacheReturnCompletableWrapper retVal
     ) {
         assert retVal != null;
 
-        if (nearXidVer != null)
-            xidVer = new CommittedVersion(xidVer, nearXidVer);
-
         Object prev = completedVersHashMap.putIfAbsent(xidVer, retVal);
 
         assert prev == null || Boolean.FALSE.equals(prev) : prev; // Can be rolled back.
@@ -1432,7 +1368,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             assert b == null;
         }
 
-        Boolean committed = committed0 != null && !committed0.equals(Boolean.FALSE);
+        boolean committed = committed0 != null && !committed0.equals(Boolean.FALSE);
 
         return committed0 == null || !committed;
     }
@@ -1506,7 +1442,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * Gets versions of all not acquired locks for collection of tx entries that are less then base version.
+     * Gets versions of all not acquired locks for collection of tx entries that are less than base version.
      *
      * @param entries Tx entries to process.
      * @param baseVer Base version to compare with.
@@ -1521,7 +1457,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             GridCacheEntryEx cached = txEntry.cached();
 
             try {
-                // If check should be faster then exception handling.
+                // If check should be faster than exception handling.
                 if (!cached.obsolete()) {
                     for (GridCacheMvccCandidate cand : cached.localCandidates()) {
                         if (!cand.owner() && cand.version().compareTo(baseVer) < 0) {
@@ -1543,7 +1479,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     /**
      * Go through all candidates for entries involved in transaction and find their min
      * version. We know that these candidates will commit after this transaction, and
-     * therefore we can grab the min version so we can send all committed and rolled
+     * therefore we can grab the min version, so we can send all committed and rolled
      * back versions from min to current to remote nodes for re-ordering.
      *
      * @param entries Entries.
@@ -1601,7 +1537,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
 
         Object committed0 = completedVersHashMap.get(tx.xidVersion());
 
-        Boolean committed = committed0 != null && !committed0.equals(Boolean.FALSE);
+        boolean committed = committed0 != null && !committed0.equals(Boolean.FALSE);
 
         // 1. Make sure that committed version has been recorded.
         if (!(committed || tx.writeSet().isEmpty() || tx.isSystemInvalidate())) {
@@ -1762,7 +1698,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      */
     public void fastFinishTx(GridNearTxLocal tx, boolean commit, boolean clearThreadMap) {
         assert tx != null;
-        tx.writeMap().isEmpty();
+        assert tx.writeMap().isEmpty();
         assert tx.optimistic() || tx.readMap().isEmpty();
 
         ConcurrentMap<GridCacheVersion, IgniteInternalTx> txIdMap = transactionMap(tx);
@@ -2128,20 +2064,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         return threadCtx.get();
     }
 
-    /**
-     * Gets version of transaction in tx context or {@code null}
-     * if tx context is empty.
-     * <p>
-     * This is a convenience method provided mostly for debugging.
-     *
-     * @return Transaction version from transaction context.
-     */
-    @Nullable public GridCacheVersion txContextVersion() {
-        IgniteInternalTx tx = txContext();
-
-        return tx == null ? null : tx.xidVersion();
-    }
-
     /**
      * Commit ended.
      */
@@ -2149,13 +2071,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         threadCtx.set(null);
     }
 
-    /**
-     * @return Slow tx warn timeout.
-     */
-    public int slowTxWarnTimeout() {
-        return slowTxWarnTimeout;
-    }
-
     /**
      * @param slowTxWarnTimeout Slow tx warn timeout.
      */
@@ -2253,8 +2168,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             if (log.isDebugEnabled())
                 log.debug("Found near transaction, will wait for completion: " + tx);
 
-            tx.finishFuture().listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public void apply(IgniteInternalFuture<IgniteInternalTx> fut) {
+            tx.finishFuture().listen((IgniteInternalFuture<IgniteInternalTx> fut) -> {
                     TransactionState state = tx.state();
 
                     if (log.isDebugEnabled())
@@ -2262,7 +2176,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
 
                     resFut.onDone(state == COMMITTED);
                 }
-            });
+            );
 
             return resFut;
         }
@@ -2327,24 +2241,22 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                     if (log.isDebugEnabled())
                         log.debug("Transaction is preparing (will wait): " + tx);
 
-                    final GridFutureAdapter<Boolean> fut0 = fut != null ? fut : new GridFutureAdapter<Boolean>();
+                    final GridFutureAdapter<Boolean> fut0 = fut != null ? fut : new GridFutureAdapter<>();
 
                     final int txNum0 = txNum;
 
                     final Collection<GridCacheVersion> processedVers0 = processedVers;
 
-                    prepFut.listen(new CI1<IgniteInternalFuture<?>>() {
-                        @Override public void apply(IgniteInternalFuture<?> prepFut) {
-                            if (log.isDebugEnabled())
-                                log.debug("Transaction prepare future finished: " + tx);
+                    prepFut.listen((IgniteInternalFuture<?> ignored) -> {
+                        if (log.isDebugEnabled())
+                            log.debug("Transaction prepare future finished: " + tx);
 
-                            IgniteInternalFuture<Boolean> fut = txsPreparedOrCommitted(nearVer,
-                                txNum0,
-                                fut0,
-                                processedVers0);
+                        IgniteInternalFuture<Boolean> f = txsPreparedOrCommitted(nearVer,
+                            txNum0,
+                            fut0,
+                            processedVers0);
 
-                            assert fut == fut0;
-                        }
+                        assert f == fut0;
                     });
 
                     return fut0;
@@ -2457,9 +2369,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             IgniteTxRemoteEx rmtTx = (IgniteTxRemoteEx)tx;
 
             rmtTx.doneRemote(tx.xidVersion(),
-                Collections.<GridCacheVersion>emptyList(),
-                Collections.<GridCacheVersion>emptyList(),
-                Collections.<GridCacheVersion>emptyList());
+                Collections.emptyList(),
+                Collections.emptyList(),
+                Collections.emptyList());
         }
 
         if (commit)
@@ -2516,7 +2428,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      * @return {@code True} if deadlock detection is enabled.
      */
     public boolean deadlockDetectionEnabled() {
-        return DEADLOCK_MAX_ITERS > 0;
+        return deadlockMaxIters > 0;
     }
 
     /**
@@ -2623,12 +2535,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                     if (nearFut != null) {
                         Set<IgniteTxKey> nearRequestedKeys = nearFut.requestedKeys();
 
-                        if (nearRequestedKeys != null) {
-                            if (requestedKeys == null)
-                                requestedKeys = nearRequestedKeys;
-                            else
-                                requestedKeys = nearRequestedKeys;
-                        }
+                        if (nearRequestedKeys != null)
+                            requestedKeys = nearRequestedKeys;
                     }
                 }
                 else {
@@ -2968,7 +2876,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
 
     /**
      * Method checks that current thread does not have active transactions.
-     *
      * If transaction or topology lock is hold by current thread
      * exception {@link IgniteException} with given {@code errMsgConstructor} message will be thrown.
      *
@@ -2980,7 +2887,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * Sets if dump requests from local node to near node are allowed, when long running transaction
+     * Sets if dump requests from local node to near node are allowed, when long-running transaction
      * is found. If allowed, the compute request to near node will be made to get thread dump of transaction
      * owner thread. Also broadcasts this setting on other server nodes in cluster.
      *
@@ -3016,8 +2923,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * Sets the coefficient for samples of long running transactions that will be dumped in log, if
-     * {@link #longTransactionTimeDumpThreshold} is set to non-zero value."
+     * Sets the coefficient for samples of long-running transactions that will be dumped in log, if
+     * {@link #longTransactionTimeDumpThreshold} is set to non-zero value.
      *
      * @param coefficient Coefficient, must be value between 0.0 and 1.0 inclusively.
      */
@@ -3137,13 +3044,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             pushCollidingKeysWithQueueSize(entry, qSize);
     }
 
-    /**
-     * @return Distributed configuration.
-     */
-    public DistributedTransactionConfiguration getDistributedTransactionConfiguration() {
-        return distributedTransactionConfiguration;
-    }
-
     /** @param transform Transaction message transformer. */
     public void txMessageTransformer(BiFunction<GridCacheMessage, IgniteInternalTx, GridCacheMessage> transform) {
         txMsgTransform = transform;
@@ -3192,7 +3092,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         private static final int MAX_OBJS = 5;
 
         /** Store for keys and collisions queue sizes. */
-        private final Map<GridCacheMapEntry, Integer> stores[] = new LinkedHashMap[stripesCnt];
+        private final Map<GridCacheMapEntry, Integer>[] stores = new LinkedHashMap[stripesCnt];
 
         /** Metric per cache store. */
         private final Map<GridCacheAdapter<?, ?>, List<Map.Entry<GridCacheMapEntry, Integer>>> metricPerCacheStore =
@@ -3341,7 +3241,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                         salvageTx(tx, RECOVERY_FINISH);
                     }
                     else {
-                        // Check prepare only if originating node ID failed. Otherwise parent node will finish this tx.
+                        // Check prepare only if originating node ID failed. Otherwise, parent node will finish this tx.
                         if (tx.originatingNodeId().equals(evtNodeId)) {
                             if (tx.state() == PREPARED)
                                 processPrepared(tx, evtNodeId);
@@ -3465,10 +3365,10 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      */
     private static class TxThreadKey {
         /** Thread ID. */
-        private long threadId;
+        private final long threadId;
 
         /** Cache ID. */
-        private int cacheId;
+        private final int cacheId;
 
         /**
          * @param threadId Thread ID.
@@ -3734,10 +3634,10 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      */
     public class TxDumpsThrottling {
         /** */
-        private AtomicInteger skippedTxCntr = new AtomicInteger();
+        private final AtomicInteger skippedTxCntr = new AtomicInteger();
 
         /** */
-        private HitRateMetric transactionHitRateCntr = new HitRateMetric("transactionHitRateCounter", null, 1000, 2);
+        private final HitRateMetric transactionHitRateCntr = new HitRateMetric("transactionHitRateCounter", null, 1000, 2);
 
         /**
          * Returns should we skip dumping the transaction in current moment.
@@ -3776,7 +3676,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      */
     private class TxTimeoutOnPartitionMapExchangeChangeFuture extends GridFutureAdapter<Void> {
         /** */
-        private UUID id;
+        private final UUID id;
 
         /**
          * @param id Future ID.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetection.java
index 3ec833a29f7..6d767814898 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetection.java
@@ -46,7 +46,6 @@ import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_TIMEOUT;
 import static org.apache.ignite.IgniteSystemProperties.getInteger;
-import static org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager.DEADLOCK_MAX_ITERS;
 
 /**
  * Transactions deadlock detection.
@@ -285,7 +284,7 @@ public class TxDeadlockDetection {
 
             assert set;
 
-            if (nodeId == null || itersCnt++ >= DEADLOCK_MAX_ITERS || timedOut)
+            if (nodeId == null || itersCnt++ >= cctx.tm().deadlockMaxIters || timedOut)
                 onDone();
             else {
                 final Set<IgniteTxKey> txKeys = pendingKeys.get(nodeId);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/tx/ClientTxStartRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/tx/ClientTxStartRequest.java
index 49ce9a92d1a..ef93627f589 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/tx/ClientTxStartRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/tx/ClientTxStartRequest.java
@@ -75,8 +75,7 @@ public class ClientTxStartRequest extends ClientRequest {
                 true,
                 null,
                 0,
-                lb,
-                false
+                lb
             );
         }
         finally {
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDataConsistencyOnCommitFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDataConsistencyOnCommitFailureTest.java
index 76509672a37..804b9d34f4b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDataConsistencyOnCommitFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDataConsistencyOnCommitFailureTest.java
@@ -187,7 +187,7 @@ public class TxDataConsistencyOnCommitFailureTest extends GridCommonAbstractTest
             }
         }).when(mockTm).
             newTx(locTx.implicit(), locTx.implicitSingle(), null, locTx.concurrency(),
-                locTx.isolation(), locTx.timeout(), locTx.storeEnabled(), null, locTx.size(), locTx.label(), false);
+                locTx.isolation(), locTx.timeout(), locTx.storeEnabled(), null, locTx.size(), locTx.label());
 
         ctx.setTxManager(mockTm);
     }
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionNoHangsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionNoHangsTest.java
index 7a7651b6b53..5898f0a3701 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionNoHangsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionNoHangsTest.java
@@ -32,12 +32,12 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.junit.Test;
 
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_TIMEOUT;
 import static org.apache.ignite.IgniteSystemProperties.getInteger;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
@@ -107,44 +107,42 @@ public class TxDeadlockDetectionNoHangsTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     @Test
-    public void testNoHangsPessimistic() throws Exception {
+    public void testNoHangsPessimisticDetectionEnabled() throws Exception {
         assertTrue(grid(0).context().cache().context().tm().deadlockDetectionEnabled());
 
         doTest(PESSIMISTIC);
+    }
 
-        try {
-            GridTestUtils.setFieldValue(IgniteTxManager.class, "DEADLOCK_MAX_ITERS", 0);
-
-            assertFalse(grid(0).context().cache().context().tm().deadlockDetectionEnabled());
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    @WithSystemProperty(key = IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, value = "0")
+    public void testNoHangsPessimisticDetectionDisabled() throws Exception {
+        assertFalse(grid(0).context().cache().context().tm().deadlockDetectionEnabled());
 
-            doTest(PESSIMISTIC);
-        }
-        finally {
-            GridTestUtils.setFieldValue(IgniteTxManager.class, "DEADLOCK_MAX_ITERS",
-                IgniteSystemProperties.getInteger(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, 1000));
-        }
+        doTest(PESSIMISTIC);
     }
 
     /**
      * @throws Exception If failed.
      */
     @Test
-    public void testNoHangsOptimistic() throws Exception {
+    public void testNoHangsOptimisticDetectionEnabled() throws Exception {
         assertTrue(grid(0).context().cache().context().tm().deadlockDetectionEnabled());
 
         doTest(OPTIMISTIC);
+    }
 
-        try {
-            GridTestUtils.setFieldValue(IgniteTxManager.class, "DEADLOCK_MAX_ITERS", 0);
-
-            assertFalse(grid(0).context().cache().context().tm().deadlockDetectionEnabled());
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    @WithSystemProperty(key = IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, value = "0")
+    public void testNoHangsOptimisticDetectionDisabled() throws Exception {
+        assertFalse(grid(0).context().cache().context().tm().deadlockDetectionEnabled());
 
-            doTest(OPTIMISTIC);
-        }
-        finally {
-            GridTestUtils.setFieldValue(IgniteTxManager.class, "DEADLOCK_MAX_ITERS",
-                IgniteSystemProperties.getInteger(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, 1000));
-        }
+        doTest(OPTIMISTIC);
     }
 
     /**
diff --git a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
index 0ccfc4e9d8c..88c86b2040a 100644
--- a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
+++ b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
@@ -169,8 +169,7 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
                                 /*store enabled*/true,
                                 /*sql*/false,
                                 /*tx size*/0,
-                                null,
-                                false
+                                null
                             );
                         }