Cyrill commented on code in PR #5544: URL: https://github.com/apache/ignite-3/pull/5544#discussion_r2031199790
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java: ########## @@ -947,6 +1238,41 @@ private static void putUnavailableStateIfAbsent( ); } + private static GlobalZonePartitionState assembleGlobalZoneStateFromLocal( + Catalog catalog, + ZonePartitionId zonePartitionId, + LocalZonePartitionStateByNode map + ) { + CatalogZoneDescriptor zoneDescriptor = catalog.zone(zonePartitionId.zoneId()); + + int replicas = zoneDescriptor.replicas(); + int quorum = replicas / 2 + 1; + + Map<LocalPartitionStateEnum, List<LocalZonePartitionState>> groupedStates = map.values().stream() + .collect(groupingBy(localPartitionState -> localPartitionState.state)); + + GlobalPartitionStateEnum globalStateEnum; + + int healthyReplicas = groupedStates.getOrDefault(HEALTHY, emptyList()).size(); + + if (healthyReplicas == replicas) { + globalStateEnum = AVAILABLE; + } else if (healthyReplicas >= quorum) { + globalStateEnum = DEGRADED; + } else if (healthyReplicas > 0) { + globalStateEnum = READ_ONLY; + } else { + globalStateEnum = GlobalPartitionStateEnum.UNAVAILABLE; + } + Review Comment: done -- 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