Class WALUtil
java.lang.Object
org.apache.hadoop.hbase.regionserver.wal.WALUtil
Helper methods to ease Region Server integration with the Write Ahead Log (WAL). Note that
methods in this class specifically should not require access to anything other than the API found
in
WAL
. For internal use only.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic WALKeyImpl
createWALKey
(RegionInfo hri, MultiVersionConcurrencyControl mvcc, NavigableMap<byte[], Integer> replicationScope, Map<String, byte[]> extendedAttributes) private static WALKeyImpl
doFullMarkerAppendTransaction
(WAL wal, NavigableMap<byte[], Integer> replicationScope, RegionInfo hri, WALEdit edit, MultiVersionConcurrencyControl mvcc, Map<String, byte[]> extendedAttributes, boolean sync, RegionReplicationSink sink) A 'full' WAL transaction involves starting an mvcc transaction followed by an append, an optional sync, and then a call to complete the mvcc transaction.static void
filterCells
(WALEdit edit, Function<Cell, Cell> mapper) static long
getWALBlockSize
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) Blocksize returned here is 2x the default HDFS blocksize unless explicitly set in Configuration.static long
getWALBlockSize
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, boolean isRecoverEdits) Public because of FSHLog.static WALKeyImpl
writeBulkLoadMarkerAndSync
(WAL wal, NavigableMap<byte[], Integer> replicationScope, RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor desc, MultiVersionConcurrencyControl mvcc, RegionReplicationSink sink) Write a log marker that a bulk load has succeeded and is about to be committed.static WALKeyImpl
writeCompactionMarker
(WAL wal, NavigableMap<byte[], Integer> replicationScope, RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor c, MultiVersionConcurrencyControl mvcc, RegionReplicationSink sink) Write the marker that a compaction has succeeded and is about to be committed.static WALKeyImpl
writeFlushMarker
(WAL wal, NavigableMap<byte[], Integer> replicationScope, RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor f, boolean sync, MultiVersionConcurrencyControl mvcc, RegionReplicationSink sink) Write a flush marker indicating a start / abort or a complete of a region flushprivate static WALKeyImpl
writeMarker
(WAL wal, NavigableMap<byte[], Integer> replicationScope, RegionInfo hri, WALEdit edit, MultiVersionConcurrencyControl mvcc, Map<String, byte[]> extendedAttributes, RegionReplicationSink sink) static WALKeyImpl
writeRegionEventMarker
(WAL wal, NavigableMap<byte[], Integer> replicationScope, RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor r, MultiVersionConcurrencyControl mvcc, RegionReplicationSink sink) Write a region open marker indicating that the region is opened.static void
writeReplicationMarkerAndSync
(WAL wal, MultiVersionConcurrencyControl mvcc, RegionInfo regionInfo, byte[] rowKey, long timestamp)
-
Field Details
-
LOG
-
WAL_BLOCK_SIZE
- See Also:
-
-
Constructor Details
-
WALUtil
private WALUtil()
-
-
Method Details
-
getWALBlockSize
public static long getWALBlockSize(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException Blocksize returned here is 2x the default HDFS blocksize unless explicitly set in Configuration. Works in tandem with hbase.regionserver.logroll.multiplier. See comment in AbstractFSWAL in Constructor where we set blocksize and logrollsize for why.- Returns:
- Blocksize to use writing WALs.
- Throws:
IOException
-
getWALBlockSize
public static long getWALBlockSize(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, boolean isRecoverEdits) throws IOException Public because of FSHLog. Should be package-private- Parameters:
isRecoverEdits
- the created writer is for recovered edits or WAL. For recovered edits, it is true and for WAL it is false.- Throws:
IOException
-
filterCells
-
writeReplicationMarkerAndSync
public static void writeReplicationMarkerAndSync(WAL wal, MultiVersionConcurrencyControl mvcc, RegionInfo regionInfo, byte[] rowKey, long timestamp) throws IOException - Throws:
IOException