Search in sources :

Example 1 with SuppressFBWarnings

use of alluxio.annotation.SuppressFBWarnings in project alluxio by Alluxio.

the class JournalTool method dumpJournal.

@SuppressFBWarnings(value = "DB_DUPLICATE_SWITCH_CLAUSES")
private static void dumpJournal() throws Throwable {
    JournalType journalType = ServerConfiguration.getEnum(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.class);
    AbstractJournalDumper journalDumper;
    switch(journalType) {
        case UFS:
            journalDumper = new UfsJournalDumper(sMaster, sStart, sEnd, sOutputDir, sInputDir);
            break;
        case EMBEDDED:
            journalDumper = new RaftJournalDumper(sMaster, sStart, sEnd, sOutputDir, sInputDir);
            break;
        default:
            System.err.println(String.format("Unsupported journal type: %s", journalType.name()));
            return;
    }
    System.out.println(String.format("Dumping journal of type %s to %s", journalType.name(), sOutputDir));
    journalDumper.dumpJournal();
}
Also used : JournalType(alluxio.master.journal.JournalType) SuppressFBWarnings(alluxio.annotation.SuppressFBWarnings)

Example 2 with SuppressFBWarnings

use of alluxio.annotation.SuppressFBWarnings in project alluxio by Alluxio.

the class StressClientIOBench method runForThreadCount.

@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
private ClientIOTaskResult.ThreadCountResult runForThreadCount(int numThreads) throws Exception {
    LOG.info("Running benchmark for thread count: " + numThreads);
    ExecutorService service = ExecutorServiceFactories.fixedThreadPool("bench-thread", numThreads).create();
    long durationMs = FormatUtils.parseTimeSize(mParameters.mDuration);
    long warmupMs = FormatUtils.parseTimeSize(mParameters.mWarmup);
    long startMs = mBaseParameters.mStartMs;
    if (startMs == BaseParameters.UNDEFINED_START_MS || mStartBarrierPassed) {
        // if the barrier was already passed, then overwrite the start time
        startMs = CommonUtils.getCurrentMs() + 10000;
    }
    long endMs = startMs + warmupMs + durationMs;
    BenchContext context = new BenchContext(startMs, endMs);
    List<Callable<Void>> callables = new ArrayList<>(numThreads);
    for (int i = 0; i < numThreads; i++) {
        callables.add(getBenchThread(context, i));
    }
    service.invokeAll(callables, FormatUtils.parseTimeSize(mBaseParameters.mBenchTimeout), TimeUnit.MILLISECONDS);
    service.shutdownNow();
    service.awaitTermination(30, TimeUnit.SECONDS);
    ClientIOTaskResult.ThreadCountResult result = context.getResult();
    LOG.info(String.format("thread count: %d, errors: %d, IO throughput (MB/s): %f", numThreads, result.getErrors().size(), result.getIOMBps()));
    return result;
}
Also used : ExecutorService(java.util.concurrent.ExecutorService) ArrayList(java.util.ArrayList) ClientIOTaskResult(alluxio.stress.client.ClientIOTaskResult) Callable(java.util.concurrent.Callable) SuppressFBWarnings(alluxio.annotation.SuppressFBWarnings)

Example 3 with SuppressFBWarnings

use of alluxio.annotation.SuppressFBWarnings in project alluxio by Alluxio.

the class Mount method apply.

@Override
@SuppressFBWarnings(value = "DMI_HARDCODED_ABSOLUTE_FILENAME", justification = "Findbugs doesn't like the use of an absolute path. However, we need one " + "here so that generated journals are portable across machines")
public void apply(FileSystem fs) throws Exception {
    new File(LOCAL_FS_MOUNT_DIR).mkdirs();
    fs.mount(ALLUXIO_MOUNT_PATH, UFS_MOUNT_PATH);
    new File(LOCAL_FS_UNMOUNT_DIR).mkdirs();
    fs.mount(ALLUXIO_UNMOUNT_PATH, UFS_UNMOUNT_PATH);
    fs.unmount(ALLUXIO_UNMOUNT_PATH);
}
Also used : File(java.io.File) SuppressFBWarnings(alluxio.annotation.SuppressFBWarnings)

Example 4 with SuppressFBWarnings

use of alluxio.annotation.SuppressFBWarnings in project alluxio by Alluxio.

the class StressWorkerBench method prepare.

