Cyrill commented on code in PR #6288: URL: https://github.com/apache/ignite-3/pull/6288#discussion_r2222963692
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java: ########## @@ -845,16 +856,110 @@ public CompletableFuture<Map<TablePartitionId, GlobalTablePartitionState>> globa } } + /** + * Converts {@link LocalPartitionStateMessageByNode} to a mapping of zone names to the set of zone partitions. + * + * @param partitionStateMap Partition state map. + * @return Mapping of zone names to the set of zone partitions. + */ + private static Map<String, Set<ZonePartitionId>> toZonesOnNodes( + Map<ZonePartitionId, LocalPartitionStateMessageByNode> partitionStateMap + ) { + Map<String, Set<ZonePartitionId>> res = new HashMap<>(); + + for (Map.Entry<ZonePartitionId, LocalPartitionStateMessageByNode> entry : partitionStateMap.entrySet()) { + ZonePartitionId zonePartitionId = entry.getKey(); + + LocalPartitionStateMessageByNode zoneLocalPartitionStateMessageByNode = entry.getValue(); + + for (String nodeName : zoneLocalPartitionStateMessageByNode.nodes()) { + res.computeIfAbsent(nodeName, k -> new HashSet<>()).add(zonePartitionId); + } + } + + return res; + } + + /** + * Returns estimated number of rows for each table having a partition in the specified zones. + * + * <p>The result is returned from the nodes specified in the {@code zonesOnNodes.keySet()} - + * these are the nodes we previously received partition states from. + * + * @param zonesOnNodes Mapping of node names to the set of zone partitions. + * @param catalogVersion Catalog version. + * @return Future with the mapping. + */ + private CompletableFuture<Map<String, Map<ZonePartitionId, Map<TablePartitionIdMessage, Long>>>> tableStateForZone( Review Comment: Well, strictly speaking no. We need to align the data from the new message with the code that maps zone-based representation to table-based one. What we have now is the structure Node-> TablePartitonId-> Estimated size. Imagine we have changed to just processing TablePartitonId-> Estimated size and we have 2 replicas and 2 nodes, and we insert one entry. In that case the result of locasState call will return exactly the same value 1 for both nodes, though one of them might have not received the real data, in other words it will return nodeA.estimatedSize = 1, nodeA.estimatedSize = 1. But now the response will keep returning nodeA.estimatedSize = 0, nodeA.estimatedSize = 1 until nodeA proves it has the data. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org