This is an automated email from the ASF dual-hosted git repository.
shishkovilja 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 caa5697ddd6 IGNITE-28256 Remove IntLongMap (#12909)
caa5697ddd6 is described below
commit caa5697ddd65c17b51e2022de59166b67bb38ce3
Author: Aleksandr Chesnokov <[email protected]>
AuthorDate: Mon Mar 30 15:08:33 2026 +0300
IGNITE-28256 Remove IntLongMap (#12909)
---
.../communication/GridIoMessageFactory.java | 3 --
.../cache/GridCachePartitionExchangeManager.java | 10 ++--
.../preloader/GridDhtPartitionsExchangeFuture.java | 6 +--
.../preloader/GridDhtPartitionsFullMessage.java | 6 +--
.../preloader/GridDhtPartitionsSingleMessage.java | 19 +++-----
.../distributed/dht/preloader/IntLongMap.java | 53 ----------------------
6 files changed, 16 insertions(+), 81 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 0460477cf12..edeef1147bd 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -195,8 +195,6 @@ import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Ign
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMapSerializer;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMapSerializer;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IntLongMap;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IntLongMapSerializer;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.LatchAckMessage;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.LatchAckMessageSerializer;
import
org.apache.ignite.internal.processors.cache.distributed.near.CacheVersionedValue;
@@ -559,7 +557,6 @@ public class GridIoMessageFactory implements
MessageFactoryProvider {
new IgniteDhtPartitionHistorySuppliersMapSerializer());
factory.register(513, IgniteDhtPartitionsToReloadMap::new,
new IgniteDhtPartitionsToReloadMapSerializer());
- factory.register(514, IntLongMap::new, new IntLongMapSerializer());
factory.register(517, GridPartitionStateMap::new, new
GridPartitionStateMapSerializer());
factory.register(518, GridDhtPartitionMap::new, new
GridDhtPartitionMapSerializer());
factory.register(519, GridDhtPartitionFullMap::new, new
GridDhtPartitionFullMapSerializer());
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 2e74d951397..55ae24bbaa3 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@@ -90,7 +89,6 @@ import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IntLongMap;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.PartitionsExchangeAware;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.RebalanceReassignExchangeTask;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.StopCachesOnClientReconnectExchangeTask;
@@ -1433,7 +1431,7 @@ public class GridCachePartitionExchangeManager<K, V>
extends GridCacheSharedMana
}
if (!partsSizes.isEmpty())
- m.partitionSizes(F.viewReadOnly(partsSizes, IntLongMap::new));
+ m.partitionSizes(partsSizes);
return m;
}
@@ -1759,7 +1757,7 @@ public class GridCachePartitionExchangeManager<K, V>
extends GridCacheSharedMana
boolean updated = false;
- Map<Integer, IntLongMap> partsSizes =
F.emptyIfNull(msg.partitionSizes());
+ Map<Integer, Map<Integer, Long>> partsSizes =
F.emptyIfNull(msg.partitionSizes());
for (Map.Entry<Integer, GridDhtPartitionFullMap> entry :
msg.partitions().entrySet()) {
Integer grpId = entry.getKey();
@@ -1769,13 +1767,11 @@ public class GridCachePartitionExchangeManager<K, V>
extends GridCacheSharedMana
GridDhtPartitionTopology top = grp == null ?
clientTops.get(grpId) : grp.topology();
if (top != null) {
- IntLongMap sizesMap = partsSizes.get(grpId);
-
updated |= top.update(null,
entry.getValue(),
null,
msg.partsToReload(cctx.localNodeId(), grpId),
- sizesMap != null ? F.emptyIfNull(sizesMap.map()) :
Collections.emptyMap(),
+ F.emptyIfNull(partsSizes.get(grpId)),
msg.topologyVersion(),
null,
null);
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 34219e6fe74..e19ba2378e0 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -4635,7 +4635,7 @@ public class GridDhtPartitionsExchangeFuture extends
GridDhtTopologyFutureAdapte
int parallelismLvl = U.availableThreadCount(cctx.kernalContext(),
GridIoPolicy.SYSTEM_POOL, 2);
try {
- Map<Integer, IntLongMap> partsSizes =
F.emptyIfNull(msg.partitionSizes());
+ Map<Integer, Map<Integer, Long>> partsSizes =
F.emptyIfNull(msg.partitionSizes());
doInParallel(
parallelismLvl,
@@ -4646,13 +4646,13 @@ public class GridDhtPartitionsExchangeFuture extends
GridDhtTopologyFutureAdapte
CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
if (grp != null) {
- IntLongMap sizesMap = partsSizes.get(grpId);
+ Map<Integer, Long> sizesMap = partsSizes.get(grpId);
grp.topology().update(resTopVer,
msg.partitions().get(grpId),
cntrMap,
msg.partsToReload(cctx.localNodeId(), grpId),
- sizesMap != null ? F.emptyIfNull(sizesMap.map()) :
Collections.emptyMap(),
+ F.emptyIfNull(sizesMap),
null,
this,
msg.lostPartitions(grpId));
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index 7d68e8d7ea3..9ee1835e1a9 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -87,7 +87,7 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
/** Partition sizes. */
@Order(5)
- Map<Integer, IntLongMap> partsSizes;
+ Map<Integer, Map<Integer, Long>> partsSizes;
/** Topology version. */
@Order(6)
@@ -344,14 +344,14 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
*
* @param partsSizes Partitions sizes map.
*/
- public void partitionSizes(Map<Integer, IntLongMap> partsSizes) {
+ public void partitionSizes(Map<Integer, Map<Integer, Long>> partsSizes) {
this.partsSizes = partsSizes;
}
/**
* @return Partition sizes map (grpId, (partId, partSize)).
*/
- public Map<Integer, IntLongMap> partitionSizes() {
+ public Map<Integer, Map<Integer, Long>> partitionSizes() {
return partsSizes;
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index 9d922a419c5..a4a28d2eed3 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -59,13 +59,13 @@ public class GridDhtPartitionsSingleMessage extends
GridDhtPartitionsAbstractMes
@Order(3)
@Compress
@GridToStringInclude
- Map<Integer, IntLongMap> partsSizes;
+ Map<Integer, Map<Integer, Long>> partsSizes;
/** Partitions history reservation counters. */
@Order(4)
@Compress
@GridToStringInclude
- Map<Integer, IntLongMap> partHistCntrs;
+ Map<Integer, Map<Integer, Long>> partHistCntrs;
/** Error message. */
@Order(5)
@@ -208,7 +208,7 @@ public class GridDhtPartitionsSingleMessage extends
GridDhtPartitionsAbstractMes
if (partsSizes == null)
partsSizes = new HashMap<>();
- partsSizes.put(grpId, new IntLongMap(partSizesMap));
+ partsSizes.put(grpId, partSizesMap);
}
/**
@@ -221,9 +221,7 @@ public class GridDhtPartitionsSingleMessage extends
GridDhtPartitionsAbstractMes
if (partsSizes == null)
return Collections.emptyMap();
- IntLongMap sizesMap = partsSizes.get(grpId);
-
- return sizesMap != null ? F.emptyIfNull(sizesMap.map()) :
Collections.emptyMap();
+ return F.emptyIfNull(partsSizes.get(grpId));
}
/**
@@ -239,7 +237,7 @@ public class GridDhtPartitionsSingleMessage extends
GridDhtPartitionsAbstractMes
if (partHistCntrs == null)
partHistCntrs = new HashMap<>();
- partHistCntrs.put(e.getKey(), new IntLongMap(historyCntrs));
+ partHistCntrs.put(e.getKey(), historyCntrs);
}
}
@@ -248,11 +246,8 @@ public class GridDhtPartitionsSingleMessage extends
GridDhtPartitionsAbstractMes
* @return Partition history counters.
*/
Map<Integer, Long> partitionHistoryCounters(int grpId) {
- if (partHistCntrs != null) {
- IntLongMap res = partHistCntrs.get(grpId);
-
- return res != null ? F.emptyIfNull(res.map()) :
Collections.emptyMap();
- }
+ if (partHistCntrs != null)
+ return F.emptyIfNull(partHistCntrs.get(grpId));
return Collections.emptyMap();
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IntLongMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IntLongMap.java
deleted file mode 100644
index 1a5b4998d88..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IntLongMap.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
-
-import java.util.Map;
-import org.apache.ignite.internal.Order;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Map for storing integer to long value mapping (e.g. partition size or
partition history counter for
- * a partition of a given id).
- */
-public class IntLongMap implements Message {
- /** Map. */
- @Order(0)
- @Nullable Map<Integer, Long> map;
-
- /** Default constructor. */
- public IntLongMap() {
- // No-op.
- }
-
- /**
- * @param map Map.
- */
- public IntLongMap(@Nullable Map<Integer, Long> map) {
- this.map = map;
- }
-
- /**
- * @return Map.
- */
- public @Nullable Map<Integer, Long> map() {
- return map;
- }
-
-}