Package org.apache.hadoop.hbase.wal
Class OutputSink
java.lang.Object
org.apache.hadoop.hbase.wal.OutputSink
- Direct Known Subclasses:
AbstractRecoveredEditsOutputSink,BoundedRecoveredHFilesOutputSink,RegionReplicaReplicationEndpoint.RegionReplicaOutputSink
The following class is an abstraction class to provide a common interface to support different
ways of consuming recovered edits.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CompletionService<Void>protected final ThreadPoolExecutorUsed when close this output sink.private final WALSplitter.PipelineControllerprotected final EntryBuffersprivate static final org.slf4j.Loggerprotected final intprotected CancelableProgressableprotected final List<org.apache.hadoop.fs.Path>List of all the files produced by this sinkprotected MonitoredTaskprotected final AtomicLongprivate final List<OutputSink.WriterThread> -
Constructor Summary
ConstructorsConstructorDescriptionOutputSink(WALSplitter.PipelineController controller, EntryBuffers entryBuffers, int numWriters) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidappend(EntryBuffers.RegionEntryBuffer buffer) protected abstract List<org.apache.hadoop.fs.Path>close()protected booleanfinishWriterThreads(boolean interrupt) Wait for writer threads to dump all info to the sinkprotected abstract intReturns number of regions we've recoveredprotected abstract intReturns the number of currently opened writersReturns a map from encoded region ID to the number of edits written out for that region.(package private) longprotected abstract booleankeepRegionEvent(WAL.Entry entry) Some WALEdit's contain only KV's for account on what happened to a region.void(package private) voidsetReporter(CancelableProgressable reporter) (package private) voidsetStatus(MonitoredTask status) voidStart the threads that will pump data from the entryBuffers to the output files.protected final voidSet status message inMonitoredTaskinstance that is set in this OutputSink
-
Field Details
-
LOG
-
controller
-
entryBuffers
-
writerThreads
-
numThreads
-
reporter
-
totalSkippedEdits
-
splits
List of all the files produced by this sink -
status
-
closeThreadPool
Used when close this output sink. -
closeCompletionService
-
-
Constructor Details
-
OutputSink
public OutputSink(WALSplitter.PipelineController controller, EntryBuffers entryBuffers, int numWriters)
-
-
Method Details
-
setReporter
-
setStatus
-
startWriterThreads
Start the threads that will pump data from the entryBuffers to the output files.- Throws:
IOException
-
restartWriterThreadsIfNeeded
-
finishWriterThreads
Wait for writer threads to dump all info to the sink- Returns:
- true when there is no error
- Throws:
IOException
-
getTotalSkippedEdits
long getTotalSkippedEdits() -
getNumOpenWriters
Returns the number of currently opened writers -
append
- Parameters:
buffer- A buffer of some number of edits for a given region.- Throws:
IOException- For any IO errors
-
close
- Throws:
IOException
-
getOutputCounts
Returns a map from encoded region ID to the number of edits written out for that region. -
getNumberOfRecoveredRegions
Returns number of regions we've recovered -
keepRegionEvent
Some WALEdit's contain only KV's for account on what happened to a region. Not all sinks will want to get all of those edits.- Returns:
- Return true if this sink wants to accept this region-level WALEdit.
-
updateStatusWithMsg
Set status message inMonitoredTaskinstance that is set in this OutputSink- Parameters:
msg- message to update the status with
-