Search in sources :

Example 1 with NoopUfsManager

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

the class Format method format.

/**
 * Formats the Alluxio file system.
 *
 * @param mode either {@code MASTER} or {@code WORKER}
 * @param alluxioConf Alluxio configuration
 */
public static void format(Mode mode, AlluxioConfiguration alluxioConf) throws IOException {
    NoopUfsManager noopUfsManager = new NoopUfsManager();
    switch(mode) {
        case MASTER:
            URI journalLocation = JournalUtils.getJournalLocation();
            LOG.info("Formatting master journal: {}", journalLocation);
            JournalSystem journalSystem = new JournalSystem.Builder().setLocation(journalLocation).build(CommonUtils.ProcessType.MASTER);
            for (String masterServiceName : ServiceUtils.getMasterServiceNames()) {
                journalSystem.createJournal(new NoopMaster(masterServiceName, noopUfsManager));
            }
            journalSystem.format();
            break;
        case WORKER:
            String workerDataFolder = ServerConfiguration.getString(PropertyKey.WORKER_DATA_FOLDER);
            LOG.info("Formatting worker data folder: {}", workerDataFolder);
            int storageLevels = ServerConfiguration.getInt(PropertyKey.WORKER_TIERED_STORE_LEVELS);
            for (int level = 0; level < storageLevels; level++) {
                PropertyKey tierLevelDirPath = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(level);
                String[] dirPaths = ServerConfiguration.getString(tierLevelDirPath).split(",");
                String name = "Data path for tier " + level;
                for (String dirPath : dirPaths) {
                    String dirWorkerDataFolder = CommonUtils.getWorkerDataDirectory(dirPath, alluxioConf);
                    LOG.info("Formatting {}:{}", name, dirWorkerDataFolder);
                    formatWorkerDataFolder(dirWorkerDataFolder);
                }
            }
            break;
        default:
            throw new RuntimeException(String.format("Unrecognized format mode: %s", mode));
    }
}
Also used : NoopUfsManager(alluxio.master.NoopUfsManager) JournalSystem(alluxio.master.journal.JournalSystem) URI(java.net.URI) PropertyKey(alluxio.conf.PropertyKey) NoopMaster(alluxio.master.NoopMaster)

Example 2 with NoopUfsManager

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

the class JobMasterTest method before.

@Before
public void before() throws Exception {
    // Can't use ConfigurationRule due to conflicts with PowerMock.
    ServerConfiguration.set(PropertyKey.JOB_MASTER_JOB_CAPACITY, TEST_JOB_MASTER_JOB_CAPACITY);
    mJobMaster = new JobMaster(new MasterContext<>(new NoopJournalSystem(), new NoopUfsManager()), mock(FileSystem.class), mock(FileSystemContext.class), mock(UfsManager.class));
    mJobMaster.start(true);
}
Also used : NoopUfsManager(alluxio.master.NoopUfsManager) MasterContext(alluxio.master.MasterContext) NoopJournalSystem(alluxio.master.journal.noop.NoopJournalSystem) Before(org.junit.Before)

Aggregations

NoopUfsManager (alluxio.master.NoopUfsManager)2 PropertyKey (alluxio.conf.PropertyKey)1 MasterContext (alluxio.master.MasterContext)1 NoopMaster (alluxio.master.NoopMaster)1 JournalSystem (alluxio.master.journal.JournalSystem)1 NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)1 URI (java.net.URI)1 Before (org.junit.Before)1