org.apache.hadoop.hbase.regionserver
Class AbstractMultiFileWriter

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.AbstractMultiFileWriter
All Implemented Interfaces:
Compactor.CellSink
Direct Known Subclasses:
DateTieredMultiFileWriter, StripeMultiFileWriter

@InterfaceAudience.Private
public abstract class AbstractMultiFileWriter
extends Object
implements Compactor.CellSink

Base class for cell sink that separates the provided cells into multiple files.


Nested Class Summary
static interface AbstractMultiFileWriter.WriterFactory
           
 
Field Summary
protected  StoreScanner sourceScanner
          Source scanner that is tracking KV count; may be null if source is not StoreScanner
protected  AbstractMultiFileWriter.WriterFactory writerFactory
          Factory that is used to produce single StoreFile.Writer-s
 
Constructor Summary
AbstractMultiFileWriter()
           
 
Method Summary
 List<org.apache.hadoop.fs.Path> abortWriters()
          Close all writers without throwing any exceptions.
 List<org.apache.hadoop.fs.Path> commitWriters(long maxSeqId, boolean isMajor)
          Commit all writers.
 void init(StoreScanner sourceScanner, AbstractMultiFileWriter.WriterFactory factory)
          Initializes multi-writer before usage.
protected  void preCloseWriter(StoreFile.Writer writer)
          Subclasses override this method to be called before we close the give writer.
protected  void 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.
protected abstract  Collection<StoreFile.Writer> writers()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.regionserver.compactions.Compactor.CellSink
append
 

Field Detail

writerFactory

protected AbstractMultiFileWriter.WriterFactory writerFactory
Factory that is used to produce single StoreFile.Writer-s


sourceScanner

protected StoreScanner sourceScanner
Source scanner that is tracking KV count; may be null if source is not StoreScanner

Constructor Detail

AbstractMultiFileWriter

public AbstractMultiFileWriter()
Method Detail

init

public void init(StoreScanner sourceScanner,
                 AbstractMultiFileWriter.WriterFactory factory)
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 isMajor)
                                              throws IOException
Commit all writers.

Notice that here we use the same maxSeqId for all output files since we haven't find 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

abortWriters

public List<org.apache.hadoop.fs.Path> abortWriters()
Close all writers without throwing any exceptions. This is used when compaction failed usually.


writers

protected abstract Collection<StoreFile.Writer> writers()

preCommitWriters

protected void preCommitWriters()
                         throws IOException
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

protected void preCloseWriter(StoreFile.Writer writer)
                       throws IOException
Subclasses override this method to be called before we close the give writer. Usually you can append extra metadata to the writer.

Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.