From 2280deabd396680f85e1599a22ca2607037522d3 Mon Sep 17 00:00:00 2001 From: Ilya Shishkov Date: Fri, 6 Sep 2024 19:32:58 +0300 Subject: [PATCH] IGNITE-22920 Final cleanup of GridDhtTxFinishRequest (#11477) --- .../dht/GridDhtTxFinishFuture.java | 11 - .../dht/GridDhtTxFinishRequest.java | 204 +----------------- .../near/GridNearTxFinishFuture.java | 2 - 3 files changed, 5 insertions(+), 212 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java index 72155efe99b2d..d9ebf5d6ef00e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java @@ -364,7 +364,6 @@ private boolean rollbackLockTransactions(Collection nodes) { tx.xidVersion(), tx.commitVersion(), tx.threadId(), - tx.isolation(), false, tx.isInvalidate(), tx.system(), @@ -374,7 +373,6 @@ private boolean rollbackLockTransactions(Collection nodes) { tx.completedBase(), tx.committedVersions(), tx.rolledbackVersions(), - tx.pendingVersions(), tx.size(), tx.taskNameHash(), tx.activeCachesDeploymentEnabled(), @@ -461,7 +459,6 @@ private boolean finish(boolean commit, tx.xidVersion(), tx.commitVersion(), tx.threadId(), - tx.isolation(), commit, tx.isInvalidate(), tx.system(), @@ -471,17 +468,13 @@ private boolean finish(boolean commit, tx.completedBase(), tx.committedVersions(), tx.rolledbackVersions(), - tx.pendingVersions(), tx.size(), tx.taskNameHash(), tx.activeCachesDeploymentEnabled(), - null, false, false, commit ? null : cctx.tm().txHandler().filterUpdateCountersForBackupNode(tx, n)); - req.writeVersion(tx.writeVersion() != null ? tx.writeVersion() : tx.xidVersion()); - try { if (isNull(cctx.discovery().getAlive(n.id()))) { log.error("Unable to send message (node left topology): " + n); @@ -538,7 +531,6 @@ private boolean finish(boolean commit, tx.xidVersion(), tx.commitVersion(), tx.threadId(), - tx.isolation(), commit, tx.isInvalidate(), tx.system(), @@ -548,7 +540,6 @@ private boolean finish(boolean commit, tx.completedBase(), tx.committedVersions(), tx.rolledbackVersions(), - tx.pendingVersions(), tx.size(), tx.taskNameHash(), tx.activeCachesDeploymentEnabled(), @@ -556,8 +547,6 @@ private boolean finish(boolean commit, false, null); - req.writeVersion(tx.writeVersion()); - try { cctx.io().send(nearMapping.primary(), req, tx.ioPolicy()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java index 7b8d329fd79c5..1b3b4e4aa661b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java @@ -26,15 +26,12 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishRequest; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.util.GridLongList; -import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType; import org.apache.ignite.plugin.extensions.communication.MessageReader; import org.apache.ignite.plugin.extensions.communication.MessageWriter; -import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.NotNull; /** @@ -47,25 +44,9 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest { /** Near node ID. */ private UUID nearNodeId; - /** Transaction isolation. */ - private TransactionIsolation isolation; - /** Mini future ID. */ private int miniId; - /** Pending versions with order less than one for this message (needed for commit ordering). */ - @GridToStringInclude - @GridDirectCollection(GridCacheVersion.class) - private Collection pendingVers; - - /** Partition update counter. */ - @GridToStringInclude - @GridDirectCollection(Long.class) - private GridLongList partUpdateCnt; - - /** One phase commit write version. */ - private GridCacheVersion writeVer; - /** */ @GridDirectCollection(PartitionUpdateCountersMessage.class) private Collection updCntrs; @@ -85,7 +66,6 @@ public GridDhtTxFinishRequest() { * @param xidVer Transaction ID. * @param threadId Thread ID. * @param commitVer Commit version. - * @param isolation Transaction isolation. * @param commit Commit flag. * @param invalidate Invalidate flag. * @param sys System flag. @@ -95,7 +75,6 @@ public GridDhtTxFinishRequest() { * @param baseVer Base version. * @param committedVers Committed versions. * @param rolledbackVers Rolled back versions. - * @param pendingVers Pending versions. * @param txSize Expected transaction size. * @param taskNameHash Task name hash. * @param addDepInfo Deployment info flag. @@ -111,7 +90,6 @@ public GridDhtTxFinishRequest( GridCacheVersion xidVer, GridCacheVersion commitVer, long threadId, - TransactionIsolation isolation, boolean commit, boolean invalidate, boolean sys, @@ -121,7 +99,6 @@ public GridDhtTxFinishRequest( GridCacheVersion baseVer, Collection committedVers, Collection rolledbackVers, - Collection pendingVers, int txSize, int taskNameHash, boolean addDepInfo, @@ -149,11 +126,8 @@ public GridDhtTxFinishRequest( assert miniId != 0; assert nearNodeId != null; - assert isolation != null; - this.pendingVers = pendingVers; this.nearNodeId = nearNodeId; - this.isolation = isolation; this.miniId = miniId; this.updCntrs = updCntrs; @@ -162,93 +136,6 @@ public GridDhtTxFinishRequest( systemInvalidate(sysInvalidate); } - /** - * @param nearNodeId Near node ID. - * @param futId Future ID. - * @param miniId Mini future ID. - * @param topVer Topology version. - * @param xidVer Transaction ID. - * @param threadId Thread ID. - * @param commitVer Commit version. - * @param isolation Transaction isolation. - * @param commit Commit flag. - * @param invalidate Invalidate flag. - * @param sys System flag. - * @param plc IO policy. - * @param sysInvalidate System invalidation flag. - * @param syncMode Write synchronization mode. - * @param baseVer Base version. - * @param committedVers Committed versions. - * @param rolledbackVers Rolled back versions. - * @param pendingVers Pending versions. - * @param txSize Expected transaction size. - * @param taskNameHash Task name hash. - * @param updateIdxs Partition update idxs. - * @param addDepInfo Deployment info flag. - * @param retVal Need return value - * @param waitRemoteTxs Wait remote transactions flag - * @param updCntrs Update counters for Tx. - */ - public GridDhtTxFinishRequest( - UUID nearNodeId, - IgniteUuid futId, - int miniId, - @NotNull AffinityTopologyVersion topVer, - GridCacheVersion xidVer, - GridCacheVersion commitVer, - long threadId, - TransactionIsolation isolation, - boolean commit, - boolean invalidate, - boolean sys, - byte plc, - boolean sysInvalidate, - CacheWriteSynchronizationMode syncMode, - GridCacheVersion baseVer, - Collection committedVers, - Collection rolledbackVers, - Collection pendingVers, - int txSize, - int taskNameHash, - boolean addDepInfo, - Collection updateIdxs, - boolean retVal, - boolean waitRemoteTxs, - Collection updCntrs - ) { - this(nearNodeId, - futId, - miniId, - topVer, - xidVer, - commitVer, - threadId, - isolation, - commit, - invalidate, - sys, - plc, - sysInvalidate, - syncMode, - baseVer, - committedVers, - rolledbackVers, - pendingVers, - txSize, - taskNameHash, - addDepInfo, - retVal, - waitRemoteTxs, - updCntrs); - } - - /** - * @return Partition update counters. - */ - public GridLongList partUpdateCounters() { - return partUpdateCnt; - } - /** * @return Mini ID. */ @@ -256,13 +143,6 @@ public int miniId() { return miniId; } - /** - * @return Transaction isolation. - */ - public TransactionIsolation isolation() { - return isolation; - } - /** * @return Near node ID. */ @@ -284,20 +164,6 @@ private void systemInvalidate(boolean sysInvalidate) { setFlag(sysInvalidate, SYS_INVALIDATE_FLAG_MASK); } - /** - * @return Write version for one-phase commit transactions. - */ - public GridCacheVersion writeVersion() { - return writeVer; - } - - /** - * @param writeVer Write version for one-phase commit transactions. - */ - public void writeVersion(GridCacheVersion writeVer) { - this.writeVer = writeVer; - } - /** * @return Check committed flag. */ @@ -363,47 +229,23 @@ public Collection updateCounters() { switch (writer.state()) { case 21: - if (!writer.writeByte("isolation", isolation != null ? (byte)isolation.ordinal() : -1)) - return false; - - writer.incrementState(); - - case 22: if (!writer.writeInt("miniId", miniId)) return false; writer.incrementState(); - case 23: + case 22: if (!writer.writeUuid("nearNodeId", nearNodeId)) return false; writer.incrementState(); - case 24: - if (!writer.writeMessage("partUpdateCnt", partUpdateCnt)) - return false; - - writer.incrementState(); - - case 25: - if (!writer.writeCollection("pendingVers", pendingVers, MessageCollectionItemType.MSG)) - return false; - - writer.incrementState(); - - case 26: + case 23: if (!writer.writeCollection("updCntrs", updCntrs, MessageCollectionItemType.MSG)) return false; writer.incrementState(); - case 27: - if (!writer.writeMessage("writeVer", writeVer)) - return false; - - writer.incrementState(); - } return true; @@ -421,18 +263,6 @@ public Collection updateCounters() { switch (reader.state()) { case 21: - byte isolationOrd; - - isolationOrd = reader.readByte("isolation"); - - if (!reader.isLastRead()) - return false; - - isolation = TransactionIsolation.fromOrdinal(isolationOrd); - - reader.incrementState(); - - case 22: miniId = reader.readInt("miniId"); if (!reader.isLastRead()) @@ -440,7 +270,7 @@ public Collection updateCounters() { reader.incrementState(); - case 23: + case 22: nearNodeId = reader.readUuid("nearNodeId"); if (!reader.isLastRead()) @@ -448,23 +278,7 @@ public Collection updateCounters() { reader.incrementState(); - case 24: - partUpdateCnt = reader.readMessage("partUpdateCnt"); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 25: - pendingVers = reader.readCollection("pendingVers", MessageCollectionItemType.MSG); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 26: + case 23: updCntrs = reader.readCollection("updCntrs", MessageCollectionItemType.MSG); if (!reader.isLastRead()) @@ -472,14 +286,6 @@ public Collection updateCounters() { reader.incrementState(); - case 27: - writeVer = reader.readMessage("writeVer"); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - } return reader.afterMessageRead(GridDhtTxFinishRequest.class); @@ -492,7 +298,7 @@ public Collection updateCounters() { /** {@inheritDoc} */ @Override public byte fieldsCount() { - return 28; + return 24; } /** {@inheritDoc} */ 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 f86c4e01eb580..f3f56b4c424a9 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 @@ -875,7 +875,6 @@ private GridDhtTxFinishRequest checkCommittedRequest(int miniId, boolean waitRem tx.xidVersion(), tx.commitVersion(), tx.threadId(), - tx.isolation(), true, false, tx.system(), @@ -885,7 +884,6 @@ private GridDhtTxFinishRequest checkCommittedRequest(int miniId, boolean waitRem null, null, null, - null, 0, 0, tx.activeCachesDeploymentEnabled(),