Search in sources :

Example 6 with CoreMasterContext

use of alluxio.master.CoreMasterContext in project alluxio by Alluxio.

the class JournalSinkTest method startMasters.

private void startMasters(MasterRegistry registry, JournalSystem journalSystem, JournalSink sink, boolean leader) throws Exception {
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext(journalSystem);
    new MetricsMasterFactory().create(registry, masterContext);
    new BlockMasterFactory().create(registry, masterContext);
    new FileSystemMasterFactory().create(registry, masterContext);
    if (sink != null) {
        // add journal sink
        journalSystem.addJournalSink(registry.get(FileSystemMaster.class), sink);
    }
    journalSystem.start();
    if (leader) {
        journalSystem.gainPrimacy();
    }
    registry.start(leader);
}
Also used : BlockMasterFactory(alluxio.master.block.BlockMasterFactory) CoreMasterContext(alluxio.master.CoreMasterContext) FileSystemMasterFactory(alluxio.master.file.FileSystemMasterFactory) FileSystemMaster(alluxio.master.file.FileSystemMaster) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory)

Example 7 with CoreMasterContext

use of alluxio.master.CoreMasterContext in project alluxio by Alluxio.

the class AlluxioMasterRestServiceHandlerTest method before.

@Before
public void before() throws Exception {
    mMasterProcess = mock(AlluxioMasterProcess.class);
    ServletContext context = mock(ServletContext.class);
    mRegistry = new MasterRegistry();
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext();
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    mRegistry.add(MetricsMaster.class, mMetricsMaster);
    registerMockUfs();
    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);
    when(context.getAttribute(MasterWebServer.ALLUXIO_MASTER_SERVLET_RESOURCE_KEY)).thenReturn(mMasterProcess);
    mHandler = new AlluxioMasterRestServiceHandler(context);
    // Register two workers
    long worker1 = mBlockMaster.getWorkerId(NET_ADDRESS_1);
    long worker2 = mBlockMaster.getWorkerId(NET_ADDRESS_2);
    List<String> tiers = Arrays.asList(Constants.MEDIUM_MEM, Constants.MEDIUM_SSD);
    mBlockMaster.workerRegister(worker1, tiers, WORKER1_TOTAL_BYTES_ON_TIERS, WORKER1_USED_BYTES_ON_TIERS, NO_BLOCKS_ON_LOCATIONS, NO_LOST_STORAGE, RegisterWorkerPOptions.getDefaultInstance());
    mBlockMaster.workerRegister(worker2, tiers, WORKER2_TOTAL_BYTES_ON_TIERS, WORKER2_USED_BYTES_ON_TIERS, NO_BLOCKS_ON_LOCATIONS, NO_LOST_STORAGE, RegisterWorkerPOptions.getDefaultInstance());
    String filesPinnedProperty = MetricKey.MASTER_FILES_PINNED.getName();
    MetricsSystem.METRIC_REGISTRY.remove(filesPinnedProperty);
}
Also used : BlockMasterFactory(alluxio.master.block.BlockMasterFactory) AlluxioMasterProcess(alluxio.master.AlluxioMasterProcess) CoreMasterContext(alluxio.master.CoreMasterContext) FileSystemMasterFactory(alluxio.master.file.FileSystemMasterFactory) ServletContext(javax.servlet.ServletContext) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) MasterRegistry(alluxio.master.MasterRegistry) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory) Before(org.junit.Before)

Example 8 with CoreMasterContext

use of alluxio.master.CoreMasterContext in project alluxio by Alluxio.

the class FileSystemMasterTest method startServices.

