rpc: fix system::health
This commit is contained in:
parent
431b28e0cf
commit
91b874c4ef
1 changed files with 3 additions and 3 deletions
|
@ -456,14 +456,14 @@ impl System {
|
||||||
let mut partitions_quorum = 0;
|
let mut partitions_quorum = 0;
|
||||||
let mut partitions_all_ok = 0;
|
let mut partitions_all_ok = 0;
|
||||||
for (_, hash) in partitions.iter() {
|
for (_, hash) in partitions.iter() {
|
||||||
let write_sets = layout
|
let mut write_sets = layout
|
||||||
.versions
|
.versions
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| x.nodes_of(hash, x.replication_factor));
|
.map(|x| x.nodes_of(hash, x.replication_factor));
|
||||||
let has_quorum = write_sets
|
let has_quorum = write_sets
|
||||||
.clone()
|
.clone()
|
||||||
.all(|set| set.filter(|x| node_up(x)).count() >= quorum);
|
.all(|set| set.filter(|x| node_up(x)).count() >= quorum);
|
||||||
let all_ok = write_sets.clone().all(|mut set| set.all(|x| node_up(&x)));
|
let all_ok = write_sets.all(|mut set| set.all(|x| node_up(&x)));
|
||||||
if has_quorum {
|
if has_quorum {
|
||||||
partitions_quorum += 1;
|
partitions_quorum += 1;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ impl System {
|
||||||
|
|
||||||
// Determine overall cluster status
|
// Determine overall cluster status
|
||||||
let status =
|
let status =
|
||||||
if partitions_quorum == partitions.len() && storage_nodes_ok == storage_nodes.len() {
|
if partitions_all_ok == partitions.len() && storage_nodes_ok == storage_nodes.len() {
|
||||||
ClusterHealthStatus::Healthy
|
ClusterHealthStatus::Healthy
|
||||||
} else if partitions_quorum == partitions.len() {
|
} else if partitions_quorum == partitions.len() {
|
||||||
ClusterHealthStatus::Degraded
|
ClusterHealthStatus::Degraded
|
||||||
|
|
Loading…
Reference in a new issue