use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class AddCommand method run.
@Override
public int run(CommandLine cl) throws IOException {
AlluxioURI path = new AlluxioURI(cl.getArgs()[0]);
Map<PropertyKey, String> propertyMap = new HashMap<>();
if (cl.hasOption(PROPERTY_OPTION_NAME)) {
Map<String, String> properties = Maps.fromProperties(cl.getOptionProperties(PROPERTY_OPTION_NAME));
for (Map.Entry<String, String> property : properties.entrySet()) {
PropertyKey key = PropertyKey.fromString(property.getKey());
if (!GrpcUtils.contains(key.getScope(), Scope.CLIENT)) {
throw new InvalidArgumentException(nonClientScopePropertyException(key));
}
propertyMap.put(key, property.getValue());
}
}
mMetaConfigClient.setPathConfiguration(path, propertyMap);
return 0;
}
use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class RemoveCommand method run.
@Override
public int run(CommandLine cl) throws IOException {
AlluxioURI path = new AlluxioURI(cl.getArgs()[0]);
if (cl.hasOption(KEYS_OPTION_NAME)) {
String[] keys = cl.getOptionValue(KEYS_OPTION_NAME).split(",");
Set<PropertyKey> propertyKeys = new HashSet<>();
for (String key : keys) {
propertyKeys.add(PropertyKey.fromString(key));
}
mMetaConfigClient.removePathConfiguration(path, propertyKeys);
} else {
mMetaConfigClient.removePathConfiguration(path);
}
return 0;
}
use of alluxio.conf.PropertyKey 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();
}
use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class JournalBackupIntegrationTest method backupDelegationTest.
private void backupDelegationTest(MultiProcessCluster.Builder clusterBuilder) throws Exception {
// Update configuration for each master to backup to a specific folder.
Map<Integer, Map<PropertyKey, String>> masterProps = new HashMap<>();
File backupsParent0 = AlluxioTestDirectory.createTemporaryDirectory("backups0");
File backupsParent1 = AlluxioTestDirectory.createTemporaryDirectory("backups1");
Map<PropertyKey, String> master0Props = new HashMap<>();
master0Props.put(PropertyKey.MASTER_BACKUP_DIRECTORY, backupsParent0.getAbsolutePath());
Map<PropertyKey, String> master1Props = new HashMap<>();
master1Props.put(PropertyKey.MASTER_BACKUP_DIRECTORY, backupsParent1.getAbsolutePath());
masterProps.put(0, master0Props);
masterProps.put(1, master1Props);
clusterBuilder.setMasterProperties(masterProps);
// Start cluster.
mCluster = clusterBuilder.build();
mCluster.start();
// Delegation test can work with 2 masters only.
assertEquals(2, mCluster.getMasterAddresses().size());
FileSystem fs = mCluster.getFileSystemClient();
AlluxioURI dir1 = new AlluxioURI("/dir1");
mCluster.getFileSystemClient().createDirectory(dir1, CreateDirectoryPOptions.newBuilder().setWriteType(WritePType.MUST_CACHE).build());
AlluxioURI backupUri = waitForBackup(BackupPRequest.newBuilder().setOptions(BackupPOptions.newBuilder().setLocalFileSystem(true)).build());
int primaryIndex = mCluster.getPrimaryMasterIndex(GET_PRIMARY_INDEX_TIMEOUT_MS);
int followerIndex = (primaryIndex + 1) % 2;
// Validate backup is taken on follower's local path.
assertTrue(backupUri.toString().contains(masterProps.get(followerIndex).get(PropertyKey.MASTER_BACKUP_DIRECTORY)));
// Validate backup is valid.
restartMastersFromBackup(backupUri);
assertTrue(fs.exists(dir1));
mCluster.notifySuccess();
}
Aggregations