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 517fadfc5f0 IGNITE-28403 Remove IgniteDhtPartitionCountersMap (#12958)
517fadfc5f0 is described below
commit 517fadfc5f075986d1f245a95c5592d78d5d6098
Author: Dmitry Werner <[email protected]>
AuthorDate: Thu Apr 2 12:46:48 2026 +0500
IGNITE-28403 Remove IgniteDhtPartitionCountersMap (#12958)
---
.../communication/GridIoMessageFactory.java | 4 --
.../preloader/GridDhtPartitionsFullMessage.java | 41 +++++----------
.../preloader/IgniteDhtPartitionCountersMap.java | 59 ----------------------
.../main/resources/META-INF/classnames.properties | 1 -
.../CacheExchangeMessageDuplicatedStateTest.java | 3 +-
5 files changed, 14 insertions(+), 94 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 e97b2ad3517..5ca6b39adcc 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
@@ -189,8 +189,6 @@ import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gro
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GroupPartitionIdPairSerializer;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtDemandedPartitionsMap;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtDemandedPartitionsMapSerializer;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMapSerializer;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMapSerializer;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap;
@@ -550,8 +548,6 @@ public class GridIoMessageFactory implements
MessageFactoryProvider {
new BinaryMetadataVersionInfoSerializer());
factory.register(506, CachePartitionFullCountersMap::new,
new CachePartitionFullCountersMapSerializer());
- factory.register(507, IgniteDhtPartitionCountersMap::new,
- new IgniteDhtPartitionCountersMapSerializer());
factory.register(508, GroupPartitionIdPair::new, new
GroupPartitionIdPairSerializer());
factory.register(510, IgniteDhtPartitionHistorySuppliersMap::new,
new IgniteDhtPartitionHistorySuppliersMapSerializer());
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 9ee1835e1a9..a8076b7a05a 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
@@ -33,7 +33,6 @@ import
org.apache.ignite.internal.managers.communication.ErrorMessage;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -71,7 +70,7 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
@Order(2)
@Compress
@GridToStringInclude
- IgniteDhtPartitionCountersMap partCntrs;
+ Map<Integer, CachePartitionFullCountersMap> partCntrs;
/** Partitions history suppliers. */
@Order(3)
@@ -153,6 +152,7 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
this.topVer = topVer;
this.partHistSuppliers = partHistSuppliers;
this.partsToReload = partsToReload;
+ partCntrs = new HashMap<>();
}
/** {@inheritDoc} */
@@ -278,10 +278,9 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
* @param cntrMap Partition update counters.
*/
public void addPartitionUpdateCounters(int grpId,
CachePartitionFullCountersMap cntrMap) {
- if (partCntrs == null)
- partCntrs = new IgniteDhtPartitionCountersMap();
-
- partCntrs.putIfAbsent(grpId, cntrMap);
+ synchronized (partCntrs) {
+ partCntrs.putIfAbsent(grpId, cntrMap);
+ }
}
/**
@@ -319,7 +318,9 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
* @return Partition update counters.
*/
public CachePartitionFullCountersMap partitionUpdateCounters(int grpId) {
- return partCntrs == null ? null : partCntrs.get(grpId);
+ synchronized (partCntrs) {
+ return partCntrs.get(grpId);
+ }
}
/**
@@ -384,11 +385,11 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
}
/** {@inheritDoc} */
- @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx)
throws IgniteCheckedException {
- super.prepareMarshal(ctx);
-
+ @Override public void prepareMarshal(Marshaller marsh) throws
IgniteCheckedException {
if (!F.isEmpty(parts) && locParts == null)
locParts = copyPartitionsMap(parts);
+
+ errMsgs = errs == null ? null : F.viewReadOnly(errs,
ErrorMessage::new);
}
/**
@@ -406,9 +407,7 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
}
/** {@inheritDoc} */
- @Override public void finishUnmarshal(GridCacheSharedContext<?, ?> ctx,
ClassLoader ldr) throws IgniteCheckedException {
- super.finishUnmarshal(ctx, ldr);
-
+ @Override public void finishUnmarshal(Marshaller marsh, ClassLoader
clsLdr) throws IgniteCheckedException {
if (locParts != null && parts == null) {
parts = copyPartitionsMap(locParts);
@@ -441,17 +440,13 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
if (parts == null)
parts = new HashMap<>();
- if (partCntrs == null)
- partCntrs = new IgniteDhtPartitionCountersMap();
-
if (partHistSuppliers == null)
partHistSuppliers = new IgniteDhtPartitionHistorySuppliersMap();
if (partsToReload == null)
partsToReload = new IgniteDhtPartitionsToReloadMap();
- if (errs == null)
- errs = new HashMap<>();
+ errs = errMsgs == null ? null : F.viewReadOnly(errMsgs, e ->
e.error());
}
@@ -515,14 +510,4 @@ public class GridDhtPartitionsFullMessage extends
GridDhtPartitionsAbstractMessa
return map;
}
-
- /** {@inheritDoc} */
- @Override public void prepareMarshal(Marshaller marsh) throws
IgniteCheckedException {
- errMsgs = errs == null ? null : F.viewReadOnly(errs,
ErrorMessage::new);
- }
-
- /** {@inheritDoc} */
- @Override public void finishUnmarshal(Marshaller marsh, ClassLoader
clsLdr) throws IgniteCheckedException {
- errs = errMsgs == null ? null : F.viewReadOnly(errMsgs, e ->
e.error());
- }
}
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
deleted file mode 100644
index 62d964d682b..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionCountersMap.java
+++ /dev/null
@@ -1,59 +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.HashMap;
-import java.util.Map;
-import org.apache.ignite.internal.Order;
-import org.apache.ignite.plugin.extensions.communication.Message;
-
-/**
- * Partition counters map.
- */
-public class IgniteDhtPartitionCountersMap implements Message {
- /** */
- @Order(0)
- Map<Integer, CachePartitionFullCountersMap> map;
-
- /**
- * @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);
-
- return cntrMap;
- }
-
-}
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties
b/modules/core/src/main/resources/META-INF/classnames.properties
index f16695c2d12..5268663d0da 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1192,7 +1192,6 @@
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPre
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$2
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.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/CacheExchangeMessageDuplicatedStateTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
index abbb7269066..a14322a886a 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
@@ -229,8 +229,7 @@ public class CacheExchangeMessageDuplicatedStateTest
extends GridCommonAbstractT
assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1)));
- Map<Integer, CachePartitionFullCountersMap> partCntrs =
- getFieldValue(getFieldValue(msg, "partCntrs"), "map");
+ Map<Integer, CachePartitionFullCountersMap> partCntrs =
getFieldValue(msg, "partCntrs");
if (partCntrs != null) {
for (CachePartitionFullCountersMap cntrs : partCntrs.values()) {