public class LifecycleTransaction extends Transactional.AbstractTransactional implements ILifecycleTransaction
Modifier and Type | Class and Description |
---|---|
static class |
LifecycleTransaction.ReaderState |
Transactional.AbstractTransactional
Modifier and Type | Method and Description |
---|---|
void |
cancel(java.lang.Iterable<SSTableReader> cancels)
remove the readers from the set we're modifying
|
void |
cancel(SSTableReader cancel)
remove the reader from the set we're modifying
|
void |
checkpoint()
call when a consistent batch of changes is ready to be made atomically visible
these will be exposed in the Tracker atomically, or an exception will be thrown; in this case
the transaction should be rolled back
|
java.lang.Iterable<SSTableReader> |
current()
returns the currently visible readers managed by this transaction
|
SSTableReader |
current(SSTableReader reader)
return the current version of the provided reader, whether or not it is visible or staged;
i.e.
|
java.lang.Throwable |
doAbort(java.lang.Throwable accumulate)
undo all of the changes made by this transaction, resetting the state to its original form
|
java.lang.Throwable |
doCommit(java.lang.Throwable accumulate)
point of no return: commit all changes, but leave all readers marked as compacting
|
protected java.lang.Throwable |
doPostCleanup(java.lang.Throwable accumulate)
perform an exception-safe post-abort cleanup
|
void |
doPrepare()
Do any preparatory work prior to commit.
|
static java.util.List<java.io.File> |
getFiles(java.nio.file.Path folder,
java.util.function.BiPredicate<java.io.File,Directories.FileType> filter,
Directories.OnTxnErr onTxnErr)
Get the files in the folder specified, provided that the filter returns true.
|
boolean |
isObsolete(SSTableReader reader)
indicates if the reader has been marked for obsoletion
|
boolean |
isOffline() |
org.apache.cassandra.db.lifecycle.LogTransaction |
log() |
void |
obsolete(SSTableReader reader)
mark this reader as for obsoletion : on checkpoint() the reader will be removed from the live set
|
void |
obsoleteOriginals()
obsolete every file in the original transaction
|
static LifecycleTransaction |
offline(OperationType operationType)
construct an empty Transaction with no existing readers
|
static LifecycleTransaction |
offline(OperationType operationType,
java.lang.Iterable<SSTableReader> readers)
construct a Transaction for use in an offline operation
|
static LifecycleTransaction |
offline(OperationType operationType,
SSTableReader reader)
construct a Transaction for use in an offline operation
|
SSTableReader |
onlyOne() |
java.util.UUID |
opId() |
OperationType |
opType() |
java.util.Set<SSTableReader> |
originals()
the set of readers guarded by this transaction _in their original instance/state_
call current(SSTableReader) on any reader in this set to get the latest instance
|
static boolean |
removeUnfinishedLeftovers(ColumnFamilyStore cfs) |
static boolean |
removeUnfinishedLeftovers(TableMetadata metadata) |
static void |
rescheduleFailedDeletions()
Retry all deletions that failed the first time around (presumably b/c the sstable was still mmap'd.)
Useful because there are times when we know GC has been invoked; also exposed as an mbean.
|
void |
runOnAbort(java.lang.Runnable fn) |
void |
runOnCommit(java.lang.Runnable fn) |
LifecycleTransaction |
split(java.util.Collection<SSTableReader> readers)
remove the provided readers from this Transaction, and return a new Transaction to manage them
only permitted to be called if the current Transaction has never been used
|
LifecycleTransaction.ReaderState |
state(SSTableReader reader) |
java.lang.String |
toString() |
void |
trackNew(SSTable table)
Called when a new table is about to be created, so that this table can be tracked by a transaction.
|
void |
untrackNew(SSTable table)
Called when a new table is no longer required, so that this table can be untracked by a transaction.
|
void |
update(java.util.Collection<SSTableReader> readers,
boolean original) |
void |
update(SSTableReader reader,
boolean original)
update a reader: if !original, this is a reader that is being introduced by this transaction;
otherwise it must be in the originals() set, i.e.
|
static void |
waitForDeletions()
Deletions run on the nonPeriodicTasks executor, (both failedDeletions or global tidiers in SSTableReader)
so by scheduling a new empty task and waiting for it we ensure any prior deletion has completed.
|
abort, abort, close, commit, commit, doPreCleanup, finish, prepareToCommit, state
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
abort, close, commit, prepareToCommit
public final Tracker tracker
public static LifecycleTransaction offline(OperationType operationType, SSTableReader reader)
public static LifecycleTransaction offline(OperationType operationType, java.lang.Iterable<SSTableReader> readers)
public static LifecycleTransaction offline(OperationType operationType)
public org.apache.cassandra.db.lifecycle.LogTransaction log()
public OperationType opType()
opType
in interface LifecycleNewTracker
public java.util.UUID opId()
public void doPrepare()
Transactional.AbstractTransactional
doPrepare
in class Transactional.AbstractTransactional
public java.lang.Throwable doCommit(java.lang.Throwable accumulate)
doCommit
in class Transactional.AbstractTransactional
public java.lang.Throwable doAbort(java.lang.Throwable accumulate)
doAbort
in class Transactional.AbstractTransactional
protected java.lang.Throwable doPostCleanup(java.lang.Throwable accumulate)
Transactional.AbstractTransactional
doPostCleanup
in class Transactional.AbstractTransactional
public boolean isOffline()
isOffline
in interface ILifecycleTransaction
public void checkpoint()
checkpoint
in interface ILifecycleTransaction
public void update(SSTableReader reader, boolean original)
update
in interface ILifecycleTransaction
public void update(java.util.Collection<SSTableReader> readers, boolean original)
update
in interface ILifecycleTransaction
public void obsolete(SSTableReader reader)
obsolete
in interface ILifecycleTransaction
public void runOnCommit(java.lang.Runnable fn)
public void runOnAbort(java.lang.Runnable fn)
public void obsoleteOriginals()
obsoleteOriginals
in interface ILifecycleTransaction
public java.lang.Iterable<SSTableReader> current()
public java.util.Set<SSTableReader> originals()
originals
in interface ILifecycleTransaction
public boolean isObsolete(SSTableReader reader)
isObsolete
in interface ILifecycleTransaction
public SSTableReader current(SSTableReader reader)
current
in interface ILifecycleTransaction
public void cancel(SSTableReader cancel)
public void cancel(java.lang.Iterable<SSTableReader> cancels)
public LifecycleTransaction split(java.util.Collection<SSTableReader> readers)
public SSTableReader onlyOne()
public void trackNew(SSTable table)
LifecycleNewTracker
trackNew
in interface LifecycleNewTracker
table
- - the new table to be trackedpublic void untrackNew(SSTable table)
LifecycleNewTracker
untrackNew
in interface LifecycleNewTracker
table
- - the table to be untrackedpublic static boolean removeUnfinishedLeftovers(ColumnFamilyStore cfs)
public static boolean removeUnfinishedLeftovers(TableMetadata metadata)
public static java.util.List<java.io.File> getFiles(java.nio.file.Path folder, java.util.function.BiPredicate<java.io.File,Directories.FileType> filter, Directories.OnTxnErr onTxnErr)
folder
- - the folder to scanonTxnErr
- - how to handle a failure to read a txn log filefilter
- - A function that receives each file and its type, it should return true to have the file returnedpublic static void rescheduleFailedDeletions()
public static void waitForDeletions()
public LifecycleTransaction.ReaderState state(SSTableReader reader)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009-2021 The Apache Software Foundation