use of alluxio.master.file.DefaultFileSystemMaster in project alluxio by Alluxio.
the class BlockMasterIntegrityIntegrationTest method removeFileMetadata.
private void removeFileMetadata(AlluxioURI uri) throws Exception {
FileSystemMaster fsm = mCluster.getLocalAlluxioMaster().getMasterProcess().getMaster(FileSystemMaster.class);
InodeTree tree = Whitebox.getInternalState(fsm, "mInodeTree");
LockedInodePath path = tree.lockInodePath(uri, LockPattern.WRITE_EDGE);
RpcContext rpcContext = ((DefaultFileSystemMaster) fsm).createRpcContext();
((DefaultFileSystemMaster) fsm).deleteInternal(rpcContext, path, DeleteContext.defaults());
path.close();
rpcContext.close();
}
use of alluxio.master.file.DefaultFileSystemMaster 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);
}
Aggregations