use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class PersistenceTestUtils method pauseScheduler.
/**
* A convenience method to pause scheduling persist jobs.
*
* @param resource the local cluster resource to pause the service for
*/
public static void pauseScheduler(LocalAlluxioClusterResource resource) {
FileSystemMaster nestedMaster = getFileSystemMaster(resource);
Map<Long, ExponentialTimer> persistRequests = Whitebox.getInternalState(nestedMaster, "mPersistRequests");
Whitebox.setInternalState(nestedMaster, "mPersistRequests", new BlackHoleMap<>(persistRequests));
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class PersistenceTestUtils method waitForJobComplete.
/**
* A convenience method to block until the persist job is complete and processed for the given
* file ID.
*
* @param resource the local cluster resource to resume the service for
* @param fileId the file ID to persist
*/
public static void waitForJobComplete(LocalAlluxioClusterResource resource, final long fileId) throws Exception {
final FileSystemMaster master = getFileSystemMaster(resource);
CommonUtils.waitFor(String.format("Persisted job complete for fileId %d", fileId), () -> {
FileSystemMaster nestedMaster = master;
Map<Long, ?> jobs = Whitebox.getInternalState(nestedMaster, "mPersistJobs");
return !jobs.containsKey(fileId);
});
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class PersistenceTestUtils method waitForJobScheduled.
/**
* A convenience method to block until the persist job is scheduled for the given file ID.
*
* @param resource the local cluster resource to resume the service for
* @param fileId the file ID to persist
*/
public static void waitForJobScheduled(LocalAlluxioClusterResource resource, final long fileId) throws Exception {
final FileSystemMaster master = getFileSystemMaster(resource);
CommonUtils.waitFor(String.format("Persisted job scheduled for fileId %d", fileId), () -> {
FileSystemMaster nestedMaster = master;
Map<Long, ?> requests = Whitebox.getInternalState(nestedMaster, "mPersistRequests");
return !requests.containsKey(fileId);
});
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class DefaultAlluxioMaster method createMasters.
/**
* @param journalFactory the factory to use for creating journals
*/
protected void createMasters(JournalFactory journalFactory) {
mBlockMaster = new BlockMaster(journalFactory);
mFileSystemMaster = new FileSystemMaster(mBlockMaster, journalFactory);
if (LineageUtils.isLineageEnabled()) {
mLineageMaster = new LineageMaster(mFileSystemMaster, journalFactory);
}
mAdditionalMasters = new ArrayList<>();
List<? extends Master> masters = Lists.newArrayList(mBlockMaster, mFileSystemMaster);
for (MasterFactory factory : ServerUtils.getMasterServiceLoader()) {
Master master = factory.create(masters, journalFactory);
if (master != null) {
mAdditionalMasters.add(master);
}
}
}
use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.
the class JournalIntegrationTest method fileDirectoryTestUtil.
private void fileDirectoryTestUtil() throws Exception {
FileSystemMaster fsMaster = createFsMasterFromJournal();
long rootId = fsMaster.getFileId(mRootUri);
Assert.assertTrue(rootId != IdUtils.INVALID_FILE_ID);
Assert.assertEquals(10, fsMaster.listStatus(mRootUri, ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)).size());
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
Assert.assertTrue(fsMaster.getFileId(new AlluxioURI("/i" + i + "/j" + j)) != IdUtils.INVALID_FILE_ID);
}
}
fsMaster.stop();
}
Aggregations