use of alluxio.grpc.ConfigStatus in project alluxio by Alluxio.
the class ServerConfigurationChecker method regenerateReport.
/**
* Checks the server-side configurations and records the check results.
*/
public synchronized void regenerateReport() {
// Generate the configuration map from master and worker configuration records
Map<PropertyKey, Map<Optional<String>, List<String>>> confMap = generateConfMap();
// Update the errors and warnings configuration
Map<Scope, List<InconsistentProperty>> confErrors = new HashMap<>();
Map<Scope, List<InconsistentProperty>> confWarns = new HashMap<>();
for (Map.Entry<PropertyKey, Map<Optional<String>, List<String>>> entry : confMap.entrySet()) {
if (entry.getValue().size() >= 2) {
PropertyKey key = entry.getKey();
InconsistentProperty inconsistentProperty = new InconsistentProperty().setName(key.getName()).setValues(entry.getValue());
Scope scope = key.getScope().equals(Scope.ALL) ? Scope.SERVER : key.getScope();
if (entry.getKey().getConsistencyLevel().equals(ConsistencyCheckLevel.ENFORCE)) {
confErrors.putIfAbsent(scope, new ArrayList<>());
confErrors.get(scope).add(inconsistentProperty);
} else {
confWarns.putIfAbsent(scope, new ArrayList<>());
confWarns.get(scope).add(inconsistentProperty);
}
}
}
// Update configuration status
ConfigStatus status = confErrors.values().stream().anyMatch(a -> a.size() > 0) ? ConfigStatus.FAILED : confWarns.values().stream().anyMatch(a -> a.size() > 0) ? ConfigStatus.WARN : ConfigStatus.PASSED;
if (!status.equals(mConfigCheckReport.getConfigStatus())) {
logConfigReport();
}
mConfigCheckReport = new ConfigCheckReport(confErrors, confWarns, status);
}
use of alluxio.grpc.ConfigStatus in project alluxio by Alluxio.
the class ConfigurationCommand method run.
/**
* Runs doctor configuration command.
*
* @return 0 on success, 1 otherwise
*/
public int run() throws IOException {
ConfigCheckReport report = mMetaMasterClient.getConfigReport();
ConfigStatus configStatus = report.getConfigStatus();
if (configStatus == ConfigStatus.PASSED) {
// No errors or warnings to show
mPrintStream.println("No server-side configuration errors or warnings.");
return 0;
}
Map<Scope, List<InconsistentProperty>> errors = report.getConfigErrors();
if (errors.size() != 0) {
mPrintStream.println("Server-side configuration errors " + "(those properties are required to be identical): ");
printInconsistentProperties(errors);
}
Map<Scope, List<InconsistentProperty>> warnings = report.getConfigWarns();
if (warnings.size() != 0) {
mPrintStream.println("\nServer-side configuration warnings " + "(those properties are recommended to be identical): ");
printInconsistentProperties(warnings);
}
return 0;
}
Aggregations