Search in sources :

Example 1 with HeapBlockStore

use of alluxio.master.metastore.heap.HeapBlockStore in project alluxio by Alluxio.

the class TableMasterFactoryTest method before.

@Before
public void before() {
    mContext = CoreMasterContext.newBuilder().setJournalSystem(new NoopJournalSystem()).setSafeModeManager(new TestSafeModeManager()).setBackupManager(mock(BackupManager.class)).setBlockStoreFactory(HeapBlockStore::new).setInodeStoreFactory(x -> new HeapInodeStore()).setUfsManager(new MasterUfsManager()).build();
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_FOLDER, sTemp.getRoot().getAbsolutePath());
}
Also used : ServerConfiguration(alluxio.conf.ServerConfiguration) MasterUfsManager(alluxio.underfs.MasterUfsManager) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) Assert.assertTrue(org.junit.Assert.assertTrue) Server(alluxio.Server) Set(java.util.Set) Test(org.junit.Test) BackupManager(alluxio.master.BackupManager) HeapBlockStore(alluxio.master.metastore.heap.HeapBlockStore) PropertyKey(alluxio.conf.PropertyKey) Collectors(java.util.stream.Collectors) HeapInodeStore(alluxio.master.metastore.heap.HeapInodeStore) Constants(alluxio.Constants) Assert.assertFalse(org.junit.Assert.assertFalse) TestSafeModeManager(alluxio.master.TestSafeModeManager) After(org.junit.After) CoreMasterContext(alluxio.master.CoreMasterContext) MasterRegistry(alluxio.master.MasterRegistry) ClassRule(org.junit.ClassRule) MasterUtils(alluxio.master.MasterUtils) TemporaryFolder(org.junit.rules.TemporaryFolder) Mockito.mock(org.mockito.Mockito.mock) Before(org.junit.Before) TestSafeModeManager(alluxio.master.TestSafeModeManager) HeapBlockStore(alluxio.master.metastore.heap.HeapBlockStore) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) MasterUfsManager(alluxio.underfs.MasterUfsManager) HeapInodeStore(alluxio.master.metastore.heap.HeapInodeStore) Before(org.junit.Before)

Example 2 with HeapBlockStore

use of alluxio.master.metastore.heap.HeapBlockStore 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)

Aggregations

NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)2 HeapBlockStore (alluxio.master.metastore.heap.HeapBlockStore)2 Test (org.junit.Test)2 Constants (alluxio.Constants)1 Server (alluxio.Server)1 PropertyKey (alluxio.conf.PropertyKey)1 ServerConfiguration (alluxio.conf.ServerConfiguration)1 BackupManager (alluxio.master.BackupManager)1 CoreMasterContext (alluxio.master.CoreMasterContext)1 MasterRegistry (alluxio.master.MasterRegistry)1 MasterUtils (alluxio.master.MasterUtils)1 TestSafeModeManager (alluxio.master.TestSafeModeManager)1 DefaultBlockMaster (alluxio.master.block.DefaultBlockMaster)1 DefaultFileSystemMaster (alluxio.master.file.DefaultFileSystemMaster)1 FileSystemMaster (alluxio.master.file.FileSystemMaster)1 InodeDirectory (alluxio.master.file.meta.InodeDirectory)1 InodeView (alluxio.master.file.meta.InodeView)1 MutableInodeDirectory (alluxio.master.file.meta.MutableInodeDirectory)1 MutableInodeFile (alluxio.master.file.meta.MutableInodeFile)1 HeapInodeStore (alluxio.master.metastore.heap.HeapInodeStore)1