Search in sources :

Example 46 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.

the class MultiUfsMountIntegrationTest method mountAfterMasterRestart.

@Test
public void mountAfterMasterRestart() throws Exception {
    mLocalAlluxioCluster.stopFS();
    try (FsMasterResource masterResource = MasterTestUtils.createLeaderFileSystemMasterFromJournal()) {
        FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
        Map<String, MountPointInfo> mountTable = fsMaster.getMountPointInfoSummary();
        Assert.assertTrue(mountTable.containsKey(MOUNT_POINT1));
        Assert.assertTrue(mountTable.containsKey(MOUNT_POINT2));
        MountPointInfo mountPointInfo1 = mountTable.get(MOUNT_POINT1);
        MountPointInfo mountPointInfo2 = mountTable.get(MOUNT_POINT2);
        Assert.assertEquals(mUfsUri1, mountPointInfo1.getUfsUri());
        Assert.assertEquals(mUfsUri2, mountPointInfo2.getUfsUri());
        Assert.assertEquals(UFS_CONF1, mountPointInfo1.getProperties());
        Assert.assertEquals(UFS_CONF2, mountPointInfo2.getProperties());
    }
}
Also used : MountPointInfo(alluxio.wire.MountPointInfo) FileSystemMaster(alluxio.master.file.FileSystemMaster) FsMasterResource(alluxio.testutils.master.FsMasterResource) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 47 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.

the class BackupManagerTest method rocksInodeStoreIteratorNotUsed.

@Test
public void rocksInodeStoreIteratorNotUsed() throws Exception {
    // Prepare some data for the iterator
    List<InodeView> inodes = new ArrayList<>();
    inodes.add(createRootDir(99L));
    inodes.add(createNewFile(100L));
    inodes.add(createNewFile(101L));
    inodes.add(createNewFile(102L));
    // When RocksInodeStore.iterator(), return mock iterator
    RocksInodeStore mockInodeStore = mock(RocksInodeStore.class);
    // Make sure the iterator is not used in the backup operation
    when(mockInodeStore.getCloseableIterator()).thenThrow(new UnsupportedOperationException());
    // When the root inode is asked for, return the directory
    InodeView dir = inodes.get(0);
    when(mockInodeStore.get(eq(0L))).thenReturn(Optional.of(new InodeDirectory((InodeDirectoryView) dir)));
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext(new NoopJournalSystem(), null, () -> new HeapBlockStore(), x -> mockInodeStore);
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    mBlockMaster = new DefaultBlockMaster(mMetricsMaster, masterContext, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
    mRegistry.add(BlockMaster.class, mBlockMaster);
    // Prepare the FileSystemMaster for the backup operation
    FileSystemMaster fsMaster = new DefaultFileSystemMaster(mBlockMaster, masterContext, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
    mRegistry.add(FileSystemMaster.class, fsMaster);
    mRegistry.start(true);
    // Finish backup operation
    BackupManager manager = new BackupManager(mRegistry);
    File backupDir = AlluxioTestDirectory.createTemporaryDirectory("backup-dir");
    File backupFile = new File(backupDir, "1.backup");
    AtomicLong counter = new AtomicLong(0L);
    // No exception means the RocksInodeStore iterator is not used
    manager.backup(new FileOutputStream(backupFile), counter);
}
Also used : RocksInodeStore(alluxio.master.metastore.rocks.RocksInodeStore) InodeView(alluxio.master.file.meta.InodeView) DefaultBlockMaster(alluxio.master.block.DefaultBlockMaster) ArrayList(java.util.ArrayList) HeapBlockStore(alluxio.master.metastore.heap.HeapBlockStore) DefaultFileSystemMaster(alluxio.master.file.DefaultFileSystemMaster) FileSystemMaster(alluxio.master.file.FileSystemMaster) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MutableInodeDirectory(alluxio.master.file.meta.MutableInodeDirectory) InodeDirectory(alluxio.master.file.meta.InodeDirectory) AtomicLong(java.util.concurrent.atomic.AtomicLong) DefaultFileSystemMaster(alluxio.master.file.DefaultFileSystemMaster) FileOutputStream(java.io.FileOutputStream) File(java.io.File) MutableInodeFile(alluxio.master.file.meta.MutableInodeFile) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Test(org.junit.Test)

Example 48 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.

the class PersistenceTestUtils method resumeChecker.

/**
 * A convenience method to resume polling persist jobs.
 *
 * @param resource the local cluster resource to resume the service for
 */
public static void resumeChecker(LocalAlluxioClusterResource resource) {
    FileSystemMaster nestedMaster = getFileSystemMaster(resource);
    BlackHoleMap<Long, PersistJob> persistJobs = Whitebox.getInternalState(nestedMaster, "mPersistJobs");
    Whitebox.setInternalState(nestedMaster, "mPersistJobs", persistJobs.getInnerMap());
}
Also used : PersistJob(alluxio.master.file.PersistJob) FileSystemMaster(alluxio.master.file.FileSystemMaster)

Example 49 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.

the class PersistenceTestUtils method resumeScheduler.

/**
 * A convenience method to resume scheduling persist jobs.
 *
 * @param resource the local cluster resource to resume the service for
 */
public static void resumeScheduler(LocalAlluxioClusterResource resource) {
    FileSystemMaster nestedMaster = getFileSystemMaster(resource);
    BlackHoleMap<Long, ExponentialTimer> persistRequests = Whitebox.getInternalState(nestedMaster, "mPersistRequests");
    Whitebox.setInternalState(nestedMaster, "mPersistRequests", persistRequests.getInnerMap());
}
Also used : ExponentialTimer(alluxio.time.ExponentialTimer) FileSystemMaster(alluxio.master.file.FileSystemMaster)

Example 50 with FileSystemMaster

use of alluxio.master.file.FileSystemMaster in project alluxio by Alluxio.

the class PersistenceTestUtils method pauseChecker.

/**
 * A convenience method to pause polling persist jobs.
 *
 * @param resource the local cluster resource to pause the service for
 */
public static void pauseChecker(LocalAlluxioClusterResource resource) {
    FileSystemMaster nestedMaster = getFileSystemMaster(resource);
    Map<Long, PersistJob> persistJobs = Whitebox.getInternalState(nestedMaster, "mPersistJobs");
    Whitebox.setInternalState(nestedMaster, "mPersistJobs", new BlackHoleMap<>(persistJobs));
}
Also used : PersistJob(alluxio.master.file.PersistJob) FileSystemMaster(alluxio.master.file.FileSystemMaster)

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