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 3a65fede709 IGNITE-29249 Reduce allocations on the cache get path
(#13788)
3a65fede709 is described below
commit 3a65fede70948b8a547fb46a1ff50ebc7c8296ce
Author: Nikita Amelchev <[email protected]>
AuthorDate: Wed Nov 11 17:04:30 2026 +0300
IGNITE-29249 Reduce allocations on the cache get path (#13788)
---
.../cache/distributed/dht/GridDhtGetFuture.java | 26 ----------------------
.../distributed/dht/GridDhtGetSingleFuture.java | 26 ----------------------
.../cluster/GridClusterStateProcessor.java | 15 +++++++++++--
3 files changed, 13 insertions(+), 54 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index 8d52758910c..2c736853403 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -38,7 +38,6 @@ import
org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.ReaderArguments;
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.version.GridCacheVersion;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridCompoundIdentityFuture;
import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
@@ -49,7 +48,6 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -88,12 +86,6 @@ public final class GridDhtGetFuture<K, V> extends
GridCompoundIdentityFuture<Col
/** Reserved partitions. */
private int[] parts;
- /** Future ID. */
- private IgniteUuid futId;
-
- /** Version. */
- private GridCacheVersion ver;
-
/** Topology version .*/
private AffinityTopologyVersion topVer;
@@ -162,10 +154,6 @@ public final class GridDhtGetFuture<K, V> extends
GridCompoundIdentityFuture<Col
this.addReaders = addReaders;
this.txLbl = txLbl;
- futId = IgniteUuid.randomUuid();
-
- ver = cctx.cache().nextVersion();
-
if (log == null)
log = U.logger(cctx.kernalContext(), logRef,
GridDhtGetFuture.class);
}
@@ -217,20 +205,6 @@ public final class GridDhtGetFuture<K, V> extends
GridCompoundIdentityFuture<Col
return retries == null ? Collections.<Integer>emptyList() : retries;
}
- /**
- * @return Future ID.
- */
- public IgniteUuid futureId() {
- return futId;
- }
-
- /**
- * @return Future version.
- */
- public GridCacheVersion version() {
- return ver;
- }
-
/** {@inheritDoc} */
@Override public boolean onDone(Collection<GridCacheEntryInfo> res,
Throwable err) {
if (super.onDone(res, err)) {
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index 24ce1643fea..806ea4f88e4 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -36,12 +36,10 @@ import
org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.ReaderArguments;
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.version.GridCacheVersion;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -80,12 +78,6 @@ public final class GridDhtGetSingleFuture<K, V> extends
GridFutureAdapter<GridCa
/** Reserved partitions. */
private int part = -1;
- /** Future ID. */
- private IgniteUuid futId;
-
- /** Version. */
- private GridCacheVersion ver;
-
/** Topology version .*/
private AffinityTopologyVersion topVer;
@@ -150,10 +142,6 @@ public final class GridDhtGetSingleFuture<K, V> extends
GridFutureAdapter<GridCa
this.recovery = recovery;
this.txLbl = txLbl;
- futId = IgniteUuid.randomUuid();
-
- ver = cctx.cache().nextVersion();
-
if (log == null)
log = U.logger(cctx.kernalContext(), logRef,
GridDhtGetSingleFuture.class);
}
@@ -165,20 +153,6 @@ public final class GridDhtGetSingleFuture<K, V> extends
GridFutureAdapter<GridCa
map();
}
- /**
- * @return Future ID.
- */
- public IgniteUuid futureId() {
- return futId;
- }
-
- /**
- * @return Future version.
- */
- public GridCacheVersion version() {
- return ver;
- }
-
/** {@inheritDoc} */
@Override public boolean onDone(GridCacheEntryInfo res, Throwable err) {
if (super.onDone(res, err)) {
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index f1f15bc8277..9ed156f6554 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -310,6 +310,12 @@ public class GridClusterStateProcessor extends
GridProcessorAdapter implements I
/** {@inheritDoc} */
@Override public ClusterState publicApiState(boolean waitForTransition) {
+ DiscoveryDataClusterState globalState = this.globalState;
+
+ // Fast path without futures.
+ if (!transitionToActive(globalState))
+ return globalState.state();
+
return publicApiStateAsync(waitForTransition).get();
}
@@ -319,7 +325,7 @@ public class GridClusterStateProcessor extends
GridProcessorAdapter implements I
assert globalState != null;
- if (globalState.transition() && globalState.state().active()) {
+ if (transitionToActive(globalState)) {
ClusterState transitionRes = globalState.transitionResult();
if (transitionRes != null)
@@ -354,7 +360,7 @@ public class GridClusterStateProcessor extends
GridProcessorAdapter implements I
/** {@inheritDoc} */
@Override public boolean publicApiActiveState(boolean waitForTransition) {
- return publicApiActiveStateAsync(waitForTransition).get();
+ return publicApiState(waitForTransition).active();
}
/** {@inheritDoc} */
@@ -2033,6 +2039,11 @@ public class GridClusterStateProcessor extends
GridProcessorAdapter implements I
}
}
+ /** @return {@code True} if a transition to an active state is in
progress. */
+ private boolean transitionToActive(DiscoveryDataClusterState state) {
+ return state.transition() && state.state().active();
+ }
+
/**
*
*/