Search in sources :

Example 11 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class EmulatingBlockIterator method initEvictorConfiguration.

/**
 * Used to calculate configuration that evictors need to run.
 */
private void initEvictorConfiguration() {
    StorageTierAssoc storageTierAssoc = new WorkerStorageTierAssoc();
    // Calculate tier capacities.
    Map<String, Long> tierCapacities = new HashMap<>();
    for (StorageTier tier : mMetadataManager.getTiers()) {
        tierCapacities.put(tier.getTierAlias(), tier.getCapacityBytes());
    }
    long lastTierReservedBytes = 0;
    for (int ordinal = 0; ordinal < storageTierAssoc.size(); ordinal++) {
        String tierAlias = storageTierAssoc.getAlias(ordinal);
        long tierCapacity = tierCapacities.get(tierAlias);
        // High watermark defines when to start the space reserving process.
        // It's only validated in this emulator, it doesn't trigger any background task.
        PropertyKey tierHighWatermarkProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_HIGH_WATERMARK_RATIO.format(ordinal);
        double tierHighWatermarkConf = ServerConfiguration.getDouble(tierHighWatermarkProp);
        Preconditions.checkArgument(tierHighWatermarkConf > 0, "The high watermark of tier %s should be positive, but is %s", Integer.toString(ordinal), tierHighWatermarkConf);
        Preconditions.checkArgument(tierHighWatermarkConf < 1, "The high watermark of tier %s should be less than 1.0, but is %s", Integer.toString(ordinal), tierHighWatermarkConf);
        // Low watermark defines when to stop the space reserving process if started
        PropertyKey tierLowWatermarkProp = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_LOW_WATERMARK_RATIO.format(ordinal);
        double tierLowWatermarkConf = ServerConfiguration.getDouble(tierLowWatermarkProp);
        Preconditions.checkArgument(tierLowWatermarkConf >= 0, "The low watermark of tier %s should not be negative, but is %s", Integer.toString(ordinal), tierLowWatermarkConf);
        Preconditions.checkArgument(tierLowWatermarkConf < tierHighWatermarkConf, "The low watermark (%s) of tier %d should not be smaller than the high watermark (%s)", tierLowWatermarkConf, ordinal, tierHighWatermarkConf);
        long reservedSpace = (long) (tierCapacity - tierCapacity * tierLowWatermarkConf);
        lastTierReservedBytes += reservedSpace;
        // On each tier, we reserve no more than its capacity
        lastTierReservedBytes = (lastTierReservedBytes <= tierCapacity) ? lastTierReservedBytes : tierCapacity;
        mReservedSpaces.put(tierAlias, lastTierReservedBytes);
        // Update special ANY_TIER to have total reserved capacity.
        if (mReservedSpaces.containsKey(BlockStoreLocation.ANY_TIER)) {
            mReservedSpaces.put(BlockStoreLocation.ANY_TIER, mReservedSpaces.get(BlockStoreLocation.ANY_TIER) + lastTierReservedBytes);
        } else {
            mReservedSpaces.put(BlockStoreLocation.ANY_TIER, lastTierReservedBytes);
        }
    }
}
Also used : HashMap(java.util.HashMap) StorageTierAssoc(alluxio.StorageTierAssoc) WorkerStorageTierAssoc(alluxio.WorkerStorageTierAssoc) StorageTier(alluxio.worker.block.meta.StorageTier) WorkerStorageTierAssoc(alluxio.WorkerStorageTierAssoc) PropertyKey(alluxio.conf.PropertyKey)

Example 12 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class AbstractLocalAlluxioCluster method setupTest.

/**
 * Sets up corresponding directories for tests.
 */
protected void setupTest() throws IOException {
    UnderFileSystem ufs = UnderFileSystem.Factory.createForRoot(ServerConfiguration.global());
    String underfsAddress = ServerConfiguration.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS);
    // Deletes the ufs dir for this test from to avoid permission problems
    UnderFileSystemUtils.deleteDirIfExists(ufs, underfsAddress);
    // Creates ufs dir. This must be called before starting UFS with UnderFileSystemCluster.create()
    UnderFileSystemUtils.mkdirIfNotExists(ufs, underfsAddress);
    // Creates storage dirs for worker
    int numLevel = ServerConfiguration.getInt(PropertyKey.WORKER_TIERED_STORE_LEVELS);
    for (int level = 0; level < numLevel; level++) {
        PropertyKey tierLevelDirPath = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(level);
        String[] dirPaths = ServerConfiguration.getString(tierLevelDirPath).split(",");
        for (String dirPath : dirPaths) {
            FileUtils.createDir(dirPath);
        }
    }
    // Formats the journal
    Format.format(Format.Mode.MASTER, ServerConfiguration.global());
}
Also used : UnderFileSystem(alluxio.underfs.UnderFileSystem) PropertyKey(alluxio.conf.PropertyKey)

Example 13 with PropertyKey

use of alluxio.conf.PropertyKey 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 14 with PropertyKey

use of alluxio.conf.PropertyKey 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 15 with PropertyKey

use of alluxio.conf.PropertyKey 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)

Aggregations

PropertyKey (alluxio.conf.PropertyKey)49 HashMap (java.util.HashMap)28 Test (org.junit.Test)16 Map (java.util.Map)15 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 AlluxioURI (alluxio.AlluxioURI)7 ConfigCheckReport (alluxio.wire.ConfigCheckReport)6 File (java.io.File)6 List (java.util.List)6 ConfigurationRule (alluxio.ConfigurationRule)5 Scope (alluxio.grpc.Scope)5 UnderFileSystemConfiguration (alluxio.underfs.UnderFileSystemConfiguration)5 Address (alluxio.wire.Address)5 ConfigProperty (alluxio.grpc.ConfigProperty)4 Closeable (java.io.Closeable)4 Optional (java.util.Optional)4 Constants (alluxio.Constants)3 AlluxioProperties (alluxio.conf.AlluxioProperties)3 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)3