Search in sources :

Example 1 with BlockCache

use of org.apache.accumulo.core.spi.cache.BlockCache in project accumulo by apache.

the class CompactableUtils method selectFiles.

static CompactionPlan selectFiles(CompactionKind kind, Tablet tablet, SortedMap<StoredTabletFile, DataFileValue> datafiles, CompactionStrategyConfig csc) {
    var trsm = tablet.getTabletResources().getTabletServerResourceManager();
    BlockCache sc = trsm.getSummaryCache();
    BlockCache ic = trsm.getIndexCache();
    Cache<String, Long> fileLenCache = trsm.getFileLenCache();
    MajorCompactionRequest request = new MajorCompactionRequest(tablet.getExtent(), CompactableUtils.from(kind), tablet.getTabletServer().getVolumeManager(), tablet.getTableConfiguration(), sc, ic, fileLenCache, tablet.getContext());
    request.setFiles(datafiles);
    CompactionStrategy strategy = CompactableUtils.newInstance(tablet.getTableConfiguration(), csc.getClassName(), CompactionStrategy.class);
    strategy.init(csc.getOptions());
    try {
        if (strategy.shouldCompact(request)) {
            strategy.gatherInformation(request);
            var plan = strategy.getCompactionPlan(request);
            if (plan == null)
                return new CompactionPlan();
            log.debug("Selected files using compaction strategy {} {} {} {}", strategy.getClass().getSimpleName(), csc.getOptions(), plan.inputFiles, plan.deleteFiles);
            plan.validate(datafiles.keySet());
            return plan;
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return new CompactionPlan();
}
Also used : CompactionStrategy(org.apache.accumulo.tserver.compaction.CompactionStrategy) CompactionPlan(org.apache.accumulo.tserver.compaction.CompactionPlan) BlockCache(org.apache.accumulo.core.spi.cache.BlockCache) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) MajorCompactionRequest(org.apache.accumulo.tserver.compaction.MajorCompactionRequest)

Example 2 with BlockCache

use of org.apache.accumulo.core.spi.cache.BlockCache in project accumulo by apache.

the class ThriftClientHandler method startGetSummariesFromFiles.

@Override
public TSummaries startGetSummariesFromFiles(TInfo tinfo, TCredentials credentials, TSummaryRequest request, Map<String, List<TRowRange>> files) throws ThriftSecurityException, TException {
    // do not expect users to call this directly, expect other tservers to call this method
    if (!security.canPerformSystemActions(credentials)) {
        throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED).asThriftException();
    }
    ExecutorService srp = server.resourceManager.getSummaryRetrievalExecutor();
    TableConfiguration tableCfg = context.getTableConfiguration(TableId.of(request.getTableId()));
    BlockCache summaryCache = server.resourceManager.getSummaryCache();
    BlockCache indexCache = server.resourceManager.getIndexCache();
    Cache<String, Long> fileLenCache = server.resourceManager.getFileLenCache();
    VolumeManager fs = context.getVolumeManager();
    FileSystemResolver volMgr = fs::getFileSystemByPath;
    Future<SummaryCollection> future = new Gatherer(server.getContext(), request, tableCfg, context.getCryptoService()).processFiles(volMgr, files, summaryCache, indexCache, fileLenCache, srp);
    return startSummaryOperation(credentials, future);
}
Also used : VolumeManager(org.apache.accumulo.server.fs.VolumeManager) Gatherer(org.apache.accumulo.core.summary.Gatherer) ExecutorService(java.util.concurrent.ExecutorService) BlockCache(org.apache.accumulo.core.spi.cache.BlockCache) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) SummaryCollection(org.apache.accumulo.core.summary.SummaryCollection) TableConfiguration(org.apache.accumulo.server.conf.TableConfiguration) FileSystemResolver(org.apache.accumulo.core.summary.Gatherer.FileSystemResolver)

Aggregations

BlockCache (org.apache.accumulo.core.spi.cache.BlockCache)2 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 ExecutorService (java.util.concurrent.ExecutorService)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 Gatherer (org.apache.accumulo.core.summary.Gatherer)1 FileSystemResolver (org.apache.accumulo.core.summary.Gatherer.FileSystemResolver)1 SummaryCollection (org.apache.accumulo.core.summary.SummaryCollection)1 TableConfiguration (org.apache.accumulo.server.conf.TableConfiguration)1 VolumeManager (org.apache.accumulo.server.fs.VolumeManager)1 CompactionPlan (org.apache.accumulo.tserver.compaction.CompactionPlan)1 CompactionStrategy (org.apache.accumulo.tserver.compaction.CompactionStrategy)1 MajorCompactionRequest (org.apache.accumulo.tserver.compaction.MajorCompactionRequest)1