Search in sources :

Example 6 with JournalSystem

use of alluxio.master.journal.JournalSystem in project alluxio by Alluxio.

the class FileSystemMasterSyncMetadataTest method startServices.

private void startServices() throws Exception {
    mExecutorService = Executors.newFixedThreadPool(4, ThreadFactoryUtils.build("DefaultFileSystemMasterTest-%d", true));
    mRegistry = new MasterRegistry();
    JournalSystem journalSystem = JournalTestUtils.createJournalSystem(mJournalFolder.getAbsolutePath());
    CoreMasterContext context = MasterTestUtils.testMasterContext(journalSystem);
    new MetricsMasterFactory().create(mRegistry, context);
    new BlockMasterFactory().create(mRegistry, context);
    mFileSystemMaster = new SyncAwareFileSystemMasterFactory().create(mRegistry, context);
    journalSystem.start();
    journalSystem.gainPrimacy();
    mRegistry.start(true);
    mUfs = Mockito.mock(UnderFileSystem.class);
    PowerMockito.mockStatic(UnderFileSystem.Factory.class);
    Mockito.when(UnderFileSystem.Factory.create(anyString(), any())).thenReturn(mUfs);
}
Also used : BlockMasterFactory(alluxio.master.block.BlockMasterFactory) CoreMasterContext(alluxio.master.CoreMasterContext) JournalSystem(alluxio.master.journal.JournalSystem) MasterRegistry(alluxio.master.MasterRegistry) UnderFileSystem(alluxio.underfs.UnderFileSystem) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory)

Example 7 with JournalSystem

use of alluxio.master.journal.JournalSystem in project alluxio by Alluxio.

the class MasterTestUtils method createFileSystemMasterFromJournal.

/**
 * Creates a new {@link FileSystemMaster} from journal along with its dependencies, and returns
 * the master registry and the journal system.
 *
 * @param isLeader whether to start as a leader
 * @param userState the user state for the server. if null, will use ServerUserState.global()
 * @param journalFolder the folder of the master journal
 * @return a resource that contains the master registry and the journal system
 */
private static FsMasterResource createFileSystemMasterFromJournal(boolean isLeader, UserState userState, String journalFolder) throws Exception {
    String masterJournal = journalFolder;
    MasterRegistry registry = new MasterRegistry();
    SafeModeManager safeModeManager = new TestSafeModeManager();
    long startTimeMs = System.currentTimeMillis();
    int port = ServerConfiguration.getInt(PropertyKey.MASTER_RPC_PORT);
    String baseDir = ServerConfiguration.getString(PropertyKey.MASTER_METASTORE_DIR);
    JournalSystem journalSystem = JournalTestUtils.createJournalSystem(masterJournal);
    if (userState == null) {
        userState = ServerUserState.global();
    }
    CoreMasterContext masterContext = CoreMasterContext.newBuilder().setJournalSystem(journalSystem).setSafeModeManager(safeModeManager).setBackupManager(mock(BackupManager.class)).setBlockStoreFactory(MasterUtils.getBlockStoreFactory(baseDir)).setInodeStoreFactory(MasterUtils.getInodeStoreFactory(baseDir)).setStartTimeMs(startTimeMs).setUserState(userState).setPort(port).setUfsManager(new MasterUfsManager()).build();
    new MetricsMasterFactory().create(registry, masterContext);
    new BlockMasterFactory().create(registry, masterContext);
    new FileSystemMasterFactory().create(registry, masterContext);
    journalSystem.start();
    if (isLeader) {
        journalSystem.gainPrimacy();
    }
    registry.start(isLeader);
    return new FsMasterResource(registry, journalSystem);
}
Also used : TestSafeModeManager(alluxio.master.TestSafeModeManager) BlockMasterFactory(alluxio.master.block.BlockMasterFactory) MasterRegistry(alluxio.master.MasterRegistry) MasterUfsManager(alluxio.underfs.MasterUfsManager) SafeModeManager(alluxio.master.SafeModeManager) TestSafeModeManager(alluxio.master.TestSafeModeManager) CoreMasterContext(alluxio.master.CoreMasterContext) FileSystemMasterFactory(alluxio.master.file.FileSystemMasterFactory) JournalSystem(alluxio.master.journal.JournalSystem) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory)

Aggregations

JournalSystem (alluxio.master.journal.JournalSystem)7 MasterRegistry (alluxio.master.MasterRegistry)6 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)6 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)5 CoreMasterContext (alluxio.master.CoreMasterContext)4 Before (org.junit.Before)3 InodeDirectoryIdGenerator (alluxio.master.file.meta.InodeDirectoryIdGenerator)2 InodeLockManager (alluxio.master.file.meta.InodeLockManager)2 InodeTree (alluxio.master.file.meta.InodeTree)2 MountTable (alluxio.master.file.meta.MountTable)2 MountInfo (alluxio.master.file.meta.options.MountInfo)2 UfsManager (alluxio.underfs.UfsManager)2 JobMasterClient (alluxio.client.job.JobMasterClient)1 ManualClock (alluxio.clock.ManualClock)1 PropertyKey (alluxio.conf.PropertyKey)1 NoopMaster (alluxio.master.NoopMaster)1 NoopUfsManager (alluxio.master.NoopUfsManager)1 SafeModeManager (alluxio.master.SafeModeManager)1 TestSafeModeManager (alluxio.master.TestSafeModeManager)1 FileSystemMasterFactory (alluxio.master.file.FileSystemMasterFactory)1