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();
}
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);
}
Aggregations