Class CompactionPipeline

java.lang.Object
org.apache.hadoop.hbase.regionserver.CompactionPipeline

@Private public class CompactionPipeline extends Object
The compaction pipeline of a CompactingMemStore, is a FIFO queue of segments. It supports pushing a segment at the head of the pipeline and removing a segment from the tail when it is flushed to disk. It also supports swap method to allow the in-memory compaction swap a subset of the segments at the tail of the pipeline with a new (compacted) one. This swap succeeds only if the version number passed with the list of segments to swap is the same as the current version of the pipeline. Essentially, there are two methods which can change the structure of the pipeline: pushHead() and swap(), the later is used both by a flush to disk and by an in-memory compaction. The pipeline version is updated by swap(); it allows to identify conflicting operations at the suffix of the pipeline. The synchronization model is copy-on-write. Methods which change the structure of the pipeline (pushHead() and swap()) apply their changes in the context of a lock. They also make a read-only copy of the pipeline's list. Read methods read from a read-only copy. If a read method accesses the read-only copy more than once it makes a local copy of it to ensure it accesses the same copy. The methods getVersionedList(), getVersionedTail(), and flattenOneSegment() are also protected by a lock since they need to have a consistent (atomic) view of the pipeline list and version number.