Search in sources :

Example 1 with ConfigCheckReport

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

the class ConfigCheckerIntegrationTest method multiMasters.

@Test
public void multiMasters() 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).setClusterName("ConfigCheckerMultiMastersTest").setNumMasters(TEST_NUM_MASTERS).setNumWorkers(0).setMasterProperties(masterProperties).build();
    mCluster.start();
    ConfigCheckReport report = getReport();
    // When using embedded journal, the journal paths are different
    assertEquals(mCluster.getDeployMode().equals(DeployMode.ZOOKEEPER_HA) ? ConfigStatus.WARN : 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)

Example 2 with ConfigCheckReport

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

the class ConfigCheckerIntegrationTest method multiNodes.

@Test
public void multiNodes() throws Exception {
    PropertyKey key = PropertyKey.UNDERFS_LISTING_LENGTH;
    // Prepare properties
    Map<Integer, Map<PropertyKey, String>> properties = generatePropertyWithDifferentValues(TEST_NUM_MASTERS + TEST_NUM_WORKERS, key);
    Map<Integer, Map<PropertyKey, String>> masterProperties = properties.entrySet().stream().filter(entry -> (entry.getKey() < TEST_NUM_MASTERS)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
    Map<Integer, Map<PropertyKey, String>> workerProperties = properties.entrySet().stream().filter(entry -> (entry.getKey() >= TEST_NUM_MASTERS)).collect(Collectors.toMap(entry -> entry.getKey() - TEST_NUM_MASTERS, Map.Entry::getValue));
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.CONFIG_CHECKER_MULTI_NODES).setClusterName("ConfigCheckerMultiNodesTest").setNumMasters(TEST_NUM_MASTERS).setNumWorkers(TEST_NUM_WORKERS).setMasterProperties(masterProperties).setWorkerProperties(workerProperties).build();
    mCluster.start();
    ConfigCheckReport report = getReport();
    assertEquals(ConfigStatus.FAILED, report.getConfigStatus());
    assertThat(report.getConfigErrors().toString(), CoreMatchers.containsString(key.getName()));
    mCluster.notifySuccess();
}
Also used : CoreMatchers(org.hamcrest.CoreMatchers) MultiProcessCluster(alluxio.multi.process.MultiProcessCluster) HashMap(java.util.HashMap) PropertyKey(alluxio.conf.PropertyKey) Scope(alluxio.grpc.Scope) Assert.assertThat(org.junit.Assert.assertThat) JournalType(alluxio.master.journal.JournalType) Constants(alluxio.Constants) After(org.junit.After) Map(java.util.Map) PortCoordination(alluxio.multi.process.PortCoordination) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) DeployMode(alluxio.multi.process.MultiProcessCluster.DeployMode) ServerConfiguration(alluxio.conf.ServerConfiguration) MetaMasterClient(alluxio.client.meta.MetaMasterClient) ImmutableMap(com.google.common.collect.ImmutableMap) Assert.assertTrue(org.junit.Assert.assertTrue) InconsistentProperty(alluxio.wire.InconsistentProperty) Test(org.junit.Test) Collectors(java.util.stream.Collectors) ConfigStatus(alluxio.grpc.ConfigStatus) List(java.util.List) Optional(java.util.Optional) Assert.assertEquals(org.junit.Assert.assertEquals) ConfigCheckReport(alluxio.wire.ConfigCheckReport) 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)

Example 3 with ConfigCheckReport

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

the class ConfigCheckerIntegrationTest method multiWorkers.

@Test
public void multiWorkers() throws Exception {
    PropertyKey key = PropertyKey.WORKER_FREE_SPACE_TIMEOUT;
    Map<Integer, Map<PropertyKey, String>> workerProperties = generatePropertyWithDifferentValues(TEST_NUM_WORKERS, key);
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.CONFIG_CHECKER_MULTI_WORKERS).setClusterName("ConfigCheckerMultiWorkersTest").setNumMasters(1).setNumWorkers(TEST_NUM_WORKERS).setWorkerProperties(workerProperties).build();
    mCluster.start();
    ConfigCheckReport report = getReport();
    // The workers values of many directory related properties are different
    assertEquals(ConfigStatus.WARN, 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)

Example 4 with ConfigCheckReport

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

