Skip to content
Permalink
Browse files
[NO ISSUE][CLUS] Add API to check for failed nodes
- user model changes: no
- storage format changes: no
- interface changes: yes

Details:

- Add API to check if some nodes failed in ClusterStateManager.
- Add sync progress to PartitionReplica toString.

Change-Id: I7a5eb5b070f0a8a7a2f1a952fd7db35df244246e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/13283
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
  • Loading branch information
mhubail committed Sep 20, 2021
1 parent 0d222c3 commit 195ce0f2f2f0004c1e863339c0d39e038db23fa4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
@@ -272,4 +272,12 @@ ClusterState waitForState(Predicate<ClusterState> condition, long timeout, TimeU
* @return the cluster partitions map
*/
Map<Integer, ClusterPartition> getClusterPartitions();

/**
* Returns true if any of the nodes in {@code nodesId} is currently inactive
*
* @param nodeIds
* @return true if any of the nodes is currently inactive, otherwise false
*/
boolean nodesFailed(Set<String> nodeIds);
}
@@ -160,6 +160,7 @@ private JsonNode asJson() {
ObjectNode json = OBJECT_MAPPER.createObjectNode();
json.put("id", id.toString());
json.put("status", status.name());
json.put("syncProgress", syncProgress);
return json;
}

@@ -478,6 +478,11 @@ public Map<Integer, ClusterPartition> getClusterPartitions() {
return Collections.unmodifiableMap(clusterPartitions);
}

@Override
public synchronized boolean nodesFailed(Set<String> nodeIds) {
return nodeIds.stream().anyMatch(failedNodes::contains);
}

private void updateClusterCounters(String nodeId, NcLocalCounters localCounters) {
final IResourceIdManager resourceIdManager = appCtx.getResourceIdManager();
resourceIdManager.report(nodeId, localCounters.getMaxResourceId());

0 comments on commit 195ce0f

Please sign in to comment.