This is an automated email from the ASF dual-hosted git repository.
namelchev 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 11faa99f654 IGNITE-28260 Remove PartitionReservationsMap (#12941)
11faa99f654 is described below
commit 11faa99f654695f0992cf25a98a326786187b513
Author: Dmitry Werner <[email protected]>
AuthorDate: Fri Mar 27 12:35:24 2026 +0500
IGNITE-28260 Remove PartitionReservationsMap (#12941)
---
.../communication/GridIoMessageFactory.java | 3 -
.../preloader/GridDhtPartitionsExchangeFuture.java | 4 +-
.../IgniteDhtPartitionHistorySuppliersMap.java | 8 +--
.../dht/preloader/PartitionReservationsMap.java | 68 ----------------------
.../communication/CompressedMessageTest.java | 10 ++--
5 files changed, 11 insertions(+), 82 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 6cdabdd6b1c..05c296ba618 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
@@ -197,8 +197,6 @@ import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Ign
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.PartitionReservationsMap;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.PartitionReservationsMapSerializer;
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;
@@ -565,7 +563,6 @@ public class GridIoMessageFactory implements
MessageFactoryProvider {
factory.register(IgniteDhtPartitionCountersMap.TYPE_CODE,
IgniteDhtPartitionCountersMap::new,
new IgniteDhtPartitionCountersMapSerializer());
factory.register(GroupPartitionIdPair.TYPE_CODE,
GroupPartitionIdPair::new, new GroupPartitionIdPairSerializer());
- factory.register(PartitionReservationsMap.TYPE_CODE,
PartitionReservationsMap::new, new PartitionReservationsMapSerializer());
factory.register(IgniteDhtPartitionHistorySuppliersMap.TYPE_CODE,
IgniteDhtPartitionHistorySuppliersMap::new,
new IgniteDhtPartitionHistorySuppliersMapSerializer());
factory.register(IgniteDhtPartitionsToReloadMap.TYPE_CODE,
IgniteDhtPartitionsToReloadMap::new,
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 9a0549e06d4..34219e6fe74 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
@@ -2436,10 +2436,10 @@ public class GridDhtPartitionsExchangeFuture extends
GridDhtTopologyFutureAdapte
// Create and destroy caches and cache proxies.
cctx.cache().onExchangeDone(this, err);
- PartitionReservationsMap locReserved =
partHistSuppliers.getReservations(cctx.localNodeId());
+ Map<GroupPartitionIdPair, Long> locReserved =
partHistSuppliers.getReservations(cctx.localNodeId());
if (locReserved != null) {
- boolean success =
cctx.database().reserveHistoryForPreloading(locReserved.reservations());
+ boolean success =
cctx.database().reserveHistoryForPreloading(locReserved);
if (!success) {
log.warning("Could not reserve history for historical
rebalance " +
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java
index 5bfc1ab8cb3..ecfb751eac1 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java
@@ -41,7 +41,7 @@ public class IgniteDhtPartitionHistorySuppliersMap implements
Message {
/** */
@Order(0)
- Map<UUID, PartitionReservationsMap> map;
+ Map<UUID, Map<GroupPartitionIdPair, Long>> map;
/**
* @return Empty map.
@@ -62,7 +62,7 @@ public class IgniteDhtPartitionHistorySuppliersMap implements
Message {
List<UUID> suppliers = new ArrayList<>();
- for (Map.Entry<UUID, PartitionReservationsMap> e : map.entrySet()) {
+ for (Map.Entry<UUID, Map<GroupPartitionIdPair, Long>> e :
map.entrySet()) {
UUID supplierNode = e.getKey();
Long historyCounter = e.getValue().get(new
GroupPartitionIdPair(grpId, partId));
@@ -78,7 +78,7 @@ public class IgniteDhtPartitionHistorySuppliersMap implements
Message {
* @param nodeId Node ID to check.
* @return Reservations for the given node.
*/
- @Nullable public synchronized PartitionReservationsMap
getReservations(UUID nodeId) {
+ @Nullable public synchronized Map<GroupPartitionIdPair, Long>
getReservations(UUID nodeId) {
if (map == null)
return null;
@@ -95,7 +95,7 @@ public class IgniteDhtPartitionHistorySuppliersMap implements
Message {
if (map == null)
map = new HashMap<>();
- PartitionReservationsMap nodeMap = map.computeIfAbsent(nodeId, k ->
new PartitionReservationsMap());
+ Map<GroupPartitionIdPair, Long> nodeMap = map.computeIfAbsent(nodeId,
k -> new HashMap<>());
nodeMap.put(new GroupPartitionIdPair(grpId, partId), cntr);
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/PartitionReservationsMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/PartitionReservationsMap.java
deleted file mode 100644
index 14eb95f0cf6..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/PartitionReservationsMap.java
+++ /dev/null
@@ -1,68 +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;
-import org.jetbrains.annotations.Nullable;
-
-/** Map for storing GroupPartitionIdPair and their respective history counter
values. */
-public class PartitionReservationsMap implements Message {
- /** Type code. */
- public static final short TYPE_CODE = 509;
-
- /** Mapping between GroupPartitionIdPair objects and their respective
history counter values. */
- @Order(0)
- Map<GroupPartitionIdPair, Long> map;
-
- /**
- * @return Partition reservations map.
- */
- public Map<GroupPartitionIdPair, Long> reservations() {
- return map;
- }
-
- /**
- * @param pair Pair of group ID and partition ID.
- * @return History counter for this pair or null.
- */
- public @Nullable Long get(GroupPartitionIdPair pair) {
- if (map == null)
- return null;
-
- return map.get(pair);
- }
-
- /**
- * @param pair Pair of group ID and partition ID.
- * @param counter History counter for this pair.
- */
- public void put(GroupPartitionIdPair pair, Long counter) {
- if (map == null)
- map = new HashMap<>();
-
- map.put(pair, counter);
- }
-
- /** {@inheritDoc} */
- @Override public short directType() {
- return TYPE_CODE;
- }
-}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java
index 66397139ad4..fb96d7da32e 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/CompressedMessageTest.java
@@ -27,9 +27,9 @@ import
org.apache.ignite.internal.direct.state.DirectMessageState;
import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GroupPartitionIdPair;
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.PartitionReservationsMap;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageFactory;
@@ -122,13 +122,13 @@ public class CompressedMessageTest {
/** */
private void assertEqualsFullMsg(GridDhtPartitionsFullMessage expected,
GridDhtPartitionsFullMessage actual) {
- Map<UUID, PartitionReservationsMap> expHistSuppliers =
U.field(expected.partitionHistorySuppliers(), "map");
- Map<UUID, PartitionReservationsMap> actHistSuppliers =
U.field(actual.partitionHistorySuppliers(), "map");
+ Map<UUID, Map<GroupPartitionIdPair, Long>> expHistSuppliers =
U.field(expected.partitionHistorySuppliers(), "map");
+ Map<UUID, Map<GroupPartitionIdPair, Long>> actHistSuppliers =
U.field(actual.partitionHistorySuppliers(), "map");
assertEquals(expHistSuppliers.size(), actHistSuppliers.size());
- for (Map.Entry<UUID, PartitionReservationsMap> entry :
expHistSuppliers.entrySet())
- assertEquals(entry.getValue().reservations(),
actHistSuppliers.get(entry.getKey()).reservations());
+ for (Map.Entry<UUID, Map<GroupPartitionIdPair, Long>> entry :
expHistSuppliers.entrySet())
+ assertEquals(entry.getValue(),
actHistSuppliers.get(entry.getKey()));
Map<UUID, Map<Integer, Set<Integer>>> expPartsToReload =
U.field((Object)U.field(expected, "partsToReload"), "map");
Map<UUID, Map<Integer, Set<Integer>>> actPartsToReload =
U.field((Object)U.field(actual, "partsToReload"), "map");