@Override public void start() throws Exception { mRegistry.start(false); mLatch.await(); }
/** * Starts all masters, including block master, FileSystem master, and additional masters. * * @param isLeader if the Master is leader */ protected void startMasters(boolean isLeader) { try { if (isLeader) { if (ServerConfiguration.isSet(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP)) { AlluxioURI backup = new AlluxioURI(ServerConfiguration.get(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP)); if (mJournalSystem.isEmpty()) { initFromBackup(backup); } else { LOG.info("The journal system is not freshly formatted, skipping restoring backup from " + backup); } } mSafeModeManager.notifyPrimaryMasterStarted(); } mRegistry.start(isLeader); LOG.info("All masters started"); } catch (IOException e) { throw new RuntimeException(e); } }
private void startServices() throws Exception { 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 FileSystemMasterFactory().create(mRegistry, context); journalSystem.start(); journalSystem.gainPrimacy(); mRegistry.start(true); mMockJobMasterClient = Mockito.mock(JobMasterClient.class); PowerMockito.mockStatic(JobMasterClient.Factory.class); Mockito.when(JobMasterClient.Factory.create(any(JobMasterClientContext.class))) .thenReturn(mMockJobMasterClient); }
@Before public void before() throws Exception { mRegistry = new MasterRegistry(); mClock = new ManualClock(); mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestMetricsMaster-%d", true)); mMetricsMaster = new DefaultMetricsMaster(MasterTestUtils.testMasterContext(), mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService)); mRegistry.add(MetricsMaster.class, mMetricsMaster); mRegistry.start(true); }
mBlockMaster = new BlockMasterFactory().create(mRegistry, masterContext); mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, masterContext); mRegistry.start(true); when(mMasterProcess.getMaster(BlockMaster.class)).thenReturn(mBlockMaster); when(mMasterProcess.getMaster(FileSystemMaster.class)).thenReturn(mFileSystemMaster);
/** * Sets up the dependencies before a test runs. */ @Before public void before() throws Exception { mRegistry = new MasterRegistry(); mSafeModeManager = new TestSafeModeManager(); mStartTimeMs = System.currentTimeMillis(); mPort = ServerConfiguration.getInt(PropertyKey.MASTER_RPC_PORT); mMetrics = Lists.newArrayList(); JournalSystem journalSystem = new NoopJournalSystem(); CoreMasterContext masterContext = MasterTestUtils.testMasterContext(); mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext); mClock = new ManualClock(); mExecutorService = Executors.newFixedThreadPool(2, ThreadFactoryUtils.build("TestBlockMaster-%d", true)); mBlockMaster = new DefaultBlockMaster(mMetricsMaster, masterContext, mClock, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService)); mRegistry.add(BlockMaster.class, mBlockMaster); mRegistry.start(true); }
mJournalSystem.start(); mJournalSystem.gainPrimacy(); mRegistry.start(true);
/** * Sets up all dependencies before a test runs. */ @Before public void before() throws Exception { mRegistry = new MasterRegistry(); CoreMasterContext context = MasterTestUtils.testMasterContext(); mMetricsMaster = new MetricsMasterFactory().create(mRegistry, context); mRegistry.add(MetricsMaster.class, mMetricsMaster); BlockMaster blockMaster = new BlockMasterFactory().create(mRegistry, context); InodeDirectoryIdGenerator directoryIdGenerator = new InodeDirectoryIdGenerator(blockMaster); UfsManager ufsManager = mock(UfsManager.class); MountTable mountTable = new MountTable(ufsManager, mock(MountInfo.class)); InodeLockManager lockManager = new InodeLockManager(); mInodeStore = context.getInodeStoreFactory() .apply(new InodeStoreArgs(lockManager, ServerConfiguration.global())); mTree = new InodeTree(mInodeStore, blockMaster, directoryIdGenerator, mountTable, lockManager); mRegistry.start(true); mTree.initializeRoot(TEST_OWNER, TEST_GROUP, TEST_DIR_MODE, NoopJournalContext.INSTANCE); }
@Before public void before() throws Exception { ServerConfiguration.set(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS, mTestFolder.newFolder()); GroupMappingServiceTestUtils.resetCache(); mRegistry = new MasterRegistry(); mRegistry.add(MetricsMaster.class, mMetricsMaster); CoreMasterContext masterContext = MasterTestUtils.testMasterContext(); mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext); new BlockMasterFactory().create(mRegistry, masterContext); mFileSystemMaster = new FileSystemMasterFactory().create(mRegistry, masterContext); mRegistry.start(true); createDirAndFileForTest(); }
sTree = new InodeTree(sInodeStore, blockMaster, directoryIdGenerator, mountTable, lockManager); sRegistry.start(true);
@Override public void start() throws Exception { mRegistry.start(false); mLatch.await(); }
/** * Starts all masters, including block master, FileSystem master, lineage master and additional * masters. * * @param isLeader if the Master is leader */ protected void startMasters(boolean isLeader) { try { if (isLeader) { if (Configuration.isSet(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP)) { AlluxioURI backup = new AlluxioURI(Configuration.get(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP)); if (mJournalSystem.isEmpty()) { initFromBackup(backup); } else { LOG.info("The journal system is not freshly formatted, skipping restoring backup from " + backup); } } mSafeModeManager.notifyPrimaryMasterStarted(); } mRegistry.start(isLeader); LOG.info("All masters started"); } catch (IOException e) { throw new RuntimeException(e); } }