Class AbstractMultiFileWriter
java.lang.Object
org.apache.hadoop.hbase.regionserver.AbstractMultiFileWriter
- All Implemented Interfaces:
CellSink
,ShipperListener
- Direct Known Subclasses:
DateTieredMultiFileWriter
,StripeMultiFileWriter
@Private
public abstract class AbstractMultiFileWriter
extends Object
implements CellSink, ShipperListener
Base class for cell sink that separates the provided cells into multiple files.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
protected StoreScanner
Source scanner that is tracking KV count; may be null if source is not StoreScannerprotected AbstractMultiFileWriter.WriterFactory
Factory that is used to produce single StoreFile.Writer-s -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.hadoop.fs.Path>
Close all writers without throwing any exceptions.void
The action that needs to be performed beforeShipper.shipped()
is performedList<org.apache.hadoop.fs.Path>
commitWriters
(long maxSeqId, boolean majorCompaction) Commit all writers.List<org.apache.hadoop.fs.Path>
commitWriters
(long maxSeqId, boolean majorCompaction, Collection<HStoreFile> storeFiles) void
init
(StoreScanner sourceScanner, AbstractMultiFileWriter.WriterFactory factory) Initializes multi-writer before usage.protected void
preCloseWriter
(StoreFileWriter writer) Subclasses override this method to be called before we close the give writer.protected void
Subclasses override this method to be called at the end of a successful sequence of append; all appends are processed before this method is called.protected abstract Collection<StoreFileWriter>
writers()
-
Field Details
-
LOG
-
writerFactory
Factory that is used to produce single StoreFile.Writer-s -
sourceScanner
Source scanner that is tracking KV count; may be null if source is not StoreScanner
-
-
Constructor Details
-
AbstractMultiFileWriter
public AbstractMultiFileWriter()
-
-
Method Details
-
init
Initializes multi-writer before usage.- Parameters:
sourceScanner
- Optional store scanner to obtain the information about read progress.factory
- Factory used to produce individual file writers.
-
commitWriters
public List<org.apache.hadoop.fs.Path> commitWriters(long maxSeqId, boolean majorCompaction) throws IOException Commit all writers.Notice that here we use the same
maxSeqId
for all output files since we haven't found an easy to find enough sequence ids for different output files in some corner cases. See comments in HBASE-15400 for more details.- Throws:
IOException
-
commitWriters
public List<org.apache.hadoop.fs.Path> commitWriters(long maxSeqId, boolean majorCompaction, Collection<HStoreFile> storeFiles) throws IOException - Throws:
IOException
-
abortWriters
Close all writers without throwing any exceptions. This is used when compaction failed usually. -
writers
-
preCommitWriters
Subclasses override this method to be called at the end of a successful sequence of append; all appends are processed before this method is called.- Throws:
IOException
-
preCloseWriter
Subclasses override this method to be called before we close the give writer. Usually you can append extra metadata to the writer.- Throws:
IOException
-
beforeShipped
Description copied from interface:ShipperListener
The action that needs to be performed beforeShipper.shipped()
is performed- Specified by:
beforeShipped
in interfaceShipperListener
- Throws:
IOException
-