shishkovilja commented on code in PR #12467: URL: https://github.com/apache/ignite/pull/12467#discussion_r2469259500
########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionReservationsMessage.java: ########## @@ -0,0 +1,63 @@ +/* + * 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; + +/** Message for storing GroupPartitionIdMessage and their respective history counter values. */ +public class IgniteDhtPartitionReservationsMessage implements Message { Review Comment: ```suggestion public class PartitionReservationsMap implements Message { ``` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GroupPartitionIdMessage.java: ########## @@ -0,0 +1,101 @@ +/* + * 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.Objects; +import org.apache.ignite.internal.Order; +import org.apache.ignite.plugin.extensions.communication.Message; + +/** Message for storing group ID and partition ID. */ +public class GroupPartitionIdMessage implements Message { Review Comment: ```suggestion public class GroupPartitionIdPair implements Message { ``` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java: ########## @@ -61,10 +62,10 @@ public synchronized List<UUID> getSupplier(int grpId, int partId, long cntrSince List<UUID> suppliers = new ArrayList<>(); - for (Map.Entry<UUID, Map<T2<Integer, Integer>, Long>> e : map.entrySet()) { + for (Map.Entry<UUID, IgniteDhtPartitionReservationsMessage> e : map.entrySet()) { UUID supplierNode = e.getKey(); - Long historyCounter = e.getValue().get(new T2<>(grpId, partId)); + Long historyCounter = e.getValue().map().get(new GroupPartitionIdMessage(grpId, partId)); Review Comment: Let's incapsulate it into partition reservations message. ########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java: ########## @@ -77,11 +78,13 @@ public synchronized List<UUID> getSupplier(int grpId, int partId, long cntrSince * @param nodeId Node ID to check. * @return Reservations for the given node. */ - @Nullable public synchronized Map<T2<Integer, Integer>, Long> getReservations(UUID nodeId) { + @Nullable public synchronized Map<GroupPartitionIdMessage, Long> getReservations(UUID nodeId) { if (map == null) return null; - return map.get(nodeId); + IgniteDhtPartitionReservationsMessage msg = map.get(nodeId); Review Comment: Let's return raw message. ########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java: ########## @@ -77,11 +78,13 @@ public synchronized List<UUID> getSupplier(int grpId, int partId, long cntrSince * @param nodeId Node ID to check. * @return Reservations for the given node. */ - @Nullable public synchronized Map<T2<Integer, Integer>, Long> getReservations(UUID nodeId) { + @Nullable public synchronized Map<GroupPartitionIdMessage, Long> getReservations(UUID nodeId) { Review Comment: ```suggestion @Nullable public synchronized PartitionReservationsMap getReservations(UUID nodeId) { ``` ########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/IgniteDhtPartitionHistorySuppliersMap.java: ########## @@ -94,15 +97,18 @@ public synchronized void put(UUID nodeId, int grpId, int partId, long cntr) { if (map == null) map = new HashMap<>(); - Map<T2<Integer, Integer>, Long> nodeMap = map.get(nodeId); + IgniteDhtPartitionReservationsMessage nodeMap = map.get(nodeId); if (nodeMap == null) { - nodeMap = new HashMap<>(); + nodeMap = new IgniteDhtPartitionReservationsMessage(new HashMap<>()); map.put(nodeId, nodeMap); } - nodeMap.put(new T2<>(grpId, partId), cntr); + if (nodeMap.map() == null) Review Comment: Let's incapsulate it into a IgniteDhtPartitionReservationsMessage -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
