use of alluxio.client.file.FileSystem in project alluxio by Alluxio.
the class SecondaryMasterTest method secondaryShouldCreateCheckpoints.
@Test
public void secondaryShouldCreateCheckpoints() throws Exception {
FileSystem fs = mClusterResource.get().getClient();
// Create a bunch of directories to trigger a checkpoint.
for (int i = 0; i < 10; i++) {
fs.createDirectory(new AlluxioURI("/dir" + i));
}
IntegrationTestUtils.waitForUfsJournalCheckpoint(Constants.FILE_SYSTEM_MASTER_NAME);
}
use of alluxio.client.file.FileSystem in project alluxio by Alluxio.
the class JournalMigrationIntegrationTest method migration.
@Test
public void migration() throws Exception {
MultiProcessCluster cluster = MultiProcessCluster.newBuilder(PortCoordination.JOURNAL_MIGRATION).setClusterName("journalMigration").setNumMasters(3).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()).addProperty(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT, "1sec").build();
try {
cluster.start();
FileSystem fs = cluster.getFileSystemClient();
MetaMasterClient metaClient = new RetryHandlingMetaMasterClient(MasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).setMasterInquireClient(cluster.getMasterInquireClient()).build());
for (int i = 0; i < NUM_DIRS; i++) {
fs.createDirectory(new AlluxioURI("/dir" + i));
}
File backupsDir = AlluxioTestDirectory.createTemporaryDirectory("backups");
AlluxioURI zkBackup = metaClient.backup(BackupPRequest.newBuilder().setTargetDirectory(backupsDir.getAbsolutePath()).setOptions(BackupPOptions.newBuilder().setLocalFileSystem(false)).build()).getBackupUri();
cluster.updateMasterConf(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP, zkBackup.toString());
// Migrate to embedded journal HA.
cluster.stopMasters();
cluster.formatJournal();
cluster.updateDeployMode(DeployMode.EMBEDDED);
cluster.startMasters();
assertEquals(NUM_DIRS, fs.listStatus(new AlluxioURI("/")).size());
// Migrate back to Zookeeper HA.
cluster.stopMasters();
cluster.formatJournal();
cluster.updateDeployMode(DeployMode.ZOOKEEPER_HA);
cluster.startMasters();
assertEquals(NUM_DIRS, fs.listStatus(new AlluxioURI("/")).size());
cluster.notifySuccess();
} finally {
cluster.destroy();
}
}
use of alluxio.client.file.FileSystem in project alluxio by Alluxio.
the class JournalShutdownIntegrationTest method singleMasterJournalStopIntegration.
@Test
public void singleMasterJournalStopIntegration() throws Exception {
MultiProcessCluster cluster = MultiProcessCluster.newBuilder(PortCoordination.JOURNAL_STOP_SINGLE_MASTER).setClusterName("singleMasterJournalStopIntegration").setNumWorkers(0).setNumMasters(1).build();
try {
cluster.start();
FileSystem fs = cluster.getFileSystemClient();
runCreateFileThread(fs);
cluster.waitForAndKillPrimaryMaster(10 * Constants.SECOND_MS);
awaitClientTermination();
cluster.startMaster(0);
int actualFiles = fs.listStatus(new AlluxioURI(TEST_FILE_DIR)).size();
int successFiles = mCreateFileThread.getSuccessNum();
assertTrue(String.format("successFiles: %s, actualFiles: %s", successFiles, actualFiles), (successFiles == actualFiles) || (successFiles + 1 == actualFiles));
cluster.notifySuccess();
} finally {
cluster.destroy();
}
}
use of alluxio.client.file.FileSystem in project alluxio by Alluxio.
the class MultiMasterJournalTest method triggerAndWaitForCheckpoint.
private void triggerAndWaitForCheckpoint() throws Exception {
FileSystem client = mCluster.getClient();
for (int i = 0; i < 10; i++) {
client.createFile(new AlluxioURI("/triggerCheckpoint" + i)).close();
}
IntegrationTestUtils.waitForUfsJournalCheckpoint(Constants.FILE_SYSTEM_MASTER_NAME);
}
use of alluxio.client.file.FileSystem in project alluxio by Alluxio.
the class MultiMasterJournalTest method testTtl.
@Test
public void testTtl() throws Exception {
// Test that ttls are still applied after restart.
AlluxioURI file = new AlluxioURI("/file");
mCluster.getClient().createFile(file).close();
int ttl = 5 * Constants.SECOND_MS;
mCluster.getClient().setAttribute(file, SetAttributePOptions.newBuilder().setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setTtl(ttl).setTtlAction(TtlAction.DELETE)).build());
triggerAndWaitForCheckpoint();
mCluster.restartMasters();
FileSystem client = mCluster.getClient();
CommonUtils.waitFor("file to be deleted", () -> {
try {
return !client.exists(file);
} catch (Exception e) {
throw new RuntimeException(e);
}
}, WaitForOptions.defaults().setTimeoutMs(30 * Constants.SECOND_MS));
}
Aggregations