Search in sources :

Example 26 with FileSystemMaster

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));
}
Also used : ExponentialTimer(alluxio.time.ExponentialTimer) FileSystemMaster(alluxio.master.file.FileSystemMaster)

Example 27 with FileSystemMaster

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);
    });
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster)

Example 28 with FileSystemMaster

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);
    });
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster)

Example 29 with FileSystemMaster

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);
        }
    }
}
Also used : BlockMaster(alluxio.master.block.BlockMaster) BlockMaster(alluxio.master.block.BlockMaster) FileSystemMaster(alluxio.master.file.FileSystemMaster) LineageMaster(alluxio.master.lineage.LineageMaster) LineageMaster(alluxio.master.lineage.LineageMaster) FileSystemMaster(alluxio.master.file.FileSystemMaster)

Example 30 with FileSystemMaster

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();
}
Also used : FileSystemMaster(alluxio.master.file.FileSystemMaster) AlluxioURI(alluxio.AlluxioURI)

Aggregations

FileSystemMaster (alluxio.master.file.FileSystemMaster)61 AlluxioURI (alluxio.AlluxioURI)43 Test (org.junit.Test)27 FsMasterResource (alluxio.testutils.master.FsMasterResource)22 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)16 FileInfo (alluxio.wire.FileInfo)13 URIStatus (alluxio.client.file.URIStatus)10 OperationId (alluxio.wire.OperationId)5 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)4 UnderFileSystemSpy (alluxio.UnderFileSystemSpy)3 BlockMaster (alluxio.master.block.BlockMaster)3 MountPointInfo (alluxio.wire.MountPointInfo)3 FileSystem (alluxio.client.file.FileSystem)2 AccessControlException (alluxio.exception.AccessControlException)2 DefaultFileSystemMaster (alluxio.master.file.DefaultFileSystemMaster)2 PersistJob (alluxio.master.file.PersistJob)2 DeleteContext (alluxio.master.file.contexts.DeleteContext)2 JournalFactory (alluxio.master.journal.JournalFactory)2 Mode (alluxio.security.authorization.Mode)2 ExponentialTimer (alluxio.time.ExponentialTimer)2