Class SortedTableWriter<P extends SortedTablePartitionWriter,I extends SortedTableWriter.AbstractIndexWriter>
java.lang.Object
org.apache.cassandra.io.sstable.SSTable
org.apache.cassandra.io.sstable.format.SSTableWriter
org.apache.cassandra.io.sstable.format.SortedTableWriter<P,I>
- All Implemented Interfaces:
AutoCloseable,Transactional
- Direct Known Subclasses:
BigTableWriter,BtiTableWriter
public abstract class SortedTableWriter<P extends SortedTablePartitionWriter,I extends SortedTableWriter.AbstractIndexWriter>
extends SSTableWriter
A generic implementation of a writer which assumes the existence of some partition index and bloom filter.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classSortedTableWriter.Builder<P extends SortedTablePartitionWriter,I extends SortedTableWriter.AbstractIndexWriter, W extends SortedTableWriter<P, I>, B extends SortedTableWriter.Builder<P, I, W, B>> protected classNested classes/interfaces inherited from class org.apache.cassandra.io.sstable.format.SSTableWriter
SSTableWriter.SSTableSizeParametersNested classes/interfaces inherited from class org.apache.cassandra.io.sstable.SSTable
SSTable.OwnerNested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional
Transactional.AbstractTransactional -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SequentialWriterprotected final Iprotected final PFields inherited from class org.apache.cassandra.io.sstable.format.SSTableWriter
first, header, isTransient, keyCount, last, lifecycleNewTracker, maxDataAge, metadataCollector, mmappedRegionsCache, observers, pendingRepair, repairedAt, txnProxyFields inherited from class org.apache.cassandra.io.sstable.SSTable
chunkCache, components, compression, descriptor, ioOptions, metadata, TOMBSTONE_HISTOGRAM_BIN_SIZE, TOMBSTONE_HISTOGRAM_SPOOL_SIZE, TOMBSTONE_HISTOGRAM_TTL_ROUND_SECONDS -
Constructor Summary
ConstructorsConstructorDescriptionSortedTableWriter(SortedTableWriter.Builder<P, I, ?, ?> builder, LifecycleNewTracker lifecycleNewTracker, SSTable.Owner owner) -
Method Summary
Modifier and TypeMethodDescriptionfinal AbstractRowIndexEntryappend(UnfilteredRowIterator partition) Appends partition data to this writer.protected abstract AbstractRowIndexEntrycreateRowIndexEntry(DecoratedKey key, DeletionTime partitionLevelDeletion, long finishResult) longReturns the amount of data already written to disk that may not be accurate (for example, the position after the recently flushed chunk).longReturns a position in the uncompressed data - for uncompressed files it is the same asSSTableWriter.getOnDiskFilePointer()but for compressed files it returns a position in the data rather than a position in the file on disk.longReturns a position in the (compressed) data file on disk.voidmark()protected final voidnotifyObservers(Consumer<SSTableFlushObserver> action) protected voidprotected voidprotected voidprotected voidonStaticRow(Row row) protected FileHandleopenDataFile(long lengthOverride, StatsMetadata statsMetadata) voidReset the data file to the marked position (seeSSTableWriter.mark()) and truncate the rest of the file.protected SSTableWriter.TransactionalProxytxnProxy()The implementing method should return an instance ofSSTableWriter.TransactionalProxyinitialized with a list of all transactional resources included in this writer.Methods inherited from class org.apache.cassandra.io.sstable.format.SSTableWriter
abort, abort, close, commit, finalizeMetadata, finish, finished, getBounds, getFirst, getLast, handleConstructionFailure, onSSTableWriterSwitched, openEarly, openFinal, openFinalEarly, prepareToCommit, releaseMetadataOverhead, setMaxDataAge, setOpenResult, setRepairedAt, setTokenSpaceCoverage, statsMetadataMethods inherited from class org.apache.cassandra.io.sstable.SSTable
addComponents, copy, decorateKey, getAllFilePaths, getColumnFamilyName, getComponents, getFilename, getId, getKeyspaceName, getPartitioner, getStreamingComponents, hardlink, metadata, owner, registerComponents, rename, toString, tryComponentFromFilename, tryComponentFromFilename, tryDescriptorFromFile, unbuildTo, unregisterComponents, validateRepairedMetadata
-
Field Details
-
dataWriter
-
indexWriter
-
partitionWriter
-
-
Constructor Details
-
SortedTableWriter
public SortedTableWriter(SortedTableWriter.Builder<P, I, ?, ?> builder, LifecycleNewTracker lifecycleNewTracker, SSTable.Owner owner)
-
-
Method Details
-
append
Appends partition data to this writer.- Specified by:
appendin classSSTableWriter- Parameters:
partition- the partition to write- Returns:
- the created index entry if something was written, that is if
iteratorwasn't empty,nullotherwise. - Throws:
FSWriteError- if write to the dataFile fails
-
onStartPartition
-
onStaticRow
-
onRow
-
onRangeTombstoneMarker
-
createRowIndexEntry
protected abstract AbstractRowIndexEntry createRowIndexEntry(DecoratedKey key, DeletionTime partitionLevelDeletion, long finishResult) throws IOException - Throws:
IOException
-
notifyObservers
-
mark
public void mark()- Specified by:
markin classSSTableWriter
-
resetAndTruncate
public void resetAndTruncate()Description copied from class:SSTableWriterReset the data file to the marked position (seeSSTableWriter.mark()) and truncate the rest of the file.- Specified by:
resetAndTruncatein classSSTableWriter
-
txnProxy
Description copied from class:SSTableWriterThe implementing method should return an instance ofSSTableWriter.TransactionalProxyinitialized with a list of all transactional resources included in this writer.- Specified by:
txnProxyin classSSTableWriter
-
getFilePointer
public long getFilePointer()Description copied from class:SSTableWriterReturns a position in the uncompressed data - for uncompressed files it is the same asSSTableWriter.getOnDiskFilePointer()but for compressed files it returns a position in the data rather than a position in the file on disk.- Specified by:
getFilePointerin classSSTableWriter
-
getOnDiskFilePointer
public long getOnDiskFilePointer()Description copied from class:SSTableWriterReturns a position in the (compressed) data file on disk. SeeSSTableWriter.getFilePointer()- Specified by:
getOnDiskFilePointerin classSSTableWriter
-
getEstimatedOnDiskBytesWritten
public long getEstimatedOnDiskBytesWritten()Description copied from class:SSTableWriterReturns the amount of data already written to disk that may not be accurate (for example, the position after the recently flushed chunk).- Overrides:
getEstimatedOnDiskBytesWrittenin classSSTableWriter
-
openDataFile
-