Package com.palantir.atlasdb.cleaner.api
Interface Cleaner
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface Cleaner extends Closeable
ACleaner
is good for two things: it scrubs and it punches. Scrubbing is an on-demand operation, deleting things you particularly badly want gone, and it lets you configure just how badly you want them gone. Punching is associating atlasdb timestamps with wallclock time.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
Release resources.long
getTransactionReadTimeoutMillis()
Returns the timeout for transactions reads in milliseconds.long
getUnreadableTimestamp()
Returns the timestamp that is before any open start timestamps.default boolean
isInitialized()
Used for Cleaners that can be initialized asynchronously (i.e.void
punch(long timestamp)
Indicate that the given timestamp has just been created.void
queueCellsForScrubbing(com.google.common.collect.Multimap<Cell,TableReference> cellToTableRefs, long scrubTimestamp)
Queues cells to be scrubbed.void
scrubImmediately(TransactionManager txManager, com.google.common.collect.Multimap<TableReference,Cell> tableRefToCell, long scrubTimestamp, long commitTimestamp)
Scrubs cells immediately.void
start(TransactionManager txManager)
Starts the background scrubber.
-
-
-
Method Detail
-
isInitialized
default boolean isInitialized()
Used for Cleaners that can be initialized asynchronously (i.e. those extendingAsyncInitializer
; other Cleaners can keep the default implementation, and return true (they're trivially fully initialized).- Returns:
- true if and only if the Cleaner has been fully initialized
-
queueCellsForScrubbing
void queueCellsForScrubbing(com.google.common.collect.Multimap<Cell,TableReference> cellToTableRefs, long scrubTimestamp)
Queues cells to be scrubbed.- Parameters:
cellToTableRefs
- Cells that were touched as part of the hard delete transactionscrubTimestamp
- The start timestamp of the hard delete transaction whose cells need to be scrubbed; at the time queueCellsForScrubbing is called, the hard delete transaction will be in the process of committing @throws exceptions are simply propagated up if something goes wrong.
-
scrubImmediately
void scrubImmediately(TransactionManager txManager, com.google.common.collect.Multimap<TableReference,Cell> tableRefToCell, long scrubTimestamp, long commitTimestamp)
Scrubs cells immediately.- Parameters:
tableRefToCell
- Cells to be scrubbed immediatelyscrubTimestamp
- The start timestamp of the hard delete transaction whose cells need to be scrubbed; at the time scrubImmediately is called, the hard delete transaction will have just committed- Throws:
RuntimeException
- are simply propagated up if something goes wrong.
-
punch
void punch(long timestamp)
Indicate that the given timestamp has just been created. This must be called frequently (preferably on each transaction commit) so that the Cleaner can keep track of the wall-clock/timestamp mapping. If it is never called, semantically nothing goes wrong, but the sweeper won't sweep, since it cannot know what things are old enough to be swept.- Parameters:
timestamp
- Timestamp that has just been committed.
-
getTransactionReadTimeoutMillis
long getTransactionReadTimeoutMillis()
Returns the timeout for transactions reads in milliseconds. SnapshotTransaction enforces that transactions that have been open for longer than this timeout can no longer perform reads; waiting for the timeout to elapse after cleaning allows us to avoid causing currently open read transactions to abort.
-
getUnreadableTimestamp
long getUnreadableTimestamp()
Returns the timestamp that is before any open start timestamps. This is different from the immutable timestamp, because it takes into account open read-only transactions. There is likely to be NO running transactions open at a timestamp before the unreadable timestamp, however this cannot be guaranteed.When using the unreadable timestamp for cleanup it is important to leave a sentinel value behind at a negative timestamp so any transaction that is open will fail out if reading a value that is cleaned up instead of just getting back no data. This is needed to ensure that all transactions either produce correct values or fail. It is not an option to return incorrect data.
-
close
void close()
Release resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
start
void start(TransactionManager txManager)
Starts the background scrubber.
-
-