PakhomovAlexander commented on code in PR #4614: URL: https://github.com/apache/ignite-3/pull/4614#discussion_r1860784774
########## modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java: ########## @@ -54,16 +62,46 @@ public class ClusterManagementController implements ClusterManagementApi, Resour */ public ClusterManagementController( ClusterInitializer clusterInitializer, + MetastoreGroupAvailabilityService metastoreAvailabilityService, ClusterManagementGroupManager clusterManagementGroupManager ) { this.clusterInitializer = clusterInitializer; this.clusterManagementGroupManager = clusterManagementGroupManager; + this.metastoreAvailabilityService = metastoreAvailabilityService; } /** {@inheritDoc} */ @Override - public CompletableFuture<ClusterState> clusterState() { - return clusterManagementGroupManager.clusterState().thenApply(ClusterManagementController::mapClusterState); + public CompletableFuture<ClusterStateDto> clusterState() { + CompletableFuture<GroupState> metastoreFut = CompletableFutures.combine( + metastoreAvailabilityService.isAlive() + .thenApply(isAlive1 -> isAlive1 ? GroupStatus.HEALTHY : GroupStatus.MAJORITY_LOST), + metastoreAvailabilityService.availableMembers(), + (groupStatus, strings) -> new GroupState(strings, groupStatus) + ); + + CompletableFuture<ClusterStateDtoBuilder> builderFut = clusterManagementGroupManager.clusterState() + .handle((state, t) -> { + ClusterStateDtoBuilder builder = ClusterStateDtoBuilder.newInstance(); + if (state != null) { + builder.igniteVersion(state.version()) + .clusterTag(new ClusterTag(state.clusterTag().clusterName(), state.clusterTag().clusterId())) + .formerClusterIds(state.formerClusterIds()); + } else { + builder.igniteVersion("N/A").clusterTag(new ClusterTag("N/A", null)); Review Comment: `builder.unknownState()` might be useful here. -- 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