Search in sources :

Example 1 with Follower

use of com.palantir.atlasdb.cleaner.Follower in project atlasdb by palantir.

the class CellsSweeper method sweepCells.

public void sweepCells(TableReference tableRef, Multimap<Cell, Long> cellTsPairsToSweep, Collection<Cell> sentinelsToAdd) {
    if (cellTsPairsToSweep.isEmpty()) {
        log.info("Attempted to delete 0 cell+timestamp pairs from table {}.", LoggingArgs.tableRef(tableRef));
        return;
    }
    log.info("Attempted to delete {} stale cell+timestamp pairs from table {}, and add {} sentinels.", SafeArg.of("numCellTsPairsToDelete", cellTsPairsToSweep.size()), LoggingArgs.tableRef(tableRef), SafeArg.of("numGarbageCollectionSentinelsToAdd", sentinelsToAdd.size()));
    for (Follower follower : followers) {
        follower.run(txManager, tableRef, cellTsPairsToSweep.keySet(), Transaction.TransactionType.HARD_DELETE);
    }
    if (!sentinelsToAdd.isEmpty()) {
        keyValueService.addGarbageCollectionSentinelValues(tableRef, sentinelsToAdd);
    }
    if (cellTsPairsToSweep.entries().stream().anyMatch(entry -> entry.getValue() == null)) {
        log.error("When sweeping table {} found cells to sweep with the start timestamp null." + " This is unexpected. The cellTs pairs to sweep were: {}.", LoggingArgs.tableRef(tableRef), getLoggingArgForCells(cellTsPairsToSweep));
    }
    keyValueService.delete(tableRef, cellTsPairsToSweep);
}
Also used : Follower(com.palantir.atlasdb.cleaner.Follower)

Aggregations

Follower (com.palantir.atlasdb.cleaner.Follower)1