Class StorageAttachedIndexWriter
java.lang.Object
org.apache.cassandra.index.sai.disk.StorageAttachedIndexWriter
- All Implemented Interfaces:
SSTableFlushObserver
@NotThreadSafe
public class StorageAttachedIndexWriter
extends Object
implements SSTableFlushObserver
Writes all on-disk index structures attached to a given SSTable.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAborts all column index writers and, only if they have not yet completed, SSTable-level component writers.voidvoidbegin()Called before writing any data to the sstable.voidcomplete()Called when all data is written to the file and it's ready to be finished up.static StorageAttachedIndexWritercreateBuilderWriter(IndexDescriptor indexDescriptor, Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker, boolean perIndexComponentsOnly) static StorageAttachedIndexWritercreateFlushObserverWriter(IndexDescriptor indexDescriptor, Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker) voidnextUnfilteredCluster(Unfiltered unfiltered) Called after an unfiltered is written to the sstable.voidCalled when current sstable writer is switched during sharded compaction to free any in-memory resources associated with the sstable without waiting for full transaction to completevoidstartPartition(DecoratedKey key, long keyPosition, long keyPositionForSASI) Called when a new partition in being written to the sstable, but before any cells are processed (seeSSTableFlushObserver.nextUnfilteredCluster(Unfiltered)).voidCalled when a static row is being written to the sstable.
-
Method Details
-
createFlushObserverWriter
public static StorageAttachedIndexWriter createFlushObserverWriter(IndexDescriptor indexDescriptor, Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker) throws IOException - Throws:
IOException
-
createBuilderWriter
public static StorageAttachedIndexWriter createBuilderWriter(IndexDescriptor indexDescriptor, Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker, boolean perIndexComponentsOnly) throws IOException - Throws:
IOException
-
begin
public void begin()Description copied from interface:SSTableFlushObserverCalled before writing any data to the sstable.- Specified by:
beginin interfaceSSTableFlushObserver
-
startPartition
Description copied from interface:SSTableFlushObserverCalled when a new partition in being written to the sstable, but before any cells are processed (seeSSTableFlushObserver.nextUnfilteredCluster(Unfiltered)).- Specified by:
startPartitionin interfaceSSTableFlushObserver- Parameters:
key- the key being appended to SSTable.keyPosition- the position of the key in the SSTable data filekeyPositionForSASI- SSTable format specific key position for storage attached indexes, it can be in data file or in some index file. It is the same position as returned byKeyReader.keyPositionForSecondaryIndex()for the same format, and the same position as expected bySSTableReader.keyAtPositionFromSecondaryIndex(long).
-
nextUnfilteredCluster
Description copied from interface:SSTableFlushObserverCalled after an unfiltered is written to the sstable. Will be preceded by a call toSSTableFlushObserver.startPartition(DecoratedKey, long, long), and the unfiltered should be assumed to belong to that partition.- Specified by:
nextUnfilteredClusterin interfaceSSTableFlushObserver- Parameters:
unfiltered- the unfiltered being written to the SSTable
-
staticRow
Description copied from interface:SSTableFlushObserverCalled when a static row is being written to the sstable. If static columns are present in the table, it is called afterSSTableFlushObserver.startPartition(DecoratedKey, long, long)and before any calls toSSTableFlushObserver.nextUnfilteredCluster(Unfiltered).- Specified by:
staticRowin interfaceSSTableFlushObserver- Parameters:
staticRow- static row appended to the sstable, can be empty, may not benull
-
onSSTableWriterSwitched
public void onSSTableWriterSwitched()Description copied from interface:SSTableFlushObserverCalled when current sstable writer is switched during sharded compaction to free any in-memory resources associated with the sstable without waiting for full transaction to complete- Specified by:
onSSTableWriterSwitchedin interfaceSSTableFlushObserver
-
complete
public void complete()Description copied from interface:SSTableFlushObserverCalled when all data is written to the file and it's ready to be finished up.- Specified by:
completein interfaceSSTableFlushObserver
-
abort
Aborts all column index writers and, only if they have not yet completed, SSTable-level component writers.- Specified by:
abortin interfaceSSTableFlushObserver- Parameters:
accumulator- the initial exception thrown from the failed writer
-
abort
- Parameters:
accumulator- original cause of the abortfromIndex- true if the cause of the abort was the index itself, false otherwise
-