@InterfaceAudience.Private public abstract class OutputSink extends Object
Modifier and Type | Class and Description |
---|---|
static class |
OutputSink.WriterThread |
Modifier and Type | Field and Description |
---|---|
protected CompletionService<Void> |
closeCompletionService |
protected ThreadPoolExecutor |
closeThreadPool
Used when close this output sink.
|
private WALSplitter.PipelineController |
controller |
protected EntryBuffers |
entryBuffers |
private static org.slf4j.Logger |
LOG |
protected int |
numThreads |
protected CancelableProgressable |
reporter |
protected List<org.apache.hadoop.fs.Path> |
splits
List of all the files produced by this sink
|
protected MonitoredTask |
status |
protected AtomicLong |
totalSkippedEdits |
private List<OutputSink.WriterThread> |
writerThreads |
Constructor and Description |
---|
OutputSink(WALSplitter.PipelineController controller,
EntryBuffers entryBuffers,
int numWriters) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
append(EntryBuffers.RegionEntryBuffer buffer) |
protected abstract List<org.apache.hadoop.fs.Path> |
close() |
protected boolean |
finishWriterThreads(boolean interrupt)
Wait for writer threads to dump all info to the sink
|
protected abstract int |
getNumberOfRecoveredRegions()
Returns number of regions we've recovered
|
protected abstract int |
getNumOpenWriters()
Returns the number of currently opened writers
|
protected abstract Map<String,Long> |
getOutputCounts()
Returns a map from encoded region ID to the number of edits written out for that region.
|
(package private) long |
getTotalSkippedEdits() |
protected abstract boolean |
keepRegionEvent(WAL.Entry entry)
Some WALEdit's contain only KV's for account on what happened to a region.
|
void |
restartWriterThreadsIfNeeded() |
(package private) void |
setReporter(CancelableProgressable reporter) |
(package private) void |
setStatus(MonitoredTask status) |
void |
startWriterThreads()
Start the threads that will pump data from the entryBuffers to the output files.
|
protected void |
updateStatusWithMsg(String msg)
Set status message in
MonitoredTask instance that is set in this OutputSink |
private static final org.slf4j.Logger LOG
private final WALSplitter.PipelineController controller
protected final EntryBuffers entryBuffers
private final List<OutputSink.WriterThread> writerThreads
protected final int numThreads
protected CancelableProgressable reporter
protected final AtomicLong totalSkippedEdits
protected final List<org.apache.hadoop.fs.Path> splits
protected MonitoredTask status
protected final ThreadPoolExecutor closeThreadPool
protected final CompletionService<Void> closeCompletionService
public OutputSink(WALSplitter.PipelineController controller, EntryBuffers entryBuffers, int numWriters)
void setReporter(CancelableProgressable reporter)
void setStatus(MonitoredTask status)
public void startWriterThreads() throws IOException
IOException
public void restartWriterThreadsIfNeeded()
protected boolean finishWriterThreads(boolean interrupt) throws IOException
IOException
long getTotalSkippedEdits()
protected abstract int getNumOpenWriters()
protected abstract void append(EntryBuffers.RegionEntryBuffer buffer) throws IOException
buffer
- A buffer of some number of edits for a given region.IOException
- For any IO errorsprotected abstract List<org.apache.hadoop.fs.Path> close() throws IOException
IOException
protected abstract Map<String,Long> getOutputCounts()
protected abstract int getNumberOfRecoveredRegions()
protected abstract boolean keepRegionEvent(WAL.Entry entry)
protected final void updateStatusWithMsg(String msg)
MonitoredTask
instance that is set in this OutputSinkmsg
- message to update the status withCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.