Search in sources :

Example 1 with TestSafeModeManager

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

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

CoreMasterContext (alluxio.master.CoreMasterContext)2 MasterRegistry (alluxio.master.MasterRegistry)2 TestSafeModeManager (alluxio.master.TestSafeModeManager)2 MasterUfsManager (alluxio.underfs.MasterUfsManager)2 Constants (alluxio.Constants)1 Server (alluxio.Server)1 PropertyKey (alluxio.conf.PropertyKey)1 ServerConfiguration (alluxio.conf.ServerConfiguration)1 BackupManager (alluxio.master.BackupManager)1 MasterUtils (alluxio.master.MasterUtils)1 SafeModeManager (alluxio.master.SafeModeManager)1 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)1 FileSystemMasterFactory (alluxio.master.file.FileSystemMasterFactory)1 JournalSystem (alluxio.master.journal.JournalSystem)1 NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)1 HeapBlockStore (alluxio.master.metastore.heap.HeapBlockStore)1 HeapInodeStore (alluxio.master.metastore.heap.HeapInodeStore)1 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1