Search in sources :

Example 6 with ConfigCheckReport

use of alluxio.wire.ConfigCheckReport 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);
}
Also used : Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) InconsistentProperty(alluxio.wire.InconsistentProperty) HashMap(java.util.HashMap) PropertyKey(alluxio.conf.PropertyKey) Collectors(java.util.stream.Collectors) Scope(alluxio.grpc.Scope) ArrayList(java.util.ArrayList) ConfigStatus(alluxio.grpc.ConfigStatus) List(java.util.List) Map(java.util.Map) Optional(java.util.Optional) ConsistencyCheckLevel(alluxio.conf.PropertyKey.ConsistencyCheckLevel) Address(alluxio.wire.Address) ConfigCheckReport(alluxio.wire.ConfigCheckReport) HashMap(java.util.HashMap) Scope(alluxio.grpc.Scope) ConfigCheckReport(alluxio.wire.ConfigCheckReport) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) PropertyKey(alluxio.conf.PropertyKey) InconsistentProperty(alluxio.wire.InconsistentProperty) ConfigStatus(alluxio.grpc.ConfigStatus)

Example 7 with ConfigCheckReport

use of alluxio.wire.ConfigCheckReport 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;
}
Also used : Scope(alluxio.grpc.Scope) ConfigCheckReport(alluxio.wire.ConfigCheckReport) List(java.util.List) ConfigStatus(alluxio.grpc.ConfigStatus)

Example 8 with ConfigCheckReport

use of alluxio.wire.ConfigCheckReport in project alluxio by Alluxio.

the class ConfigCheckerIntegrationTest method unsetVsSet.

@Test
public void unsetVsSet() throws Exception {
    Map<Integer, Map<PropertyKey, String>> masterProperties = ImmutableMap.of(1, ImmutableMap.of(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION, "option"));
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.CONFIG_CHECKER_UNSET_VS_SET).setClusterName("ConfigCheckerUnsetVsSet").setNumMasters(2).setNumWorkers(0).setMasterProperties(masterProperties).build();
    mCluster.start();
    ConfigCheckReport report = getReport();
    Map<Scope, List<InconsistentProperty>> errors = report.getConfigErrors();
    assertTrue(errors.containsKey(Scope.MASTER));
    if (mCluster.getDeployMode().equals(DeployMode.ZOOKEEPER_HA)) {
        assertEquals(1, errors.get(Scope.MASTER).size());
        InconsistentProperty property = errors.get(Scope.MASTER).get(0);
        assertEquals(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION.getName(), property.getName());
        assertTrue(property.getValues().containsKey(Optional.of("option")));
        assertTrue(property.getValues().containsKey(Optional.empty()));
    } else {
        // When using embedded journal, the journal paths are different
        assertEquals(2, errors.get(Scope.MASTER).size());
        assertThat(report.getConfigErrors().toString(), CoreMatchers.containsString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION.getName()));
    }
    mCluster.notifySuccess();
}
Also used : Scope(alluxio.grpc.Scope) ConfigCheckReport(alluxio.wire.ConfigCheckReport) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) InconsistentProperty(alluxio.wire.InconsistentProperty) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 9 with ConfigCheckReport

use of alluxio.wire.ConfigCheckReport in project alluxio by Alluxio.

the class ConfigCheckerIntegrationTest method multiMastersEmbeddedHA.

@Test
public void multiMastersEmbeddedHA() throws Exception {
    PropertyKey key = PropertyKey.MASTER_JOURNAL_FLUSH_TIMEOUT_MS;
    Map<Integer, Map<PropertyKey, String>> masterProperties = generatePropertyWithDifferentValues(TEST_NUM_MASTERS, key);
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.CONFIG_CHECKER_MULTI_MASTERS_EMBEDDED_HA).setClusterName("ConfigCheckerMultiMastersEmbeddedHATest").setNumMasters(TEST_NUM_MASTERS).setNumWorkers(0).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.EMBEDDED.toString()).setMasterProperties(masterProperties).build();
    mCluster.start();
    ConfigCheckReport report = getReport();
    // The master values of {@link PropertyKey#ALLUXIO_MASTER_JOURNAL_FOLDER} are different
    // when using embedded HA
    assertEquals(ConfigStatus.FAILED, report.getConfigStatus());
    assertThat(report.getConfigWarns().toString(), CoreMatchers.containsString(key.getName()));
    mCluster.notifySuccess();
}
Also used : ConfigCheckReport(alluxio.wire.ConfigCheckReport) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) PropertyKey(alluxio.conf.PropertyKey) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

ConfigCheckReport (alluxio.wire.ConfigCheckReport)9 HashMap (java.util.HashMap)6 Map (java.util.Map)6 PropertyKey (alluxio.conf.PropertyKey)5 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)5 ImmutableMap (com.google.common.collect.ImmutableMap)5 List (java.util.List)5 Test (org.junit.Test)5 Scope (alluxio.grpc.Scope)4 ConfigStatus (alluxio.grpc.ConfigStatus)3 InconsistentProperty (alluxio.wire.InconsistentProperty)3 ArrayList (java.util.ArrayList)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 AlluxioURI (alluxio.AlluxioURI)1 Constants (alluxio.Constants)1 MasterStorageTierAssoc (alluxio.MasterStorageTierAssoc)1 StorageTierAssoc (alluxio.StorageTierAssoc)1 MetaMasterClient (alluxio.client.meta.MetaMasterClient)1 ConsistencyCheckLevel (alluxio.conf.PropertyKey.ConsistencyCheckLevel)1