Skip to content

Commit

Permalink
IGNITE-20088 GridDhtTxRemote initial cleanup (#10862)
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-vinogradov authored Aug 1, 2023
1 parent 92650b0 commit 5eab58f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ protected GridDhtTransactionalCacheAdapter(GridCacheContext<K, V> ctx, GridCache
tx = new GridDhtTxRemote(
ctx.shared(),
req.nodeId(),
req.futureId(),
nodeId,
req.nearXidVersion(),
req.topologyVersion(),
Expand Down Expand Up @@ -2230,7 +2229,6 @@ private void processDhtTxQueryEnlistRequest(UUID primary, GridDhtTxQueryEnlistRe

tx = new GridDhtTxRemote(ctx.shared(),
req0.nearNodeId(),
req0.dhtFutureId(),
primary,
req0.nearXidVersion(),
req0.topologyVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
import org.jetbrains.annotations.Nullable;
Expand All @@ -52,23 +51,19 @@
*/
public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
/** Near node ID. */
private UUID nearNodeId;

/** Remote future ID. */
private IgniteUuid rmtFutId;
private final UUID nearNodeId;

/** Near transaction ID. */
private GridCacheVersion nearXidVer;
private final GridCacheVersion nearXidVer;

/** Store write through flag. */
private boolean storeWriteThrough;
private final boolean storeWriteThrough;

/**
* This constructor is meant for optimistic transactions.
*
* @param ctx Cache context.
* @param nearNodeId Near node ID.
* @param rmtFutId Remote future ID.
* @param nodeId Node ID.
* @param topVer Topology version.
* @param xidVer XID version.
Expand All @@ -87,7 +82,6 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
public GridDhtTxRemote(
GridCacheSharedContext ctx,
UUID nearNodeId,
IgniteUuid rmtFutId,
UUID nodeId,
AffinityTopologyVersion topVer,
GridCacheVersion xidVer,
Expand Down Expand Up @@ -124,18 +118,16 @@ public GridDhtTxRemote(
);

assert nearNodeId != null;
assert rmtFutId != null;

this.nearNodeId = nearNodeId;
this.rmtFutId = rmtFutId;
this.nearXidVer = nearXidVer;
this.txNodes = txNodes;
this.storeWriteThrough = storeWriteThrough;

txState = single ? new IgniteTxRemoteSingleStateImpl() :
new IgniteTxRemoteStateImpl(
Collections.<IgniteTxKey, IgniteTxEntry>emptyMap(),
new ConcurrentLinkedHashMap<IgniteTxKey, IgniteTxEntry>(U.capacity(txSize), 0.75f, 1));
Collections.emptyMap(),
new ConcurrentLinkedHashMap<>(U.capacity(txSize), 0.75f, 1));

assert topVer != null && topVer.topologyVersion() > 0 : topVer;

Expand All @@ -147,7 +139,6 @@ public GridDhtTxRemote(
*
* @param ctx Cache context.
* @param nearNodeId Near node ID.
* @param rmtFutId Remote future ID.
* @param nodeId Node ID.
* @param nearXidVer Near transaction ID.
* @param topVer Topology version.
Expand All @@ -165,7 +156,6 @@ public GridDhtTxRemote(
public GridDhtTxRemote(
GridCacheSharedContext ctx,
UUID nearNodeId,
IgniteUuid rmtFutId,
UUID nodeId,
GridCacheVersion nearXidVer,
AffinityTopologyVersion topVer,
Expand Down Expand Up @@ -200,29 +190,20 @@ public GridDhtTxRemote(
);

assert nearNodeId != null;
assert rmtFutId != null;

this.nearXidVer = nearXidVer;
this.nearNodeId = nearNodeId;
this.rmtFutId = rmtFutId;
this.storeWriteThrough = storeWriteThrough;

txState = new IgniteTxRemoteStateImpl(
Collections.<IgniteTxKey, IgniteTxEntry>emptyMap(),
new ConcurrentLinkedHashMap<IgniteTxKey, IgniteTxEntry>(U.capacity(txSize), 0.75f, 1));
Collections.emptyMap(),
new ConcurrentLinkedHashMap<>(U.capacity(txSize), 0.75f, 1));

assert topVer != null && topVer.topologyVersion() > 0 : topVer;

topologyVersion(topVer);
}

/**
* @param txNodes Transaction nodes.
*/
@Override public void transactionNodes(Map<UUID, Collection<UUID>> txNodes) {
this.txNodes = txNodes;
}

/** {@inheritDoc} */
@Override public boolean remote() {
return true;
Expand Down Expand Up @@ -270,13 +251,6 @@ public UUID nearNodeId() {
return nearNodeId;
}

/**
* @return Remote future ID.
*/
IgniteUuid remoteFutureId() {
return rmtFutId;
}

/** {@inheritDoc} */
@Override protected boolean updateNearCache(GridCacheContext cacheCtx, KeyCacheObject key, AffinityTopologyVersion topVer) {
if (!cacheCtx.isDht() || !isNearEnabled(cacheCtx) || cctx.localNodeId().equals(nearNodeId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ private void processBatchLocalBackupKeys(UUID primaryId, List<Object> rows, Grid
if (dhtTx == null) {
dhtTx = new GridDhtTxRemote(cctx.shared(),
cctx.localNodeId(),
dhtFutId,
primaryId,
lockVer,
topVer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ private void processBatchLocalBackupKeys(UUID primaryId, List<Object> rows, Grid
if (dhtTx == null) {
dhtTx = new GridDhtTxRemote(cctx.shared(),
cctx.localNodeId(),
dhtFutId,
primaryId,
lockVer,
topVer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,6 @@ private void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committe
tx = new GridDhtTxRemote(
ctx,
req.nearNodeId(),
req.futureId(),
nodeId,
req.topologyVersion(),
req.version(),
Expand Down

0 comments on commit 5eab58f

Please sign in to comment.