Interface LockWatchValueScopingCache
-
- All Superinterfaces:
com.palantir.lock.watch.LockWatchValueCache
public interface LockWatchValueScopingCache extends com.palantir.lock.watch.LockWatchValueCache
The idea here is to keep a map ofCellReference
-> value for each table. Applying lock watch events will: - forLockEvent
, denote that the given descriptor cannot be cached; - forUnlockEvent
, denote that the given descriptor can now be cached; - forLockWatchCreatedEvent
, denote that the given table can now be cached; The central mapping is kept up-to-date with the above, but views of the map are given to transactions which are accurate at the start timestamp's lock watch version. Each transaction then can read from the cache as well as create a digest of values that it has read (and is allowed to read). At commit time, it will flush those values to the central cache (taking in to account the since-locked descriptors), as well as checking for conflicts for serializable transactions by adding a check in thePreCommitCondition
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
ensureStateRemoved(long startTs)
Guarantees that all relevant state for the given transaction has been removed.TransactionScopedCache
getReadOnlyTransactionScopedCacheForCommit(long startTs)
Returns a read-only view of the transaction cache at commit time (specifically, **after** getting the commit timestamp, but before ending the transaction).TransactionScopedCache
getTransactionScopedCache(long startTs)
void
onSuccessfulCommit(long startTs)
Performs final cleanup for a given transaction (identified by its start timestamp).void
processStartTransactions(Set<Long> startTimestamps)
void
updateCacheWithCommitTimestampsInformation(Set<Long> startTimestamps)
This does *not* remove state from the cache -ensureStateRemoved(long)
must be called at the end of the transaction to do so, or else there will be a memory leak.
-
-
-
Method Detail
-
processStartTransactions
void processStartTransactions(Set<Long> startTimestamps)
- Specified by:
processStartTransactions
in interfacecom.palantir.lock.watch.LockWatchValueCache
-
updateCacheWithCommitTimestampsInformation
void updateCacheWithCommitTimestampsInformation(Set<Long> startTimestamps)
This does *not* remove state from the cache -ensureStateRemoved(long)
must be called at the end of the transaction to do so, or else there will be a memory leak.- Specified by:
updateCacheWithCommitTimestampsInformation
in interfacecom.palantir.lock.watch.LockWatchValueCache
-
ensureStateRemoved
void ensureStateRemoved(long startTs)
Guarantees that all relevant state for the given transaction has been removed. If the state is already gone (by callingonSuccessfulCommit(long)
, this will be a no-op. Failure to call this method may result in memory leaks (particularly for aborting transactions).- Specified by:
ensureStateRemoved
in interfacecom.palantir.lock.watch.LockWatchValueCache
-
onSuccessfulCommit
void onSuccessfulCommit(long startTs)
Performs final cleanup for a given transaction (identified by its start timestamp). This removes state associated with a transaction, and flushes values to the central value cache. Calling this method before a transaction is fully committed may result in incorrect values being cached.- Specified by:
onSuccessfulCommit
in interfacecom.palantir.lock.watch.LockWatchValueCache
-
getTransactionScopedCache
TransactionScopedCache getTransactionScopedCache(long startTs)
-
getReadOnlyTransactionScopedCacheForCommit
TransactionScopedCache getReadOnlyTransactionScopedCacheForCommit(long startTs)
Returns a read-only view of the transaction cache at commit time (specifically, **after** getting the commit timestamp, but before ending the transaction). This view will contain the local updates stored during the transaction, but will filter out any cells that have been locked between the start and commit of this transaction. The primary purpose of this cache is for serializable conflict checking.
-
-