use of com.palantir.atlasdb.protos.generated.TableMetadataPersistence.SweepStrategy in project atlasdb by palantir.
the class SweepTaskRunner method runInternal.
private SweepResults runInternal(TableReference tableRef, SweepBatchConfig batchConfig, byte[] startRow, RunType runType) {
Preconditions.checkNotNull(tableRef, "tableRef cannot be null");
Preconditions.checkState(!AtlasDbConstants.hiddenTables.contains(tableRef));
if (tableRef.getQualifiedName().startsWith(AtlasDbConstants.NAMESPACE_PREFIX)) {
// this happens sometimes; I think it's because some places in the code can
// start this sweeper without doing the full normally ordered KVSModule startup.
// I did check and sweep.stats did contain the FQ table name for all of the tables,
// so it is at least broken in some way that still allows namespaced tables to eventually be swept.
log.warn("The sweeper should not be run on tables passed through namespace mapping.");
return SweepResults.createEmptySweepResultWithNoMoreToSweep();
}
if (keyValueService.getMetadataForTable(tableRef).length == 0) {
log.warn("The sweeper tried to sweep table '{}', but the table does not exist. Skipping table.", LoggingArgs.tableRef("tableRef", tableRef));
return SweepResults.createEmptySweepResultWithNoMoreToSweep();
}
SweepStrategy sweepStrategy = sweepStrategyManager.get().getOrDefault(tableRef, SweepStrategy.CONSERVATIVE);
Optional<Sweeper> maybeSweeper = Sweeper.of(sweepStrategy);
return maybeSweeper.map(sweeper -> doRun(tableRef, batchConfig, startRow, runType, sweeper)).orElseGet(SweepResults::createEmptySweepResultWithNoMoreToSweep);
}
use of com.palantir.atlasdb.protos.generated.TableMetadataPersistence.SweepStrategy in project atlasdb by palantir.
the class TableMetadata method hydrateFromProto.
public static TableMetadata hydrateFromProto(TableMetadataPersistence.TableMetadata message) {
CachePriority cachePriority = CachePriority.WARM;
if (message.hasCachePriority()) {
cachePriority = message.getCachePriority();
}
boolean rangeScanAllowed = false;
if (message.hasRangeScanAllowed()) {
rangeScanAllowed = message.getRangeScanAllowed();
}
int explicitCompressionBlockSizeKB = 0;
if (message.hasExplicitCompressionBlockSizeKiloBytes()) {
explicitCompressionBlockSizeKB = message.getExplicitCompressionBlockSizeKiloBytes();
}
boolean negativeLookups = false;
if (message.hasNegativeLookups()) {
negativeLookups = message.getNegativeLookups();
}
SweepStrategy sweepStrategy = SweepStrategy.CONSERVATIVE;
if (message.hasSweepStrategy()) {
sweepStrategy = message.getSweepStrategy();
}
boolean appendHeavyAndReadLight = false;
if (message.hasAppendHeavyAndReadLight()) {
appendHeavyAndReadLight = message.getAppendHeavyAndReadLight();
}
LogSafety nameLogSafety = LogSafety.UNSAFE;
if (message.hasNameLogSafety()) {
nameLogSafety = message.getNameLogSafety();
}
return new TableMetadata(NameMetadataDescription.hydrateFromProto(message.getRowName()), ColumnMetadataDescription.hydrateFromProto(message.getColumns()), ConflictHandlers.hydrateFromProto(message.getConflictHandler()), cachePriority, rangeScanAllowed, explicitCompressionBlockSizeKB, negativeLookups, sweepStrategy, appendHeavyAndReadLight, nameLogSafety);
}
Aggregations