org.apache.hadoop.hbase.regionserver
Class StripeMultiFileWriter

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

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

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


Nested Class Summary
static class StripeMultiFileWriter.BoundaryMultiWriter
          MultiWriter that separates the cells based on fixed row-key boundaries.
static class StripeMultiFileWriter.SizeMultiWriter
          MultiWriter that separates the cells based on target cell number per file and file count.
static interface StripeMultiFileWriter.WriterFactory
           
 
Field Summary
protected  List<byte[]> boundaries
           
protected  KeyValue.KVComparator comparator
           
protected  List<StoreFile.Writer> existingWriters
           
protected  StoreScanner sourceScanner
          Source scanner that is tracking KV count; may be null if source is not StoreScanner
protected  StripeMultiFileWriter.WriterFactory writerFactory
          Factory that is used to produce single StoreFile.Writer-s
 
Constructor Summary
StripeMultiFileWriter()
           
 
Method Summary
 List<org.apache.hadoop.fs.Path> abortWriters()
           
 List<org.apache.hadoop.fs.Path> commitWriters(long maxSeqId, boolean isMajor)
           
protected abstract  void commitWritersInternal()
          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.
 void init(StoreScanner sourceScanner, StripeMultiFileWriter.WriterFactory factory, KeyValue.KVComparator comparator)
          Initializes multi-writer before usage.
protected  void sanityCheckLeft(byte[] left, byte[] row, int rowOffset, int rowLength)
          Subclasses can call this method to make sure the first KV is within multi-writer range.
protected  void sanityCheckRight(byte[] right, byte[] row, int rowOffset, int rowLength)
          Subclasses can call this method to make sure the last KV is within multi-writer range.
 void setNoStripeMetadata()
           
 
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 StripeMultiFileWriter.WriterFactory writerFactory
Factory that is used to produce single StoreFile.Writer-s


comparator

protected KeyValue.KVComparator comparator

existingWriters

protected List<StoreFile.Writer> existingWriters

boundaries

protected List<byte[]> boundaries

sourceScanner

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

Constructor Detail

StripeMultiFileWriter

public StripeMultiFileWriter()
Method Detail

init

public void init(StoreScanner sourceScanner,
                 StripeMultiFileWriter.WriterFactory factory,
                 KeyValue.KVComparator comparator)
          throws IOException
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.
comparator - Comparator used to compare rows.
Throws:
IOException

setNoStripeMetadata

public void setNoStripeMetadata()

commitWriters

public List<org.apache.hadoop.fs.Path> commitWriters(long maxSeqId,
                                                     boolean isMajor)
                                              throws IOException
Throws:
IOException

abortWriters

public List<org.apache.hadoop.fs.Path> abortWriters()

sanityCheckLeft

protected void sanityCheckLeft(byte[] left,
                               byte[] row,
                               int rowOffset,
                               int rowLength)
                        throws IOException
Subclasses can call this method to make sure the first KV is within multi-writer range.

Parameters:
left - The left boundary of the writer.
row - The row to check.
rowOffset - Offset for row.
rowLength - Length for row.
Throws:
IOException

sanityCheckRight

protected void sanityCheckRight(byte[] right,
                                byte[] row,
                                int rowOffset,
                                int rowLength)
                         throws IOException
Subclasses can call this method to make sure the last KV is within multi-writer range.

Parameters:
right - The right boundary of the writer.
row - The row to check.
rowOffset - Offset for row.
rowLength - Length for row.
Throws:
IOException

commitWritersInternal

protected abstract void commitWritersInternal()
                                       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


Copyright © 2015 The Apache Software Foundation. All rights reserved.