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 4274eb52b3179..ce1e953bedd5f 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 @@ -162,7 +162,6 @@ public GridDistributedTxRemoteAdapter( ctx, nodeId, xidVer, - null, Thread.currentThread().getId(), sys, plc, diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java index 5b86c8c521ade..891ba0b907707 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java @@ -557,8 +557,6 @@ public void rollbackDhtLocal() throws IgniteCheckedException { public IgniteInternalFuture rollbackDhtLocalAsync() { final GridDhtTxFinishFuture fut = new GridDhtTxFinishFuture<>(cctx, this, false); - rollbackFuture(fut); - cctx.mvcc().addFuture(fut, fut.futureId()); GridDhtTxPrepareFuture prepFut = this.prepFut; 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 352791bf50194..d498204161c11 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 @@ -4098,8 +4098,6 @@ public IgniteInternalFuture rollbackNearTxLocalAsync(final boo if (!FINISH_FUT_UPD.compareAndSet(this, null, fut = finishFuture(fastFinish = clearThreadMap && fastFinish(), false))) return chainFinishFuture(finishFut, false, clearThreadMap, onTimeout); - rollbackFuture(fut); - if (!fastFinish) { if (prepFut == null || prepFut.isDone()) { try { 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 3a404b6859bd3..0bd7e0028b276 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 @@ -138,19 +138,19 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement /** Transaction ID. */ @GridToStringInclude - protected GridCacheVersion xidVer; + protected final GridCacheVersion xidVer; /** Entries write version. */ @GridToStringInclude - protected GridCacheVersion writeVer; + private GridCacheVersion writeVer; /** Implicit flag. */ @GridToStringInclude - protected boolean implicit; + protected final boolean implicit; /** Local flag. */ @GridToStringInclude - protected boolean loc; + private final boolean loc; /** Thread ID. */ @GridToStringInclude @@ -158,37 +158,37 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement /** Transaction start time. */ @GridToStringInclude - protected long startTime = U.currentTimeMillis(); + protected final long startTime = U.currentTimeMillis(); /** Transaction start time in nanoseconds to measure duration. */ - protected long startTimeNanos; + private final long startTimeNanos; /** Node ID. */ @GridToStringInclude - protected UUID nodeId; + protected final UUID nodeId; /** Cache registry. */ @GridToStringExclude - protected GridCacheSharedContext cctx; + protected final GridCacheSharedContext cctx; /** Need return value. */ - protected boolean needRetVal; + private boolean needRetVal; /** Isolation. */ @GridToStringInclude - protected TransactionIsolation isolation = READ_COMMITTED; + protected final TransactionIsolation isolation; /** Concurrency. */ @GridToStringInclude - protected TransactionConcurrency concurrency = PESSIMISTIC; + protected final TransactionConcurrency concurrency; /** Transaction timeout. */ @GridToStringInclude - protected long timeout; + private long timeout; /** Deployment class loader id which will be used for deserialization of entries on a distributed task. */ @GridToStringExclude - protected IgniteUuid deploymentLdrId; + protected final IgniteUuid deploymentLdrId; /** Invalidate flag. */ protected volatile boolean invalidate; @@ -197,13 +197,13 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement private boolean sysInvalidate; /** Internal flag. */ - protected boolean internal; + private boolean internal; /** System transaction flag. */ - private boolean sys; + private final boolean sys; /** IO policy. */ - private byte plc; + private final byte plc; /** One phase commit flag. */ protected boolean onePhaseCommit; @@ -233,7 +233,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement private volatile boolean timedOut; /** */ - protected int txSize; + protected final int txSize; /** */ @GridToStringExclude @@ -247,19 +247,19 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement protected Map> txNodes; /** Subject ID initiated this transaction. */ - protected UUID subjId; + private final UUID subjId; /** Task name hash code. */ - protected int taskNameHash; + private final int taskNameHash; /** Task name. */ protected final String taskName; /** Store used flag. */ - protected boolean storeEnabled = true; + private boolean storeEnabled = true; /** UUID to consistent id mapper. */ - protected ConsistentIdMapper consistentIdMapper; + protected final ConsistentIdMapper consistentIdMapper; /** Mvcc tx update snapshot. */ @GridToStringInclude @@ -268,23 +268,9 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement /** Incremental snapshot ID. */ private @Nullable UUID incSnpId; - /** {@inheritDoc} */ - @Override public UUID incrementalSnapshotId() { - return incSnpId; - } - - /** {@inheritDoc} */ - @Override public void incrementalSnapshotId(UUID id) { - incSnpId = id; - } - /** {@code True} if tx should skip adding itself to completed version map on finish. */ private boolean skipCompletedVers; - /** Rollback finish future. */ - @GridToStringExclude - private volatile IgniteInternalFuture rollbackFut; - /** */ @SuppressWarnings("unused") @GridToStringExclude @@ -352,20 +338,18 @@ protected IgniteTxAdapter( consistentIdMapper = new ConsistentIdMapper(cctx.discovery()); boolean needTaskName = cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_READ) || - cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_PUT) || - cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_REMOVED); + cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_PUT) || + cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_REMOVED); taskName = needTaskName ? cctx.kernalContext().task().resolveTaskName(taskNameHash) : null; - if (cctx.kernalContext().performanceStatistics().enabled()) - startTimeNanos = System.nanoTime(); + startTimeNanos = cctx.kernalContext().performanceStatistics().enabled() ? System.nanoTime() : -1; } /** * @param cctx Cache registry. * @param nodeId Node ID. * @param xidVer Transaction ID. - * @param startVer Start version mark. * @param threadId Thread ID. * @param sys System transaction flag. * @param plc IO policy. @@ -378,7 +362,6 @@ protected IgniteTxAdapter( GridCacheSharedContext cctx, UUID nodeId, GridCacheVersion xidVer, - GridCacheVersion startVer, long threadId, boolean sys, byte plc, @@ -401,6 +384,7 @@ protected IgniteTxAdapter( this.txSize = txSize; this.subjId = subjId; this.taskNameHash = taskNameHash; + this.deploymentLdrId = null; implicit = false; loc = false; @@ -416,8 +400,17 @@ protected IgniteTxAdapter( taskName = needTaskName ? cctx.kernalContext().task().resolveTaskName(taskNameHash) : null; - if (cctx.kernalContext().performanceStatistics().enabled()) - startTimeNanos = System.nanoTime(); + startTimeNanos = cctx.kernalContext().performanceStatistics().enabled() ? System.nanoTime() : -1; + } + + /** {@inheritDoc} */ + @Override public UUID incrementalSnapshotId() { + return incSnpId; + } + + /** {@inheritDoc} */ + @Override public void incrementalSnapshotId(UUID id) { + incSnpId = id; } /** @@ -705,7 +698,7 @@ public boolean remote() { /** {@inheritDoc} */ @Override public Map> invalidPartitions() { - return invalidParts == null ? Collections.>emptyMap() : invalidParts; + return invalidParts == null ? Collections.emptyMap() : invalidParts; } /** {@inheritDoc} */ @@ -757,20 +750,6 @@ public void needReturnValue(boolean needRetVal) { this.needRetVal = needRetVal; } - /** - * @return Rollback future. - */ - public IgniteInternalFuture rollbackFuture() { - return rollbackFut; - } - - /** - * @param fut Rollback future. - */ - public void rollbackFuture(IgniteInternalFuture fut) { - rollbackFut = fut; - } - /** * Gets remaining allowed transaction time. * @@ -1152,16 +1131,20 @@ protected final boolean state(TransactionState state, boolean timedOut) { break; } + + case SUSPENDED: case PREPARING: { valid = prev == ACTIVE; break; } + case PREPARED: { valid = prev == PREPARING; break; } + case COMMITTING: { valid = prev == PREPARED; @@ -1207,12 +1190,6 @@ protected final boolean state(TransactionState state, boolean timedOut) { break; } - - case SUSPENDED: { - valid = prev == ACTIVE; - - break; - } } if (valid) { @@ -1918,8 +1895,7 @@ protected boolean evictNearEntry(IgniteTxEntry e, boolean primaryOnly) { if (log.isDebugEnabled()) log.debug("Evicting dht-local entry from near cache [entry=" + cached + ", tx=" + this + ']'); - if (cached != null && cached.markObsolete(xidVer)) - return true; + return cached.markObsolete(xidVer); } return false; @@ -2028,7 +2004,7 @@ protected void applyTxSizes() { private static class TxFinishFuture extends GridFutureAdapter { /** */ @GridToStringInclude - private IgniteTxAdapter tx; + private final IgniteTxAdapter tx; /** */ private volatile long completionTime;