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

NSAmelchev 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 d5bb2a9806e IGNITE-29104 Remove dead code from lock candidates and 
transaction size tracking (#13651)
d5bb2a9806e is described below

commit d5bb2a9806e47762fc150275ea2fcc6d802ed997
Author: Nikita Amelchev <[email protected]>
AuthorDate: Tue Oct 6 18:28:29 2026 +0300

    IGNITE-29104 Remove dead code from lock candidates and transaction size 
tracking (#13651)
---
 .../processors/cache/GridCacheMvccCandidate.java   | 104 +++------------------
 .../GridDistributedTxRemoteAdapter.java            |   3 -
 .../cache/transactions/IgniteTxAdapter.java        |  67 -------------
 .../cache/transactions/IgniteTxLocalAdapter.java   |   3 -
 .../processors/cache/transactions/TxCounters.java  |  10 --
 .../main/resources/META-INF/classnames.properties  |   1 -
 6 files changed, 13 insertions(+), 175 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
index d0e624f94bb..68106588371 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
@@ -17,20 +17,13 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
-import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
@@ -53,81 +46,63 @@ import static 
org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate
 /**
  * Lock candidate.
  */
-public class GridCacheMvccCandidate implements Externalizable,
-    Comparable<GridCacheMvccCandidate>, CacheLockCandidates {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** ID generator. */
-    private static final AtomicLong IDGEN = new AtomicLong();
-
+public class GridCacheMvccCandidate implements CacheLockCandidates {
     /** Locking node ID. */
     @GridToStringInclude
-    private UUID nodeId;
+    private final UUID nodeId;
 
     /** Lock version. */
     @GridToStringInclude
-    private GridCacheVersion ver;
+    private final GridCacheVersion ver;
 
     /** Thread ID. */
     @GridToStringInclude
-    private long threadId;
+    private final long threadId;
 
     /** Use flags approach to preserve space. */
     @GridToStringExclude
     private short flags;
 
-    /** ID. */
-    private long id;
-
     /** Topology version. */
-    @SuppressWarnings( {"TransientFieldNotInitialized"})
     @GridToStringInclude
-    private transient volatile AffinityTopologyVersion topVer = 
AffinityTopologyVersion.NONE;
+    private volatile AffinityTopologyVersion topVer = 
AffinityTopologyVersion.NONE;
 
     /** Linked reentry. */
     private GridCacheMvccCandidate reentry;
 
     /** Previous lock for the thread. */
     @GridToStringExclude
-    private transient volatile GridCacheMvccCandidate prev;
+    private volatile GridCacheMvccCandidate prev;
 
     /** Next lock for the thread. */
     @GridToStringExclude
-    private transient volatile GridCacheMvccCandidate next;
+    private volatile GridCacheMvccCandidate next;
 
     /** Parent entry. */
     @GridToStringExclude
-    private transient GridCacheEntryEx parent;
+    private GridCacheEntryEx parent;
 
     /** Alternate node ID specifying additional node involved in this lock. */
-    private transient volatile UUID otherNodeId;
+    private volatile UUID otherNodeId;
 
     /** Other lock version (near version vs dht version). */
-    private transient GridCacheVersion otherVer;
+    private GridCacheVersion otherVer;
 
     /** Mapped DHT node IDs. */
     @GridToStringInclude
-    private transient volatile Collection<ClusterNode> mappedDhtNodes;
+    private volatile Collection<ClusterNode> mappedDhtNodes;
 
     /** Mapped near node IDs. */
     @GridToStringInclude
-    private transient volatile Collection<ClusterNode> mappedNearNodes;
+    private volatile Collection<ClusterNode> mappedNearNodes;
 
     /** Owned lock version by the moment this candidate was added. */
     @GridToStringInclude
-    private transient volatile GridCacheVersion ownerVer;
+    private volatile GridCacheVersion ownerVer;
 
     /** */
     private GridCacheVersion serOrder;
 
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridCacheMvccCandidate() {
-        /* No-op. */
-    }
-
     /**
      * @param parent Parent entry.
      * @param nodeId Requesting node ID.
@@ -179,8 +154,6 @@ public class GridCacheMvccCandidate implements 
Externalizable,
         mask(NEAR_LOCAL, nearLoc);
         mask(DHT_LOCAL, dhtLoc);
         mask(READ, read);
-
-        id = IDGEN.incrementAndGet();
     }
 
     /**
@@ -624,57 +597,6 @@ public class GridCacheMvccCandidate implements 
Externalizable,
         return this.ver.equals(ver);
     }
 
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        IgniteUtils.writeUuid(out, nodeId);
-
-        out.writeBoolean(ver == null);
-
-        if (ver != null) {
-            out.writeBoolean(ver instanceof GridCacheVersionEx);
-
-            ver.writeExternal(out);
-        }
-
-        out.writeLong(threadId);
-        out.writeLong(id);
-        out.writeShort(flags());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-        nodeId = IgniteUtils.readUuid(in);
-
-        if (!in.readBoolean()) {
-            ver = in.readBoolean() ? new GridCacheVersionEx() : new 
GridCacheVersion();
-
-            ver.readExternal(in);
-        }
-
-        threadId = in.readLong();
-        id = in.readLong();
-
-        short flags = in.readShort();
-
-        mask(OWNER, OWNER.get(flags));
-        mask(USED, USED.get(flags));
-        mask(TX, TX.get(flags));
-    }
-
-    /** {@inheritDoc} */
-    @Override public int compareTo(GridCacheMvccCandidate o) {
-        if (o == this)
-            return 0;
-
-        int c = ver.compareTo(o.ver);
-
-        // This is done, so compare and equals methods will be consistent.
-        if (c == 0)
-            return key().equals(o.key()) ? 0 : id < o.id ? -1 : 1;
-
-        return c;
-    }
-
     /** {@inheritDoc} */
     @Override public boolean equals(Object o) {
         if (o == null)
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 77e5d9aa97a..d092547d7db 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
@@ -759,9 +759,6 @@ public abstract class GridDistributedTxRemoteAdapter 
extends IgniteTxAdapter imp
                             }
                         }
 
-                        // Apply cache size deltas.
-                        applyTxSizes();
-
                         TxCounters txCntrs = txCounters(false);
 
                         // Apply update counters.
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 9eb50bc0c65..3a058189d09 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
@@ -29,7 +29,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import javax.cache.expiry.ExpiryPolicy;
@@ -56,10 +55,6 @@ import 
org.apache.ignite.internal.processors.cache.GridCacheOperation;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import 
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException;
-import 
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
-import 
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
-import 
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
 import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
@@ -1924,68 +1919,6 @@ public abstract class IgniteTxAdapter extends 
GridMetadataAwareAdapter implement
         return txCounters;
     }
 
-    /**
-     * Makes cache sizes changes accumulated during transaction visible 
outside of transaction.
-     */
-    protected void applyTxSizes() {
-        TxCounters txCntrs = txCounters(false);
-
-        if (txCntrs == null)
-            return;
-
-        Map<Integer, ? extends Map<Integer, AtomicLong>> sizeDeltas = 
txCntrs.sizeDeltas();
-
-        for (Map.Entry<Integer, ? extends Map<Integer, AtomicLong>> entry : 
sizeDeltas.entrySet()) {
-            Integer cacheId = entry.getKey();
-            Map<Integer, AtomicLong> deltas = entry.getValue();
-
-            assert !F.isEmpty(deltas);
-
-            GridDhtPartitionTopology top = 
cctx.cacheContext(cacheId).topology();
-
-            // Need to reserve on backups only
-            boolean reserve = dht() && remote();
-
-            for (Map.Entry<Integer, AtomicLong> e : deltas.entrySet()) {
-                boolean invalid = false;
-                int p = e.getKey();
-                long delta = e.getValue().get();
-
-                try {
-                    GridDhtLocalPartition part = top.localPartition(p);
-
-                    if (!reserve || part != null && part.reserve()) {
-                        assert part != null;
-
-                        try {
-                            if (part.state() != GridDhtPartitionState.RENTING)
-                                part.dataStore().updateSize(cacheId, delta);
-                            else
-                                invalid = true;
-                        }
-                        finally {
-                            if (reserve)
-                                part.release();
-                        }
-                    }
-                    else
-                        invalid = true;
-                }
-                catch (GridDhtInvalidPartitionException e1) {
-                    invalid = true;
-                }
-
-                if (invalid) {
-                    assert reserve;
-
-                    if (log.isDebugEnabled())
-                        log.debug("Trying to apply size delta for invalid 
partition: " +
-                            "[cacheId=" + cacheId + ", part=" + p + "]");
-                }
-            }
-        }
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return GridToStringBuilder.toString(IgniteTxAdapter.class, this,
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 67e72fd1fb1..ac785c0e731 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
@@ -845,9 +845,6 @@ public abstract class IgniteTxLocalAdapter extends 
IgniteTxAdapter implements Ig
                 if (txCounters != null)
                     
cctx.tm().txHandler().applyPartitionsUpdatesCounters(txCounters.updateCounters());
 
-                // Apply cache sizes only for primary nodes. Update counters 
were applied on prepare state.
-                applyTxSizes();
-
                 if (ptr != null)
                     cctx.wal(true).flush(ptr, false);
             }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxCounters.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxCounters.java
index 2b7bb021727..b0bbcdf0225 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxCounters.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxCounters.java
@@ -30,22 +30,12 @@ import org.jetbrains.annotations.Nullable;
  * Values which should be tracked during transaction execution and applied on 
commit.
  */
 public class TxCounters {
-    /** Size changes for cache partitions made by transaction */
-    private final Map<Integer, Map<Integer, AtomicLong>> sizeDeltas = new 
ConcurrentHashMap<>();
-
     /** Per-partition update counter accumulator. */
     private final Map<Integer, Map<Integer, AtomicLong>> updCntrsAcc = new 
HashMap<>();
 
     /** Final update counters for cache partitions in the end of transaction */
     private volatile Map<Integer, PartitionUpdateCountersMessage> updCntrs;
 
-    /**
-     * @return Map of size changes for cache partitions made by transaction.
-     */
-    public Map<Integer, Map<Integer, AtomicLong>> sizeDeltas() {
-        return sizeDeltas;
-    }
-
     /**
      * @param updCntrs Final update counters.
      */
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties 
b/modules/core/src/main/resources/META-INF/classnames.properties
index 65f0244da47..aefefd45c16 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -925,7 +925,6 @@ org.apache.ignite.internal.processors.cache.GridCacheLogger
 org.apache.ignite.internal.processors.cache.GridCacheMapEntry$1
 org.apache.ignite.internal.processors.cache.GridCacheMessage
 org.apache.ignite.internal.processors.cache.GridCacheMultiTxFuture$1
-org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate
 org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate$Mask
 org.apache.ignite.internal.processors.cache.GridCacheMvccManager$6
 org.apache.ignite.internal.processors.cache.GridCacheMvccManager$7

Reply via email to