private void startServices() throws Exception {
    mRegistry = new MasterRegistry();
    mJournalSystem = JournalTestUtils.createJournalSystem(mJournalFolder);
    CoreMasterContext masterContext = MasterTestUtils.testMasterContext(mJournalSystem, new TestUserState(TEST_USER, ServerConfiguration.global()));
    mMetricsMaster = new MetricsMasterFactory().create(mRegistry, masterContext);
    mRegistry.add(MetricsMaster.class, mMetricsMaster);
    mMetrics = Lists.newArrayList();
    mBlockMaster = new BlockMasterFactory().create(mRegistry, masterContext);
    mExecutorService = Executors.newFixedThreadPool(4, ThreadFactoryUtils.build("DefaultFileSystemMasterTest-%d", true));
    mFileSystemMaster = new DefaultFileSystemMaster(mBlockMaster, masterContext, ExecutorServiceFactories.constantExecutorServiceFactory(mExecutorService));
    mInodeStore = mFileSystemMaster.getInodeStore();
    mInodeTree = mFileSystemMaster.getInodeTree();
    mRegistry.add(FileSystemMaster.class, mFileSystemMaster);
    mJournalSystem.start();
    mJournalSystem.gainPrimacy();
    mRegistry.start(true);
    // set up workers
    mWorkerId1 = mBlockMaster.getWorkerId(new WorkerNetAddress().setHost("localhost").setRpcPort(80).setDataPort(81).setWebPort(82));
    mBlockMaster.workerRegister(mWorkerId1, Arrays.asList(Constants.MEDIUM_MEM, Constants.MEDIUM_SSD), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.MB, Constants.MEDIUM_SSD, (long) Constants.MB), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.KB, Constants.MEDIUM_SSD, (long) Constants.KB), ImmutableMap.of(), new HashMap<String, StorageList>(), RegisterWorkerPOptions.getDefaultInstance());
    mWorkerId2 = mBlockMaster.getWorkerId(new WorkerNetAddress().setHost("remote").setRpcPort(80).setDataPort(81).setWebPort(82));
    mBlockMaster.workerRegister(mWorkerId2, Arrays.asList(Constants.MEDIUM_MEM, Constants.MEDIUM_SSD), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.MB, Constants.MEDIUM_SSD, (long) Constants.MB), ImmutableMap.of(Constants.MEDIUM_MEM, (long) Constants.KB, Constants.MEDIUM_SSD, (long) Constants.KB), ImmutableMap.of(), new HashMap<String, StorageList>(), RegisterWorkerPOptions.getDefaultInstance());
}
Also used : BlockMasterFactory(alluxio.master.block.BlockMasterFactory) CoreMasterContext(alluxio.master.CoreMasterContext) WorkerNetAddress(alluxio.wire.WorkerNetAddress) TestUserState(alluxio.security.user.TestUserState) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) StorageList(alluxio.grpc.StorageList) MasterRegistry(alluxio.master.MasterRegistry) MetricsMasterFactory(alluxio.master.metrics.MetricsMasterFactory)

Example 9 with CoreMasterContext

use of alluxio.master.CoreMasterContext in project alluxio by Alluxio.

the class TransformManagerTest method before.

@Before
public void before() throws Exception {
    ServerConfiguration.set(PropertyKey.MASTER_HOSTNAME, "localhost");
    ServerConfiguration.set(PropertyKey.MASTER_RPC_PORT, PortRegistry.getFreePort());
    ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_TYPE, "UFS");
    ServerConfiguration.set(PropertyKey.TABLE_TRANSFORM_MANAGER_JOB_HISTORY_RETENTION_TIME, "1h");
    mJournalSystem = JournalTestUtils.createJournalSystem(mTemporaryFolder);
    mJournalSystem.format();
    CoreMasterContext context = MasterTestUtils.testMasterContext(mJournalSystem);
    mMockJobMasterClient = Mockito.mock(JobMasterClient.class);
    mTableMaster = new DefaultTableMaster(context, mMockJobMasterClient);
    start();
    TestDatabase.genTable(NUM_TABLES, NUM_PARTITIONS, false);
    mTableMaster.attachDatabase(TestUdbFactory.TYPE, "connect", DB, DB, Collections.emptyMap(), false);
}
Also used : JobMasterClient(alluxio.client.job.JobMasterClient) CoreMasterContext(alluxio.master.CoreMasterContext) DefaultTableMaster(alluxio.master.table.DefaultTableMaster) Before(org.junit.Before)

Example 10 with CoreMasterContext

use of alluxio.master.CoreMasterContext 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)

Aggregations

CoreMasterContext (alluxio.master.CoreMasterContext)12 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)11 MasterRegistry (alluxio.master.MasterRegistry)10 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)9 Before (org.junit.Before)5 JournalSystem (alluxio.master.journal.JournalSystem)4 FileSystemMasterFactory (alluxio.master.file.FileSystemMasterFactory)3 JobMasterClient (alluxio.client.job.JobMasterClient)2 ManualClock (alluxio.clock.ManualClock)2 BlockMaster (alluxio.master.block.BlockMaster)2 MountInfo (alluxio.master.file.meta.options.MountInfo)2 NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)2 TestUserState (alluxio.security.user.TestUserState)2 UfsManager (alluxio.underfs.UfsManager)2 StorageList (alluxio.grpc.StorageList)1 AlluxioMasterProcess (alluxio.master.AlluxioMasterProcess)1 SafeModeManager (alluxio.master.SafeModeManager)1 TestSafeModeManager (alluxio.master.TestSafeModeManager)1 FileSystemMaster (alluxio.master.file.FileSystemMaster)1 InodeDirectoryIdGenerator (alluxio.master.file.meta.InodeDirectoryIdGenerator)1