Class CombinedWriterBase<T extends WALProvider.WriterBase>
java.lang.Object
org.apache.hadoop.hbase.regionserver.wal.CombinedWriterBase<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,WALProvider.WriterBase
- Direct Known Subclasses:
CombinedAsyncWriter
,CombinedWriter
@Private
public class CombinedWriterBase<T extends WALProvider.WriterBase>
extends Object
implements WALProvider.WriterBase
Base class for combined wal writer implementations.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
CombinedWriterBase
(org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<T> writers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
long
long
NOTE: We add this method forWALFileLengthProvider
used for replication, considering the case if we useAsyncFSWAL
,we write to 3 DNs concurrently, according to the visibility guarantee of HDFS, the data will be available immediately when arriving at DN since all the DNs will be considered as the last one in pipeline.
-
Field Details
-
LOG
-
writers
protected final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<T extends WALProvider.WriterBase> writers
-
-
Constructor Details
-
CombinedWriterBase
protected CombinedWriterBase(org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<T> writers)
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getLength
- Specified by:
getLength
in interfaceWALProvider.WriterBase
-
getSyncedLength
Description copied from interface:WALProvider.WriterBase
NOTE: We add this method forWALFileLengthProvider
used for replication, considering the case if we useAsyncFSWAL
,we write to 3 DNs concurrently, according to the visibility guarantee of HDFS, the data will be available immediately when arriving at DN since all the DNs will be considered as the last one in pipeline. This means replication may read uncommitted data and replicate it to the remote cluster and cause data inconsistency. The methodWALProvider.WriterBase.getLength()
may return length which just in hdfs client buffer and not successfully synced to HDFS, so we use this method to return the length successfully synced to HDFS and replication thread could only read writing WAL file limited by this length. see also HBASE-14004 and this document for more details: https://docs.google.com/document/d/11AyWtGhItQs6vsLRIx32PwTxmBY3libXwGXI25obVEY/edit#- Specified by:
getSyncedLength
in interfaceWALProvider.WriterBase
- Returns:
- byteSize successfully synced to underlying filesystem.
-