Pochatkin commented on code in PR #4614:
URL: https://github.com/apache/ignite-3/pull/4614#discussion_r1832438272
##########
modules/rest-api/src/main/java/org/apache/ignite/internal/rest/api/cluster/ClusterState.java:
##########
@@ -64,24 +73,28 @@ public class ClusterState {
@JsonCreator
public ClusterState(
@JsonProperty("cmgNodes") Collection<String> cmgNodes,
- @JsonProperty("msNodes") Collection<String> msNodes,
+ @JsonProperty("msNodes") Collection<String> msNodes,
Review Comment:
Done
##########
modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java:
##########
@@ -84,16 +113,31 @@ public CompletableFuture<Void> init(@Body InitCommand
initCommand) {
});
}
- private static ClusterState
mapClusterState(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
+ private ClusterState
mapClusterState(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
return new ClusterState(
clusterState.cmgNodes(),
clusterState.metaStorageNodes(),
clusterState.igniteVersion().toString(),
new ClusterTag(clusterState.clusterTag().clusterName(),
clusterState.clusterTag().clusterId()),
- clusterState.formerClusterIds()
+ clusterState.formerClusterIds(),
+ mapClusterStatus(clusterState)
);
}
+ private ClusterStatus
mapClusterStatus(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
+ Set<String> metaStorageNodes = clusterState.metaStorageNodes();
+ long presentedMetaStorageNodes = topologyService.allMembers().stream()
Review Comment:
Done
##########
modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java:
##########
@@ -84,16 +113,31 @@ public CompletableFuture<Void> init(@Body InitCommand
initCommand) {
});
}
- private static ClusterState
mapClusterState(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
+ private ClusterState
mapClusterState(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
return new ClusterState(
clusterState.cmgNodes(),
clusterState.metaStorageNodes(),
clusterState.igniteVersion().toString(),
new ClusterTag(clusterState.clusterTag().clusterName(),
clusterState.clusterTag().clusterId()),
- clusterState.formerClusterIds()
+ clusterState.formerClusterIds(),
+ mapClusterStatus(clusterState)
);
}
+ private ClusterStatus
mapClusterStatus(org.apache.ignite.internal.cluster.management.ClusterState
clusterState) {
+ Set<String> metaStorageNodes = clusterState.metaStorageNodes();
+ long presentedMetaStorageNodes = topologyService.allMembers().stream()
+ .map(ClusterNode::name)
+ .filter(metaStorageNodes::contains)
+ .count();
+
+ if (presentedMetaStorageNodes <= metaStorageNodes.size() / 2) {
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]