@Override
@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public void prepare() throws Exception {
    mFilePath = new Path(mParameters.mBasePath, "data");
    // Read and write to one worker
    ClientIOWritePolicy.setMaxWorkers(1);
    if (!mBaseParameters.mDistributed) {
        // set hdfs conf for preparation client
        Configuration hdfsConf = new Configuration();
        // force delete, create dirs through to UFS
        hdfsConf.set(PropertyKey.Name.USER_FILE_DELETE_UNCHECKED, "true");
        hdfsConf.set(PropertyKey.Name.USER_FILE_WRITE_TYPE_DEFAULT, "CACHE_THROUGH");
        hdfsConf.set(PropertyKey.Name.USER_BLOCK_WRITE_LOCATION_POLICY, ClientIOWritePolicy.class.getName());
        hdfsConf.set(PropertyKey.Name.USER_UFS_BLOCK_READ_LOCATION_POLICY, ClientIOWritePolicy.class.getName());
        FileSystem prepareFs = FileSystem.get(new URI(mParameters.mBasePath), hdfsConf);
        // initialize the base, for only the non-distributed task (the cluster launching task)
        Path path = new Path(mParameters.mBasePath);
        prepareFs.delete(path, true);
        prepareFs.mkdirs(path);
        int fileSize = (int) FormatUtils.parseSpaceSize(mParameters.mFileSize);
        byte[] buffer = new byte[(int) FormatUtils.parseSpaceSize(mParameters.mBufferSize)];
        Arrays.fill(buffer, (byte) 'A');
        try (FSDataOutputStream mOutStream = prepareFs.create(mFilePath, false, buffer.length, (short) 1, FormatUtils.parseSpaceSize(mParameters.mBlockSize))) {
            while (true) {
                int bytesToWrite = (int) Math.min(fileSize - mOutStream.getPos(), buffer.length);
                if (bytesToWrite == 0) {
                    break;
                }
                mOutStream.write(buffer, 0, bytesToWrite);
            }
        }
        if (mParameters.mFree && Constants.SCHEME.equals(mFilePath.toUri().getScheme())) {
            // free the alluxio file
            alluxio.client.file.FileSystem.Factory.get().free(new AlluxioURI(mFilePath.toString()));
            LOG.info("Freed file before reading: " + mFilePath);
        }
    }
    // set hdfs conf for all test clients
    Configuration hdfsConf = new Configuration();
    // do not cache these clients
    hdfsConf.set(String.format("fs.%s.impl.disable.cache", (new URI(mParameters.mBasePath)).getScheme()), "true");
    hdfsConf.set(PropertyKey.Name.USER_BLOCK_WRITE_LOCATION_POLICY, ClientIOWritePolicy.class.getName());
    hdfsConf.set(PropertyKey.Name.USER_UFS_BLOCK_READ_LOCATION_POLICY, ClientIOWritePolicy.class.getName());
    for (Map.Entry<String, String> entry : mParameters.mConf.entrySet()) {
        hdfsConf.set(entry.getKey(), entry.getValue());
    }
    mCachedFs = new FileSystem[mParameters.mClients];
    for (int i = 0; i < mCachedFs.length; i++) {
        mCachedFs[i] = FileSystem.get(new URI(mParameters.mBasePath), hdfsConf);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) ClientIOWritePolicy(alluxio.stress.cli.client.ClientIOWritePolicy) Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) AlluxioURI(alluxio.AlluxioURI) URI(java.net.URI) Map(java.util.Map) AlluxioURI(alluxio.AlluxioURI) SuppressFBWarnings(alluxio.annotation.SuppressFBWarnings)

Example 5 with SuppressFBWarnings

use of alluxio.annotation.SuppressFBWarnings in project alluxio by Alluxio.

the class StressMasterBench method runLocal.

@Override
@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public MasterBenchTaskResult runLocal() throws Exception {
    ExecutorService service = ExecutorServiceFactories.fixedThreadPool("bench-thread", mParameters.mThreads).create();
    RateLimiter rateLimiter = RateLimiter.create(mParameters.mTargetThroughput);
    long fileSize = FormatUtils.parseSpaceSize(mParameters.mCreateFileSize);
    mFiledata = new byte[(int) Math.min(fileSize, StressConstants.WRITE_FILE_ONCE_MAX_BYTES)];
    Arrays.fill(mFiledata, (byte) 0x7A);
    long durationMs = FormatUtils.parseTimeSize(mParameters.mDuration);
    long warmupMs = FormatUtils.parseTimeSize(mParameters.mWarmup);
    long startMs = mBaseParameters.mStartMs;
    if (mBaseParameters.mStartMs == BaseParameters.UNDEFINED_START_MS) {
        startMs = CommonUtils.getCurrentMs() + 1000;
    }
    long endMs = startMs + warmupMs + durationMs;
    BenchContext context = new BenchContext(rateLimiter, startMs, endMs);
    List<Callable<Void>> callables = new ArrayList<>(mParameters.mThreads);
    for (int i = 0; i < mParameters.mThreads; i++) {
        callables.add(getBenchThread(context, i));
    }
    LOG.info("Starting {} bench threads", callables.size());
    service.invokeAll(callables, FormatUtils.parseTimeSize(mBaseParameters.mBenchTimeout), TimeUnit.MILLISECONDS);
    LOG.info("Bench threads finished");
    service.shutdownNow();
    service.awaitTermination(30, TimeUnit.SECONDS);
    if (!mBaseParameters.mProfileAgent.isEmpty()) {
        context.addAdditionalResult();
    }
    return context.getResult();
}
Also used : ExecutorService(java.util.concurrent.ExecutorService) ArrayList(java.util.ArrayList) RateLimiter(com.google.common.util.concurrent.RateLimiter) Callable(java.util.concurrent.Callable) SuppressFBWarnings(alluxio.annotation.SuppressFBWarnings)

Aggregations

SuppressFBWarnings (alluxio.annotation.SuppressFBWarnings)11 AlluxioURI (alluxio.AlluxioURI)5 Map (java.util.Map)5 URI (java.net.URI)4 ArrayList (java.util.ArrayList)4 Callable (java.util.concurrent.Callable)4 ExecutorService (java.util.concurrent.ExecutorService)4 Configuration (org.apache.hadoop.conf.Configuration)4 FileSystem (org.apache.hadoop.fs.FileSystem)4 Path (org.apache.hadoop.fs.Path)4 InstancedConfiguration (alluxio.conf.InstancedConfiguration)3 HashMap (java.util.HashMap)3 ClientIOTaskResult (alluxio.stress.client.ClientIOTaskResult)2 Constants (alluxio.Constants)1 FileInStream (alluxio.client.file.FileInStream)1 FileOutStream (alluxio.client.file.FileOutStream)1 PropertyKey (alluxio.conf.PropertyKey)1 Source (alluxio.conf.Source)1 AlluxioException (alluxio.exception.AlluxioException)1 CreateFilePOptions (alluxio.grpc.CreateFilePOptions)1