You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2025/01/29 20:37:10 UTC
(ignite) branch master updated: IGNITE-24093 Remove PARTIAL_COUNTERS_MAP_SINCE (#11820)
This is an automated email from the ASF dual-hosted git repository.
nizhikov 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 1db1b7abb6d IGNITE-24093 Remove PARTIAL_COUNTERS_MAP_SINCE (#11820)
1db1b7abb6d is described below
commit 1db1b7abb6df8585c209a042698b202871690e59
Author: Maksim Davydov <70...@users.noreply.github.com>
AuthorDate: Wed Jan 29 23:37:02 2025 +0300
IGNITE-24093 Remove PARTIAL_COUNTERS_MAP_SINCE (#11820)
---
.../GridDhtPartitionsStateValidatorBenchmark.java | 12 +--
.../cache/GridCachePartitionExchangeManager.java | 50 +++---------
.../preloader/CachePartitionFullCountersMap.java | 36 ---------
.../CachePartitionPartialCountersMap.java | 23 ------
.../preloader/GridDhtPartitionsExchangeFuture.java | 33 +++-----
.../preloader/GridDhtPartitionsFullMessage.java | 92 ++++------------------
.../preloader/GridDhtPartitionsSingleMessage.java | 22 ++----
.../preloader/IgniteDhtPartitionCountersMap.java | 20 ++---
.../preloader/IgniteDhtPartitionCountersMap2.java | 69 ----------------
.../topology/GridDhtPartitionsStateValidator.java | 8 +-
.../main/resources/META-INF/classnames.properties | 1 -
.../GridCachePartitionsStateValidatorSelfTest.java | 31 ++++----
12 files changed, 69 insertions(+), 328 deletions(-)
diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/misc/GridDhtPartitionsStateValidatorBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/misc/GridDhtPartitionsStateValidatorBenchmark.java
index 6f9f4ff309a..ce29a8eaeb3 100644
--- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/misc/GridDhtPartitionsStateValidatorBenchmark.java
+++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/misc/GridDhtPartitionsStateValidatorBenchmark.java
@@ -27,12 +27,12 @@ import com.google.common.collect.Sets;
import org.apache.ignite.internal.benchmarks.jmh.JmhAbstractBenchmark;
import org.apache.ignite.internal.benchmarks.jmh.runner.JmhIdeBenchmarkRunner;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
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.dht.topology.GridDhtPartitionsStateValidator;
-import org.apache.ignite.internal.util.typedef.T2;
import org.jetbrains.annotations.Nullable;
import org.mockito.Matchers;
import org.mockito.Mockito;
@@ -91,7 +91,7 @@ public class GridDhtPartitionsStateValidatorBenchmark extends JmhAbstractBenchma
* @return Message with specified {@code countersMap} and {@code sizeMap}.
*/
private GridDhtPartitionsSingleMessage from(
- @Nullable Map<Integer, T2<Long, Long>> countersMap,
+ @Nullable CachePartitionPartialCountersMap countersMap,
@Nullable Map<Integer, Long> sizesMap
) {
GridDhtPartitionsSingleMessage msg = new GridDhtPartitionsSingleMessage();
@@ -117,14 +117,14 @@ public class GridDhtPartitionsStateValidatorBenchmark extends JmhAbstractBenchma
List<GridDhtLocalPartition> locPartitions = Lists.newArrayList();
- Map<Integer, T2<Long, Long>> updateCountersMap = new HashMap<>();
+ CachePartitionPartialCountersMap cntrMap = new CachePartitionPartialCountersMap(PARTS);
Map<Integer, Long> cacheSizesMap = new HashMap<>();
IntStream.range(0, PARTS).forEach(k -> {
locPartitions.add(partitionMock(k, k + 1, k + 1));
long us = k > 20 && k <= 30 ? 0 : k + 2L;
- updateCountersMap.put(k, new T2<>(k + 2L, us));
+ cntrMap.add(k, k + 2L, us);
cacheSizesMap.put(k, us);
});
@@ -137,10 +137,10 @@ public class GridDhtPartitionsStateValidatorBenchmark extends JmhAbstractBenchma
for (int n = 0; n < NODES; ++n) {
UUID remoteNode = UUID.randomUUID();
- msgs.put(remoteNode, from(updateCountersMap, cacheSizesMap));
+ msgs.put(remoteNode, from(cntrMap, cacheSizesMap));
}
- msgs.put(ignoreNode, from(updateCountersMap, cacheSizesMap));
+ msgs.put(ignoreNode, from(cntrMap, cacheSizesMap));
validator = new GridDhtPartitionsStateValidator(cctxMock);
}
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 78c7b0c317f..d7a9b566536 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
@@ -85,8 +85,6 @@ import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionFullCountersMap;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.FinishPreloadingTask;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.ForceRebalanceExchangeTask;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
@@ -172,7 +170,6 @@ import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap.PARTIAL_COUNTERS_MAP_SINCE;
import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.nextDumpTimeout;
import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader.DFLT_PRELOAD_RESEND_TIMEOUT;
import static org.apache.ignite.internal.processors.metric.GridMetricManager.CLUSTER_METRICS;
@@ -1393,7 +1390,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
) {
long time = System.currentTimeMillis();
- GridDhtPartitionsFullMessage m = createPartitionsFullMessage(true, false, null, null, null, null, grps);
+ GridDhtPartitionsFullMessage m = createPartitionsFullMessage(true, null, null, null, null, grps);
m.topologyVersion(msgTopVer);
@@ -1449,7 +1446,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
*
* @param compress {@code True} if possible to compress message (properly work only if prepareMarshall/
* finishUnmarshall methods are called).
- * @param newCntrMap {@code True} if possible to use {@link CachePartitionFullCountersMap}.
* @param exchId Non-null exchange ID if message is created for exchange.
* @param lastVer Last version.
* @param partHistSuppliers Partition history suppliers map.
@@ -1458,7 +1454,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
*/
public GridDhtPartitionsFullMessage createPartitionsFullMessage(
boolean compress,
- boolean newCntrMap,
@Nullable final GridDhtPartitionExchangeId exchId,
@Nullable GridCacheVersion lastVer,
@Nullable IgniteDhtPartitionHistorySuppliersMap partHistSuppliers,
@@ -1466,7 +1461,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
) {
Collection<CacheGroupContext> grps = cctx.cache().cacheGroups();
- return createPartitionsFullMessage(compress, newCntrMap, exchId, lastVer, partHistSuppliers, partsToReload, grps);
+ return createPartitionsFullMessage(compress, exchId, lastVer, partHistSuppliers, partsToReload, grps);
}
/**
@@ -1474,7 +1469,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
*
* @param compress {@code True} if possible to compress message (properly work only if prepareMarshall/
* finishUnmarshall methods are called).
- * @param newCntrMap {@code True} if possible to use {@link CachePartitionFullCountersMap}.
* @param exchId Non-null exchange ID if message is created for exchange.
* @param lastVer Last version.
* @param partHistSuppliers Partition history suppliers map.
@@ -1484,7 +1478,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
*/
public GridDhtPartitionsFullMessage createPartitionsFullMessage(
boolean compress,
- boolean newCntrMap,
@Nullable final GridDhtPartitionExchangeId exchId,
@Nullable GridCacheVersion lastVer,
@Nullable IgniteDhtPartitionHistorySuppliersMap partHistSuppliers,
@@ -1523,14 +1516,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
partsSizes.put(grp.groupId(), partSizesMap);
if (exchId != null) {
- CachePartitionFullCountersMap cntrsMap = grp.topology().fullUpdateCounters();
-
- if (newCntrMap)
- m.addPartitionUpdateCounters(grp.groupId(), cntrsMap);
- else {
- m.addPartitionUpdateCounters(grp.groupId(),
- CachePartitionFullCountersMap.toCountersMap(cntrsMap));
- }
+ m.addPartitionUpdateCounters(grp.groupId(), grp.topology().fullUpdateCounters());
// Lost partitions can be skipped on node left or activation.
m.addLostPartitions(grp.groupId(), grp.topology().lostPartitions());
@@ -1545,12 +1531,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
addFullPartitionsMap(m, dupData, compress, top.groupId(), map, top.similarAffinityKey());
if (exchId != null) {
- CachePartitionFullCountersMap cntrsMap = top.fullUpdateCounters();
-
- if (newCntrMap)
- m.addPartitionUpdateCounters(top.groupId(), cntrsMap);
- else
- m.addPartitionUpdateCounters(top.groupId(), CachePartitionFullCountersMap.toCountersMap(cntrsMap));
+ m.addPartitionUpdateCounters(top.groupId(), top.fullUpdateCounters());
Map<Integer, Long> partSizesMap = top.globalPartSizes();
@@ -1621,7 +1602,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
createPartitionsSingleMessage(id,
cctx.kernalContext().clientNode(),
false,
- node.version().compareToIgnoreTimestamp(PARTIAL_COUNTERS_MAP_SINCE) >= 0,
null,
grps);
@@ -1647,19 +1627,17 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param exchangeId Exchange ID.
* @param clientOnlyExchange Client exchange flag.
* @param sndCounters {@code True} if need send partition update counters.
- * @param newCntrMap {@code True} if possible to use {@link CachePartitionPartialCountersMap}.
* @return Message.
*/
public GridDhtPartitionsSingleMessage createPartitionsSingleMessage(
@Nullable GridDhtPartitionExchangeId exchangeId,
boolean clientOnlyExchange,
boolean sndCounters,
- boolean newCntrMap,
ExchangeActions exchActions
) {
Collection<CacheGroupContext> grps = cctx.cache().cacheGroups();
- return createPartitionsSingleMessage(exchangeId, clientOnlyExchange, sndCounters, newCntrMap, exchActions, grps);
+ return createPartitionsSingleMessage(exchangeId, clientOnlyExchange, sndCounters, exchActions, grps);
}
/**
@@ -1668,7 +1646,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param exchangeId Exchange ID.
* @param clientOnlyExchange Client exchange flag.
* @param sndCounters {@code True} if need send partition update counters.
- * @param newCntrMap {@code True} if possible to use {@link CachePartitionPartialCountersMap}.
* @param grps Selected cache groups.
* @return Message.
*/
@@ -1676,7 +1653,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
@Nullable GridDhtPartitionExchangeId exchangeId,
boolean clientOnlyExchange,
boolean sndCounters,
- boolean newCntrMap,
ExchangeActions exchActions,
Collection<CacheGroupContext> grps
) {
@@ -1698,12 +1674,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
locMap,
grp.affinity().similarAffinityKey());
- if (sndCounters) {
- CachePartitionPartialCountersMap cntrsMap = grp.topology().localUpdateCounters(true);
-
- m.addPartitionUpdateCounters(grp.groupId(),
- newCntrMap ? cntrsMap : CachePartitionPartialCountersMap.toCountersMap(cntrsMap));
- }
+ if (sndCounters)
+ m.addPartitionUpdateCounters(grp.groupId(), grp.topology().localUpdateCounters(true));
m.addPartitionSizes(grp.groupId(), grp.topology().partitionSizes());
}
@@ -1722,12 +1694,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
locMap,
top.similarAffinityKey());
- if (sndCounters) {
- CachePartitionPartialCountersMap cntrsMap = top.localUpdateCounters(true);
-
- m.addPartitionUpdateCounters(top.groupId(),
- newCntrMap ? cntrsMap : CachePartitionPartialCountersMap.toCountersMap(cntrsMap));
- }
+ if (sndCounters)
+ m.addPartitionUpdateCounters(top.groupId(), top.localUpdateCounters(true));
m.addPartitionSizes(top.groupId(), top.partitionSizes());
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionFullCountersMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionFullCountersMap.java
index ebc993c3b81..1384a558e47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionFullCountersMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionFullCountersMap.java
@@ -19,9 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
import java.io.Serializable;
import java.util.Arrays;
-import java.util.Map;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.U;
/**
*
@@ -99,37 +96,4 @@ public class CachePartitionFullCountersMap implements Serializable {
Arrays.fill(initialUpdCntrs, 0);
Arrays.fill(updCntrs, 0);
}
-
- /**
- * @param map Full counters map.
- * @return Regular java map with counters.
- */
- public static Map<Integer, T2<Long, Long>> toCountersMap(CachePartitionFullCountersMap map) {
- int partsCnt = map.updCntrs.length;
-
- Map<Integer, T2<Long, Long>> map0 = U.newHashMap(partsCnt);
-
- for (int p = 0; p < partsCnt; p++)
- map0.put(p, new T2<>(map.initialUpdCntrs[p], map.updCntrs[p]));
-
- return map0;
- }
-
- /**
- * @param map Regular java map with counters.
- * @param partsCnt Total cache partitions.
- * @return Full counters map.
- */
- static CachePartitionFullCountersMap fromCountersMap(Map<Integer, T2<Long, Long>> map, int partsCnt) {
- CachePartitionFullCountersMap map0 = new CachePartitionFullCountersMap(partsCnt);
-
- for (Map.Entry<Integer, T2<Long, Long>> e : map.entrySet()) {
- T2<Long, Long> cntrs = e.getValue();
-
- map0.initialUpdCntrs[e.getKey()] = cntrs.get1();
- map0.updCntrs[e.getKey()] = cntrs.get2();
- }
-
- return map0;
- }
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
index 9a549177cec..bc9871bb5fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
@@ -21,10 +21,8 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
-import java.util.TreeMap;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteProductVersion;
/**
*
@@ -33,9 +31,6 @@ public class CachePartitionPartialCountersMap implements Serializable {
/** */
private static final long serialVersionUID = 0L;
- /** */
- public static final IgniteProductVersion PARTIAL_COUNTERS_MAP_SINCE = IgniteProductVersion.fromString("2.1.4");
-
/** */
public static final CachePartitionPartialCountersMap EMPTY = new CachePartitionPartialCountersMap();
@@ -215,24 +210,6 @@ public class CachePartitionPartialCountersMap implements Serializable {
return res;
}
- /**
- * @param map Partition ID to partition counters map.
- * @param partsCnt Total cache partitions.
- * @return Partial local counters map.
- */
- static CachePartitionPartialCountersMap fromCountersMap(Map<Integer, T2<Long, Long>> map, int partsCnt) {
- CachePartitionPartialCountersMap map0 = new CachePartitionPartialCountersMap(partsCnt);
-
- TreeMap<Integer, T2<Long, Long>> sorted = new TreeMap<>(map);
-
- for (Map.Entry<Integer, T2<Long, Long>> e : sorted.entrySet())
- map0.add(e.getKey(), e.getValue().get1(), e.getValue().get2());
-
- map0.trim();
-
- return map0;
- }
-
/** {@inheritDoc} */
@Override public String toString() {
StringBuilder sb = new StringBuilder("CachePartitionPartialCountersMap {");
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 9a8d610d171..896893d437e 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
@@ -127,7 +127,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.lang.IgniteRunnable;
import org.jetbrains.annotations.Nullable;
@@ -146,7 +145,6 @@ import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVE
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
import static org.apache.ignite.internal.processors.cache.ExchangeDiscoveryEvents.serverJoinEvent;
import static org.apache.ignite.internal.processors.cache.ExchangeDiscoveryEvents.serverLeftEvent;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap.PARTIAL_COUNTERS_MAP_SINCE;
import static org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.isSnapshotOperation;
import static org.apache.ignite.internal.processors.security.SecurityUtils.remoteSecurityContext;
import static org.apache.ignite.internal.util.IgniteUtils.doInParallel;
@@ -2131,7 +2129,6 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
msg = cctx.exchange().createPartitionsSingleMessage(exchangeId(),
false,
true,
- node.version().compareToIgnoreTimestamp(PARTIAL_COUNTERS_MAP_SINCE) >= 0,
exchActions);
Map<Integer, Map<Integer, Long>> partHistReserved0 = partHistReserved;
@@ -2174,15 +2171,13 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
/**
* @param compress Message compress flag.
- * @param newCntrMap {@code True} if possible to use {@link CachePartitionFullCountersMap}.
* @return Message.
*/
- private GridDhtPartitionsFullMessage createPartitionsMessage(boolean compress, boolean newCntrMap) {
+ private GridDhtPartitionsFullMessage createPartitionsMessage(boolean compress) {
GridCacheVersion last = lastVer.get();
GridDhtPartitionsFullMessage m = cctx.exchange().createPartitionsFullMessage(
compress,
- newCntrMap,
exchangeId(),
last != null ? last : cctx.versions().last(),
partHistSuppliers,
@@ -2962,7 +2957,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
onDone(null, reconnectEx);
- GridDhtPartitionsFullMessage fullMsg = createPartitionsMessage(true, false);
+ GridDhtPartitionsFullMessage fullMsg = createPartitionsMessage(true);
fullMsg.setErrorsMap(exchangeGlobalExceptions);
@@ -3123,8 +3118,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
return;
}
- GridDhtPartitionsFullMessage msg =
- createPartitionsMessage(true, node.version().compareToIgnoreTimestamp(PARTIAL_COUNTERS_MAP_SINCE) >= 0);
+ GridDhtPartitionsFullMessage msg = createPartitionsMessage(true);
msg.rebalanced(rebalanced());
@@ -3293,7 +3287,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
Map<Integer, Map<Integer, List<UUID>>> assignmentChange = fut.get();
- GridDhtPartitionsFullMessage m = createPartitionsMessage(false, false);
+ GridDhtPartitionsFullMessage m = createPartitionsMessage(false);
CacheAffinityChangeMessage msg = new CacheAffinityChangeMessage(exchId, m, assignmentChange);
@@ -3350,8 +3344,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
Map<Integer, TreeSet<Long>> varCntrs = new HashMap<>();
for (Map.Entry<UUID, GridDhtPartitionsSingleMessage> e : msgs.entrySet()) {
- CachePartitionPartialCountersMap nodeCntrs = e.getValue().partitionUpdateCounters(top.groupId(),
- top.partitions());
+ CachePartitionPartialCountersMap nodeCntrs = e.getValue().partitionUpdateCounters(top.groupId());
assert nodeCntrs != null;
@@ -3903,10 +3896,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
cctx.versions().onExchange(lastVer.get().order());
- IgniteProductVersion minVer = exchCtx.events().discoveryCache().minimumNodeVersion();
-
- GridDhtPartitionsFullMessage msg = createPartitionsMessage(true,
- minVer.compareToIgnoreTimestamp(PARTIAL_COUNTERS_MAP_SINCE) >= 0);
+ GridDhtPartitionsFullMessage msg = createPartitionsMessage(true);
if (!cctx.affinity().rebalanceRequired() && !deactivateCluster())
msg.rebalanced(true);
@@ -4079,7 +4069,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
? grp.topology()
: cctx.exchange().clientTopology(grpId, events().discoveryCache());
- CachePartitionPartialCountersMap cntrs = msg.partitionUpdateCounters(grpId, top.partitions());
+ CachePartitionPartialCountersMap cntrs = msg.partitionUpdateCounters(grpId);
if (cntrs != null)
top.collectUpdateCounters(cntrs);
@@ -4512,7 +4502,6 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
msg.restoreExchangeId(),
cctx.kernalContext().clientNode(),
true,
- node.version().compareToIgnoreTimestamp(PARTIAL_COUNTERS_MAP_SINCE) >= 0,
exchActions);
if (localJoinExchange() && finishState0 == null)
@@ -4756,12 +4745,11 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
parallelismLvl,
cctx.kernalContext().pools().getSystemExecutorService(),
msg.partitions().keySet(), grpId -> {
+ CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId);
+
CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
if (grp != null) {
- CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
- grp.topology().partitions());
-
grp.topology().update(resTopVer,
msg.partitions().get(grpId),
cntrMap,
@@ -4774,9 +4762,6 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
else {
GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache());
- CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
- top.partitions());
-
top.update(resTopVer,
msg.partitions().get(grpId),
cntrMap,
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 346a6ab7176..8027584bc5e 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
@@ -45,7 +45,6 @@ import org.apache.ignite.internal.util.lang.IgniteThrowableFunction;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
@@ -86,14 +85,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/** Serialized partitions counters. */
private byte[] partCntrsBytes;
- /** Partitions update counters. */
- @GridToStringInclude
- @GridDirectTransient
- private IgniteDhtPartitionCountersMap2 partCntrs2;
-
- /** Serialized partitions counters. */
- private byte[] partCntrsBytes2;
-
/** Partitions history suppliers. */
@GridToStringInclude
@GridDirectTransient
@@ -198,8 +189,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
cp.partsBytes = partsBytes;
cp.partCntrs = partCntrs;
cp.partCntrsBytes = partCntrsBytes;
- cp.partCntrs2 = partCntrs2;
- cp.partCntrsBytes2 = partCntrsBytes2;
cp.partHistSuppliers = partHistSuppliers;
cp.partHistSuppliersBytes = partHistSuppliersBytes;
cp.partsToReload = partsToReload;
@@ -323,24 +312,13 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
* @param grpId Cache group ID.
* @param cntrMap Partition update counters.
*/
- public void addPartitionUpdateCounters(int grpId, Map<Integer, T2<Long, Long>> cntrMap) {
+ public void addPartitionUpdateCounters(int grpId, CachePartitionFullCountersMap cntrMap) {
if (partCntrs == null)
partCntrs = new IgniteDhtPartitionCountersMap();
partCntrs.putIfAbsent(grpId, cntrMap);
}
- /**
- * @param grpId Cache group ID.
- * @param cntrMap Partition update counters.
- */
- public void addPartitionUpdateCounters(int grpId, CachePartitionFullCountersMap cntrMap) {
- if (partCntrs2 == null)
- partCntrs2 = new IgniteDhtPartitionCountersMap2();
-
- partCntrs2.putIfAbsent(grpId, cntrMap);
- }
-
/**
* @param grpId Group id.
* @param lostParts Lost parts.
@@ -373,19 +351,10 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/**
* @param grpId Cache group ID.
- * @param partsCnt Total cache partitions.
* @return Partition update counters.
*/
- public CachePartitionFullCountersMap partitionUpdateCounters(int grpId, int partsCnt) {
- if (partCntrs2 != null)
- return partCntrs2.get(grpId);
-
- if (partCntrs == null)
- return null;
-
- Map<Integer, T2<Long, Long>> map = partCntrs.get(grpId);
-
- return map != null ? CachePartitionFullCountersMap.fromCountersMap(map, partsCnt) : null;
+ public CachePartitionFullCountersMap partitionUpdateCounters(int grpId) {
+ return partCntrs == null ? null : partCntrs.get(grpId);
}
/**
@@ -482,7 +451,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
boolean marshal = (!F.isEmpty(parts) && partsBytes == null) ||
(partCntrs != null && !partCntrs.empty() && partCntrsBytes == null) ||
- (partCntrs2 != null && !partCntrs2.empty() && partCntrsBytes2 == null) ||
(partHistSuppliers != null && partHistSuppliersBytes == null) ||
(partsToReload != null && partsToReloadBytes == null) ||
(!F.isEmpty(errs) && errsBytes == null);
@@ -499,9 +467,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partCntrs != null && !partCntrs.empty() && partCntrsBytes == null)
objectsToMarshall.add(partCntrs);
- if (partCntrs2 != null && !partCntrs2.empty() && partCntrsBytes2 == null)
- objectsToMarshall.add(partCntrs2);
-
if (partHistSuppliers != null && partHistSuppliersBytes == null)
objectsToMarshall.add(partHistSuppliers);
@@ -534,9 +499,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partCntrs != null && !partCntrs.empty() && partCntrsBytes == null)
partCntrsBytes = iter.next();
- if (partCntrs2 != null && !partCntrs2.empty() && partCntrsBytes2 == null)
- partCntrsBytes2 = iter.next();
-
if (partHistSuppliers != null && partHistSuppliersBytes == null)
partHistSuppliersBytes = iter.next();
@@ -579,9 +541,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partCntrsBytes != null && partCntrs == null)
objectsToUnmarshall.add(partCntrsBytes);
- if (partCntrsBytes2 != null && partCntrs2 == null)
- objectsToUnmarshall.add(partCntrsBytes2);
-
if (partHistSuppliersBytes != null && partHistSuppliers == null)
objectsToUnmarshall.add(partHistSuppliersBytes);
@@ -640,9 +599,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partCntrsBytes != null && partCntrs == null)
partCntrs = (IgniteDhtPartitionCountersMap)iter.next();
- if (partCntrsBytes2 != null && partCntrs2 == null)
- partCntrs2 = (IgniteDhtPartitionCountersMap2)iter.next();
-
if (partHistSuppliersBytes != null && partHistSuppliers == null)
partHistSuppliers = (IgniteDhtPartitionHistorySuppliersMap)iter.next();
@@ -658,9 +614,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partCntrs == null)
partCntrs = new IgniteDhtPartitionCountersMap();
- if (partCntrs2 == null)
- partCntrs2 = new IgniteDhtPartitionCountersMap2();
-
if (partHistSuppliers == null)
partHistSuppliers = new IgniteDhtPartitionHistorySuppliersMap();
@@ -729,42 +682,36 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
writer.incrementState();
case 13:
- if (!writer.writeByteArray("partCntrsBytes2", partCntrsBytes2))
- return false;
-
- writer.incrementState();
-
- case 14:
if (!writer.writeByteArray("partHistSuppliersBytes", partHistSuppliersBytes))
return false;
writer.incrementState();
- case 15:
+ case 14:
if (!writer.writeByteArray("partsBytes", partsBytes))
return false;
writer.incrementState();
- case 16:
+ case 15:
if (!writer.writeByteArray("partsSizesBytes", partsSizesBytes))
return false;
writer.incrementState();
- case 17:
+ case 16:
if (!writer.writeByteArray("partsToReloadBytes", partsToReloadBytes))
return false;
writer.incrementState();
- case 18:
+ case 17:
if (!writer.writeAffinityTopologyVersion("resTopVer", resTopVer))
return false;
writer.incrementState();
- case 19:
+ case 18:
if (!writer.writeAffinityTopologyVersion("topVer", topVer))
return false;
@@ -843,14 +790,6 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
case 13:
- partCntrsBytes2 = reader.readByteArray("partCntrsBytes2");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 14:
partHistSuppliersBytes = reader.readByteArray("partHistSuppliersBytes");
if (!reader.isLastRead())
@@ -858,7 +797,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 15:
+ case 14:
partsBytes = reader.readByteArray("partsBytes");
if (!reader.isLastRead())
@@ -866,7 +805,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 16:
+ case 15:
partsSizesBytes = reader.readByteArray("partsSizesBytes");
if (!reader.isLastRead())
@@ -874,7 +813,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 17:
+ case 16:
partsToReloadBytes = reader.readByteArray("partsToReloadBytes");
if (!reader.isLastRead())
@@ -882,7 +821,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 18:
+ case 17:
resTopVer = reader.readAffinityTopologyVersion("resTopVer");
if (!reader.isLastRead())
@@ -890,7 +829,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 19:
+ case 18:
topVer = reader.readAffinityTopologyVersion("topVer");
if (!reader.isLastRead())
@@ -910,7 +849,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 20;
+ return 19;
}
/** {@inheritDoc} */
@@ -955,9 +894,8 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
*/
public void cleanUp() {
partsBytes = null;
- partCntrs2 = null;
+ partCntrs = null;
partCntrsBytes = null;
- partCntrsBytes2 = null;
partHistSuppliersBytes = null;
partsToReloadBytes = null;
partsSizesBytes = null;
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 77f8d5f7d5a..e5d792d739c 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
@@ -32,7 +32,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.topology.Grid
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
@@ -64,7 +63,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** Partitions update counters. */
@GridToStringInclude
@GridDirectTransient
- private Map<Integer, Object> partCntrs;
+ private Map<Integer, CachePartitionPartialCountersMap> partCntrs;
/** Serialized partitions counters. */
private byte[] partCntrsBytes;
@@ -201,7 +200,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
* @param grpId Cache group ID.
* @param cntrMap Partition update counters.
*/
- public void addPartitionUpdateCounters(int grpId, Object cntrMap) {
+ public void addPartitionUpdateCounters(int grpId, CachePartitionPartialCountersMap cntrMap) {
if (partCntrs == null)
partCntrs = new HashMap<>();
@@ -210,23 +209,12 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/**
* @param grpId Cache group ID.
- * @param partsCnt Total cache partitions.
* @return Partition update counters.
*/
- public CachePartitionPartialCountersMap partitionUpdateCounters(int grpId, int partsCnt) {
- Object res = partCntrs == null ? null : partCntrs.get(grpId);
+ public CachePartitionPartialCountersMap partitionUpdateCounters(int grpId) {
+ CachePartitionPartialCountersMap res = partCntrs == null ? null : partCntrs.get(grpId);
- if (res == null)
- return CachePartitionPartialCountersMap.EMPTY;
-
- if (res instanceof CachePartitionPartialCountersMap)
- return (CachePartitionPartialCountersMap)res;
-
- assert res instanceof Map : res;
-
- Map<Integer, T2<Long, Long>> map = (Map<Integer, T2<Long, Long>>)res;
-
- return CachePartitionPartialCountersMap.fromCountersMap(map, partsCnt);
+ return res == null ? CachePartitionPartialCountersMap.EMPTY : res;
}
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap.java
index 4a22abd9a98..e7954d960ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap.java
@@ -19,11 +19,8 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
import java.io.Serializable;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Partition counters map.
@@ -33,7 +30,7 @@ public class IgniteDhtPartitionCountersMap implements Serializable {
private static final long serialVersionUID = 0L;
/** */
- private Map<Integer, Map<Integer, T2<Long, Long>>> map;
+ private Map<Integer, CachePartitionFullCountersMap> map;
/**
* @return {@code True} if map is empty.
@@ -46,7 +43,7 @@ public class IgniteDhtPartitionCountersMap implements Serializable {
* @param cacheId Cache ID.
* @param cntrMap Counters map.
*/
- public synchronized void putIfAbsent(int cacheId, Map<Integer, T2<Long, Long>> cntrMap) {
+ public synchronized void putIfAbsent(int cacheId, CachePartitionFullCountersMap cntrMap) {
if (map == null)
map = new HashMap<>();
@@ -58,20 +55,15 @@ public class IgniteDhtPartitionCountersMap implements Serializable {
* @param cacheId Cache ID.
* @return Counters map.
*/
- public synchronized Map<Integer, T2<Long, Long>> get(int cacheId) {
+ public synchronized CachePartitionFullCountersMap get(int cacheId) {
if (map == null)
- map = new HashMap<>();
+ return null;
- Map<Integer, T2<Long, Long>> cntrMap = map.get(cacheId);
+ CachePartitionFullCountersMap cntrMap = map.get(cacheId);
if (cntrMap == null)
- return Collections.emptyMap();
+ return null;
return cntrMap;
}
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(IgniteDhtPartitionCountersMap.class, this);
- }
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap2.java
deleted file mode 100644
index d1e6d99c4aa..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap2.java
+++ /dev/null
@@ -1,69 +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.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Partition counters map.
- */
-public class IgniteDhtPartitionCountersMap2 implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private Map<Integer, CachePartitionFullCountersMap> map;
-
- /**
- * @return {@code True} if map is empty.
- */
- public synchronized boolean empty() {
- return map == null || map.isEmpty();
- }
-
- /**
- * @param cacheId Cache ID.
- * @param cntrMap Counters map.
- */
- public synchronized void putIfAbsent(int cacheId, CachePartitionFullCountersMap cntrMap) {
- if (map == null)
- map = new HashMap<>();
-
- if (!map.containsKey(cacheId))
- map.put(cacheId, cntrMap);
- }
-
- /**
- * @param cacheId Cache ID.
- * @return Counters map.
- */
- public synchronized CachePartitionFullCountersMap get(int cacheId) {
- if (map == null)
- return null;
-
- CachePartitionFullCountersMap cntrMap = map.get(cacheId);
-
- if (cntrMap == null)
- return null;
-
- return cntrMap;
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java
index ed038b247e5..b0078d678d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtPartitionsStateValidator.java
@@ -183,8 +183,6 @@ public class GridDhtPartitionsStateValidator {
updateCountersAndNodesByPartitions.put(part.id(), new AbstractMap.SimpleEntry<>(cctx.localNodeId(), part.updateCounter()));
}
- int partitions = top.partitions();
-
// Then process and validate counters from other nodes.
for (Map.Entry<UUID, GridDhtPartitionsSingleMessage> e : messages.entrySet()) {
UUID nodeId = e.getKey();
@@ -193,7 +191,7 @@ public class GridDhtPartitionsStateValidator {
final GridDhtPartitionsSingleMessage msg = e.getValue();
- CachePartitionPartialCountersMap countersMap = msg.partitionUpdateCounters(top.groupId(), partitions);
+ CachePartitionPartialCountersMap countersMap = msg.partitionUpdateCounters(top.groupId());
Map<Integer, Long> sizesMap = msg.partitionSizes(top.groupId());
@@ -244,8 +242,6 @@ public class GridDhtPartitionsStateValidator {
sizesAndNodesByPartitions.put(part.id(), new AbstractMap.SimpleEntry<>(cctx.localNodeId(), part.fullSize()));
}
- int partitions = top.partitions();
-
// Then process and validate sizes from other nodes.
for (Map.Entry<UUID, GridDhtPartitionsSingleMessage> e : messages.entrySet()) {
UUID nodeId = e.getKey();
@@ -254,7 +250,7 @@ public class GridDhtPartitionsStateValidator {
final GridDhtPartitionsSingleMessage msg = e.getValue();
- CachePartitionPartialCountersMap countersMap = msg.partitionUpdateCounters(top.groupId(), partitions);
+ CachePartitionPartialCountersMap countersMap = msg.partitionUpdateCounters(top.groupId());
Map<Integer, Long> sizesMap = msg.partitionSizes(top.groupId());
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index fc27ad5fe83..6a7559946de 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1205,7 +1205,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPre
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloaderAssignments
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtDemandedPartitionsMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteHistoricalIterator
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionsStateValidatorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionsStateValidatorSelfTest.java
index ec580fb8ea0..b1b05fe49c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionsStateValidatorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionsStateValidatorSelfTest.java
@@ -24,12 +24,12 @@ import java.util.UUID;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
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.dht.topology.GridDhtPartitionsStateValidator;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
@@ -88,7 +88,10 @@ public class GridCachePartitionsStateValidatorSelfTest extends GridCommonAbstrac
* @param sizesMap Sizes map.
* @return Message with specified {@code countersMap} and {@code sizeMap}.
*/
- private GridDhtPartitionsSingleMessage from(@Nullable Map<Integer, T2<Long, Long>> countersMap, @Nullable Map<Integer, Long> sizesMap) {
+ private GridDhtPartitionsSingleMessage from(
+ @Nullable CachePartitionPartialCountersMap countersMap,
+ @Nullable Map<Integer, Long> sizesMap
+ ) {
GridDhtPartitionsSingleMessage msg = new GridDhtPartitionsSingleMessage();
if (countersMap != null)
@@ -109,10 +112,10 @@ public class GridCachePartitionsStateValidatorSelfTest extends GridCommonAbstrac
UUID ignoreNode = UUID.randomUUID();
// For partitions 0 and 2 we have inconsistent update counters.
- Map<Integer, T2<Long, Long>> updateCountersMap = new HashMap<>();
- updateCountersMap.put(0, new T2<>(2L, 2L));
- updateCountersMap.put(1, new T2<>(2L, 2L));
- updateCountersMap.put(2, new T2<>(5L, 5L));
+ CachePartitionPartialCountersMap cntrMap = new CachePartitionPartialCountersMap(3);
+ cntrMap.add(0, 2L, 2L);
+ cntrMap.add(1, 2L, 2L);
+ cntrMap.add(2, 5L, 5L);
// For partitions 0 and 2 we have inconsistent cache sizes.
Map<Integer, Long> cacheSizesMap = new HashMap<>();
@@ -122,8 +125,8 @@ public class GridCachePartitionsStateValidatorSelfTest extends GridCommonAbstrac
// Form single messages map.
Map<UUID, GridDhtPartitionsSingleMessage> msgs = new HashMap<>();
- msgs.put(remoteNode, from(updateCountersMap, cacheSizesMap));
- msgs.put(ignoreNode, from(updateCountersMap, cacheSizesMap));
+ msgs.put(remoteNode, from(cntrMap, cacheSizesMap));
+ msgs.put(ignoreNode, from(cntrMap, cacheSizesMap));
GridDhtPartitionsStateValidator validator = new GridDhtPartitionsStateValidator(cctxMock);
@@ -150,10 +153,10 @@ public class GridCachePartitionsStateValidatorSelfTest extends GridCommonAbstrac
UUID ignoreNode = UUID.randomUUID();
// For partitions 0 and 2 we have inconsistent update counters.
- Map<Integer, T2<Long, Long>> updateCountersMap = new HashMap<>();
- updateCountersMap.put(0, new T2<>(2L, 2L));
- updateCountersMap.put(1, new T2<>(2L, 2L));
- updateCountersMap.put(2, new T2<>(5L, 5L));
+ CachePartitionPartialCountersMap cntrMap = new CachePartitionPartialCountersMap(3);
+ cntrMap.add(0, 2L, 2L);
+ cntrMap.add(1, 2L, 2L);
+ cntrMap.add(2, 5L, 5L);
// For partitions 0 and 2 we have inconsistent cache sizes.
Map<Integer, Long> cacheSizesMap = new HashMap<>();
@@ -163,8 +166,8 @@ public class GridCachePartitionsStateValidatorSelfTest extends GridCommonAbstrac
// Form single messages map.
Map<UUID, GridDhtPartitionsSingleMessage> msgs = new HashMap<>();
- msgs.put(remoteNode, from(updateCountersMap, cacheSizesMap));
- msgs.put(ignoreNode, from(updateCountersMap, cacheSizesMap));
+ msgs.put(remoteNode, from(cntrMap, cacheSizesMap));
+ msgs.put(ignoreNode, from(cntrMap, cacheSizesMap));
GridDhtPartitionsStateValidator validator = new GridDhtPartitionsStateValidator(cctxMock);