conf.put(PropertyKey.LOGGER_TYPE, "WORKER_LOGGER"); conf.put(PropertyKey.CONF_DIR, confDir.getAbsolutePath()); conf.put(PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(0), ramdisk.getAbsolutePath()); conf.put(PropertyKey.LOGS_DIR, logsDir.getAbsolutePath());
PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_ALIAS.format(level); String alias = Configuration.get(tierAliasConf); PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(level); String[] dirPaths = Configuration.get(tierDirPathConf).split(","); PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_QUOTA.format(level); String rawDirQuota = Configuration.get(tierDirCapacityConf); if (rawDirQuota.isEmpty()) {
for (int level = 0; level < storageLevels; level++) { PropertyKey tierLevelDirPath = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(level); String[] dirPaths = Configuration.get(tierLevelDirPath).split(","); String name = "Data path for tier " + level;
/** * Sets up corresponding directories for tests. */ protected void setupTest() throws IOException { UnderFileSystem ufs = UnderFileSystem.Factory.createForRoot(); String underfsAddress = Configuration.get(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.get(). UnderFileSystemUtils.mkdirIfNotExists(ufs, underfsAddress); // Creates storage dirs for worker int numLevel = Configuration.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 = Configuration.get(tierLevelDirPath).split(","); for (String dirPath : dirPaths) { FileUtils.createDir(dirPath); } } // Formats the journal Format.format(Format.Mode.MASTER); }
/** * Constructs a new instance using the given {@link Configuration} object. The mapping cannot be * modified after creation. * * @param levelsProperty the property in the conf that specifies how many levels there are * @param template the format for the conf that identifies the alias for each level */ protected StorageTierAssoc(PropertyKey levelsProperty, PropertyKey.Template template) { int levels = Configuration.getInt(levelsProperty); ImmutableBiMap.Builder<String, Integer> builder = new ImmutableBiMap.Builder<>(); for (int i = 0; i < levels; i++) { String alias = Configuration.get(template.format(i)); builder.put(alias, i); } mAliasToOrdinal = builder.build(); }