private boolean isThoroughlySwept(TableReference tableRef) { return sweepStrategyManager.get().get(tableRef) == SweepStrategy.THOROUGH; }
public static SweepStrategyManager fromMap(final Map<TableReference, SweepStrategy> map) { return new SweepStrategyManager(RecomputingSupplier.create(Suppliers.ofInstance(map))); }
private void checkTableName(TableReference tableRef) { SweepStrategy sweepStrategy = sweepStrategies.get().get(tableRef); if (sweepStrategy == SweepStrategy.THOROUGH) { throw new IllegalStateException( "Cannot read from a table with a thorough sweep strategy in a read only transaction."); } }
public static SweepStrategyManager completelyConservative(KeyValueService kvs) { return new SweepStrategyManager(getConservativeManager(kvs)); }
private SweepResults runInternal( TableReference tableRef, SweepBatchConfig batchConfig, byte[] startRow, RunType runType) { Preconditions.checkNotNull(tableRef, "tableRef cannot be null"); Preconditions.checkState(!AtlasDbConstants.HIDDEN_TABLES.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); }
public static SweepStrategyManager createDefault(KeyValueService kvs) { return new SweepStrategyManager(getSweepStrategySupplier(kvs)); }
@Before public void setUp() throws Exception { delegateTransaction = Mockito.mock(AbstractTransaction.class); SweepStrategyManager sweepStrategies = Mockito.mock(SweepStrategyManager.class); when(sweepStrategies.get()).thenReturn(ImmutableMap.of( DUMMY_CONSERVATIVE_TABLE, TableMetadataPersistence.SweepStrategy.CONSERVATIVE, DUMMY_THOROUGH_TABLE, TableMetadataPersistence.SweepStrategy.THOROUGH)); readTransaction = new ReadTransaction(delegateTransaction, sweepStrategies); }
public static SweepStrategyManager createFromSchema(Schema schema) { return new SweepStrategyManager(RecomputingSupplier.create(Suppliers.ofInstance(getSweepStrategies(schema)))); }
private boolean isThoroughlySwept(TableReference tableRef) { return sweepStrategyManager.get().get(tableRef) == SweepStrategy.THOROUGH; }
public static SweepStrategyManager fromMap(final Map<TableReference, SweepStrategy> map) { return new SweepStrategyManager(RecomputingSupplier.create(Suppliers.ofInstance(map))); }
private void checkTableName(TableReference tableRef) { SweepStrategy sweepStrategy = sweepStrategies.get().get(tableRef); if (sweepStrategy == SweepStrategy.THOROUGH) { throw new IllegalStateException( "Cannot read from a table with a thorough sweep strategy in a read only transaction."); } }
public static SweepStrategyManager completelyConservative(KeyValueService kvs) { return new SweepStrategyManager(getConservativeManager(kvs)); }
private SweepResults runInternal( TableReference tableRef, SweepBatchConfig batchConfig, byte[] startRow, RunType runType) { Preconditions.checkNotNull(tableRef, "tableRef cannot be null"); Preconditions.checkState(!AtlasDbConstants.HIDDEN_TABLES.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); }
public static SweepStrategyManager createDefault(KeyValueService kvs) { return new SweepStrategyManager(getSweepStrategySupplier(kvs)); }
public static SweepStrategyManager createFromSchema(Schema schema) { return new SweepStrategyManager(RecomputingSupplier.create(Suppliers.ofInstance(getSweepStrategies(schema)))); }