Class StorageAttachedIndexWriter
- java.lang.Object
-
- org.apache.cassandra.index.sai.disk.StorageAttachedIndexWriter
-
- All Implemented Interfaces:
SSTableFlushObserver
@NotThreadSafe public class StorageAttachedIndexWriter extends java.lang.Object implements SSTableFlushObserver
Writes all on-disk index structures attached to a given SSTable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort(java.lang.Throwable accumulator)
Aborts all column index writers and, only if they have not yet completed, SSTable-level component writers.void
abort(java.lang.Throwable accumulator, boolean fromIndex)
void
begin()
Called before writing any data to the sstable.void
complete()
Called when all data is written to the file and it's ready to be finished up.static StorageAttachedIndexWriter
createBuilderWriter(IndexDescriptor indexDescriptor, java.util.Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker, boolean perIndexComponentsOnly)
static StorageAttachedIndexWriter
createFlushObserverWriter(IndexDescriptor indexDescriptor, java.util.Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker)
void
nextUnfilteredCluster(Unfiltered unfiltered)
Called after an unfiltered is written to the sstable.void
startPartition(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)
).void
staticRow(Row staticRow)
Called when a static row is being written to the sstable.
-
-
-
Method Detail
-
createFlushObserverWriter
public static StorageAttachedIndexWriter createFlushObserverWriter(IndexDescriptor indexDescriptor, java.util.Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker) throws java.io.IOException
- Throws:
java.io.IOException
-
createBuilderWriter
public static StorageAttachedIndexWriter createBuilderWriter(IndexDescriptor indexDescriptor, java.util.Collection<StorageAttachedIndex> indexes, LifecycleNewTracker lifecycleNewTracker, boolean perIndexComponentsOnly) throws java.io.IOException
- Throws:
java.io.IOException
-
begin
public void begin()
Description copied from interface:SSTableFlushObserver
Called before writing any data to the sstable.- Specified by:
begin
in interfaceSSTableFlushObserver
-
startPartition
public void startPartition(DecoratedKey key, long keyPosition, long keyPositionForSASI)
Description copied from interface:SSTableFlushObserver
Called when a new partition in being written to the sstable, but before any cells are processed (seeSSTableFlushObserver.nextUnfilteredCluster(Unfiltered)
).- Specified by:
startPartition
in 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
public void nextUnfilteredCluster(Unfiltered unfiltered)
Description copied from interface:SSTableFlushObserver
Called 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:
nextUnfilteredCluster
in interfaceSSTableFlushObserver
- Parameters:
unfiltered
- the unfiltered being written to the SSTable
-
staticRow
public void staticRow(Row staticRow)
Description copied from interface:SSTableFlushObserver
Called 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:
staticRow
in interfaceSSTableFlushObserver
- Parameters:
staticRow
- static row appended to the sstable, can be empty, may not benull
-
complete
public void complete()
Description copied from interface:SSTableFlushObserver
Called when all data is written to the file and it's ready to be finished up.- Specified by:
complete
in interfaceSSTableFlushObserver
-
abort
public void abort(java.lang.Throwable accumulator)
Aborts all column index writers and, only if they have not yet completed, SSTable-level component writers.- Specified by:
abort
in interfaceSSTableFlushObserver
- Parameters:
accumulator
- the initial exception thrown from the failed writer
-
abort
public void abort(java.lang.Throwable accumulator, boolean fromIndex)
- Parameters:
accumulator
- original cause of the abortfromIndex
- true if the cause of the abort was the index itself, false otherwise
-
-