the class ServerConfigurationCheckerTest method checkResults.

/**
 * Checks if the server-side configuration report is as expected.
 *
 * @param expectedErrorNum the expected error number
 * @param expectedWarnNum the expected warning number
 * @param expectedStatus the expected config check status
 */
private void checkResults(int expectedErrorNum, int expectedWarnNum, ConfigStatus expectedStatus) {
    mConfigChecker.regenerateReport();
    ConfigCheckReport report = mConfigChecker.getConfigCheckReport();
    assertEquals(expectedErrorNum, report.getConfigErrors().size());
    assertEquals(expectedWarnNum, report.getConfigWarns().size());
    assertEquals(expectedStatus, report.getConfigStatus());
}
Also used : ConfigCheckReport(alluxio.wire.ConfigCheckReport)

Example 5 with ConfigCheckReport

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

the class AlluxioMasterRestServiceHandler method getWebUIOverview.

/**
 * Gets Web UI overview page data.
 *
 * @return the response object
 */
@GET
@Path(WEBUI_OVERVIEW)
public Response getWebUIOverview() {
    return RestUtils.call(() -> {
        MasterWebUIOverview response = new MasterWebUIOverview();
        response.setDebug(ServerConfiguration.getBoolean(PropertyKey.DEBUG)).setMasterNodeAddress(mMasterProcess.getRpcAddress().toString()).setUptime(CommonUtils.convertMsToClockTime(System.currentTimeMillis() - mMetaMaster.getStartTimeMs())).setStartTime(CommonUtils.convertMsToDate(mMetaMaster.getStartTimeMs(), ServerConfiguration.getString(PropertyKey.USER_DATE_FORMAT_PATTERN))).setVersion(RuntimeConstants.VERSION).setLiveWorkerNodes(Integer.toString(mBlockMaster.getWorkerCount())).setCapacity(FormatUtils.getSizeFromBytes(mBlockMaster.getCapacityBytes())).setClusterId(mMetaMaster.getClusterID()).setReplicaBlockCount(Long.toString(mBlockMaster.getBlockReplicaCount())).setUniqueBlockCount(Long.toString(mBlockMaster.getUniqueBlockCount())).setTotalPath(Long.toString(mFileSystemMaster.getInodeCount())).setUsedCapacity(FormatUtils.getSizeFromBytes(mBlockMaster.getUsedBytes())).setFreeCapacity(FormatUtils.getSizeFromBytes(mBlockMaster.getCapacityBytes() - mBlockMaster.getUsedBytes()));
        ConfigCheckReport report = mMetaMaster.getConfigCheckReport();
        response.setConfigCheckStatus(report.getConfigStatus()).setConfigCheckErrors(report.getConfigErrors()).setConfigCheckWarns(report.getConfigWarns()).setConfigCheckErrorNum(report.getConfigErrors().values().stream().mapToInt(List::size).sum()).setConfigCheckWarnNum(report.getConfigWarns().values().stream().mapToInt(List::size).sum());
        StorageTierAssoc globalStorageTierAssoc = mBlockMaster.getGlobalStorageTierAssoc();
        List<StorageTierInfo> infosList = new ArrayList<>();
        Map<String, Long> totalBytesOnTiers = mBlockMaster.getTotalBytesOnTiers();
        Map<String, Long> usedBytesOnTiers = mBlockMaster.getUsedBytesOnTiers();
        for (int ordinal = 0; ordinal < globalStorageTierAssoc.size(); ordinal++) {
            String tierAlias = globalStorageTierAssoc.getAlias(ordinal);
            if (totalBytesOnTiers.containsKey(tierAlias) && totalBytesOnTiers.get(tierAlias) > 0) {
                StorageTierInfo info = new StorageTierInfo(tierAlias, totalBytesOnTiers.get(tierAlias), usedBytesOnTiers.get(tierAlias));
                infosList.add(info);
            }
        }
        response.setStorageTierInfos(infosList);
        MountPointInfo mountInfo;
        try {
            mountInfo = mFileSystemMaster.getDisplayMountPointInfo(new AlluxioURI(MountTable.ROOT));
            long capacityBytes = mountInfo.getUfsCapacityBytes();
            long usedBytes = mountInfo.getUfsUsedBytes();
            long freeBytes = -1;
            if (usedBytes >= 0 && capacityBytes >= usedBytes) {
                freeBytes = capacityBytes - usedBytes;
            }
            String totalSpace = "UNKNOWN";
            if (capacityBytes >= 0) {
                totalSpace = FormatUtils.getSizeFromBytes(capacityBytes);
            }
            response.setDiskCapacity(totalSpace);
            String usedSpace = "UNKNOWN";
            if (usedBytes >= 0) {
                usedSpace = FormatUtils.getSizeFromBytes(usedBytes);
            }
            response.setDiskUsedCapacity(usedSpace);
            String freeSpace = "UNKNOWN";
            if (freeBytes >= 0) {
                freeSpace = FormatUtils.getSizeFromBytes(freeBytes);
            }
            response.setDiskFreeCapacity(freeSpace);
        } catch (Throwable e) {
            response.setDiskCapacity("UNKNOWN").setDiskUsedCapacity("UNKNOWN").setDiskFreeCapacity("UNKNOWN");
        }
        mMetaMaster.getJournalSpaceMonitor().map(monitor -> response.setJournalDiskWarnings(monitor.getJournalDiskWarnings()));
        Gauge entriesSinceGauge = MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricKey.MASTER_JOURNAL_ENTRIES_SINCE_CHECKPOINT.getName());
        Gauge lastCkPtGauge = MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricKey.MASTER_JOURNAL_LAST_CHECKPOINT_TIME.getName());
        if (entriesSinceGauge != null && lastCkPtGauge != null) {
            long entriesSinceCkpt = (Long) entriesSinceGauge.getValue();
            long lastCkptTime = (Long) lastCkPtGauge.getValue();
            long timeSinceCkpt = System.currentTimeMillis() - lastCkptTime;
            boolean overThreshold = timeSinceCkpt > ServerConfiguration.getMs(PropertyKey.MASTER_WEB_JOURNAL_CHECKPOINT_WARNING_THRESHOLD_TIME);
            boolean passedThreshold = entriesSinceCkpt > ServerConfiguration.getLong(PropertyKey.MASTER_JOURNAL_CHECKPOINT_PERIOD_ENTRIES);
            if (passedThreshold && overThreshold) {
                String time = lastCkptTime > 0 ? ZonedDateTime.ofInstant(Instant.ofEpochMilli(lastCkptTime), ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT) : "N/A";
                String advice = ConfigurationUtils.isHaMode(ServerConfiguration.global()) ? "" : "It is recommended to use the fsadmin tool to checkpoint the journal. This will " + "prevent the master from serving requests while checkpointing.";
                response.setJournalCheckpointTimeWarning(String.format("Journal has not checkpointed in " + "a timely manner since passing the checkpoint threshold (%d/%d). Last checkpoint:" + " %s. %s", entriesSinceCkpt, ServerConfiguration.getLong(PropertyKey.MASTER_JOURNAL_CHECKPOINT_PERIOD_ENTRIES), time, advice));
            }
        }
        Gauge masterRoleIdGauge = MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricKey.MASTER_ROLE_ID.getName());
        Gauge leaderIdGauge = MetricsSystem.METRIC_REGISTRY.getGauges().get(MetricKey.CLUSTER_LEADER_ID.getName());
        if (masterRoleIdGauge != null) {
            response.setMasterRole(RaftProtos.RaftPeerRole.forNumber((Integer) masterRoleIdGauge.getValue()).name());
        }
        if (leaderIdGauge != null) {
            response.setLeaderId((String) leaderIdGauge.getValue());
        }
        return response;
    }, ServerConfiguration.global());
}
Also used : MasterStorageTierAssoc(alluxio.MasterStorageTierAssoc) StorageTierAssoc(alluxio.StorageTierAssoc) ArrayList(java.util.ArrayList) Gauge(com.codahale.metrics.Gauge) MountPointInfo(alluxio.wire.MountPointInfo) ConfigCheckReport(alluxio.wire.ConfigCheckReport) MasterWebUIOverview(alluxio.wire.MasterWebUIOverview) ArrayList(java.util.ArrayList) List(java.util.List) StorageTierInfo(alluxio.util.webui.StorageTierInfo) AlluxioURI(alluxio.AlluxioURI) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

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