public abstract class HoodieLogBlock extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HoodieLogBlock.FooterMetadataType
Log Metadata footers abstraction for a HoodieLogBlock WARNING : This enum is serialized as the ordinal.
|
static class |
HoodieLogBlock.HeaderMetadataType
Log Metadata headers abstraction for a HoodieLogBlock WARNING : This enum is serialized as the ordinal.
|
static class |
HoodieLogBlock.HoodieLogBlockContentLocation
This class is used to store the Location of the Content of a Log Block.
|
static class |
HoodieLogBlock.HoodieLogBlockType
Type of the log block WARNING: This enum is serialized as the ordinal.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
readBlockLazily |
static int |
version
The current version of the log block.
|
| Constructor and Description |
|---|
HoodieLogBlock(Map<HoodieLogBlock.HeaderMetadataType,String> logBlockHeader,
Map<HoodieLogBlock.HeaderMetadataType,String> logBlockFooter,
Option<HoodieLogBlock.HoodieLogBlockContentLocation> blockContentLocation,
Option<byte[]> content,
Supplier<SeekableDataInputStream> inputStreamSupplier,
boolean readBlockLazily) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addRecordPositionsToHeader(Set<Long> positionSet,
int numRecords) |
protected void |
deflate()
After the content bytes is converted into the required DataStructure by a logBlock, deflate the content to release
byte [] and relieve memory pressure when GC kicks in.
|
Option<HoodieLogBlock.HoodieLogBlockContentLocation> |
getBlockContentLocation() |
abstract HoodieLogBlock.HoodieLogBlockType |
getBlockType() |
Option<byte[]> |
getContent() |
byte[] |
getContentBytes(HoodieStorage storage) |
Map<HoodieLogBlock.HeaderMetadataType,String> |
getLogBlockFooter() |
Map<HoodieLogBlock.HeaderMetadataType,String> |
getLogBlockHeader() |
long |
getLogBlockLength() |
static Map<HoodieLogBlock.HeaderMetadataType,String> |
getLogMetadata(SeekableDataInputStream dis)
Convert bytes to LogMetadata, follow the same order as
getLogMetadataBytes(java.util.Map<org.apache.hudi.common.table.log.block.HoodieLogBlock.HeaderMetadataType, java.lang.String>). |
static byte[] |
getLogMetadataBytes(Map<HoodieLogBlock.HeaderMetadataType,String> metadata)
Convert log metadata to bytes 1.
|
byte[] |
getMagic() |
org.roaringbitmap.longlong.Roaring64NavigableMap |
getRecordPositions() |
protected void |
inflate()
When lazyReading of blocks is turned on, inflate the content of a log block from disk.
|
boolean |
isCompactedLogBlock()
Compacted blocks are created using log compaction which basically merges the consecutive blocks together and create
huge block with all the changes.
|
static Option<byte[]> |
tryReadContent(SeekableDataInputStream inputStream,
Integer contentLength,
boolean readLazily)
Read or Skip block content of a log block in the log file.
|
public static int version
HoodieLogBlockVersion TODO : Change this to a class, something
like HoodieLogBlockVersionV1/V2 and implement/override operations there
Current log block version is V3.protected boolean readBlockLazily
public HoodieLogBlock(@Nonnull Map<HoodieLogBlock.HeaderMetadataType,String> logBlockHeader, @Nonnull Map<HoodieLogBlock.HeaderMetadataType,String> logBlockFooter, @Nonnull Option<HoodieLogBlock.HoodieLogBlockContentLocation> blockContentLocation, @Nonnull Option<byte[]> content, @Nullable Supplier<SeekableDataInputStream> inputStreamSupplier, boolean readBlockLazily)
public byte[] getContentBytes(HoodieStorage storage) throws IOException
IOExceptionpublic byte[] getMagic()
public abstract HoodieLogBlock.HoodieLogBlockType getBlockType()
public long getLogBlockLength()
public Option<HoodieLogBlock.HoodieLogBlockContentLocation> getBlockContentLocation()
public Map<HoodieLogBlock.HeaderMetadataType,String> getLogBlockHeader()
public Map<HoodieLogBlock.HeaderMetadataType,String> getLogBlockFooter()
public Option<byte[]> getContent()
public boolean isCompactedLogBlock()
public org.roaringbitmap.longlong.Roaring64NavigableMap getRecordPositions()
throws IOException
Roaring64NavigableMap bitmap containing the record positions in long type
if the HoodieLogBlock.HeaderMetadataType.RECORD_POSITIONS block header exists; otherwise, an empty
Roaring64NavigableMap bitmap.IOException - upon I/O error.protected void addRecordPositionsToHeader(Set<Long> positionSet, int numRecords)
public static byte[] getLogMetadataBytes(Map<HoodieLogBlock.HeaderMetadataType,String> metadata) throws IOException
IOExceptionpublic static Map<HoodieLogBlock.HeaderMetadataType,String> getLogMetadata(SeekableDataInputStream dis) throws IOException
getLogMetadataBytes(java.util.Map<org.apache.hudi.common.table.log.block.HoodieLogBlock.HeaderMetadataType, java.lang.String>).IOExceptionpublic static Option<byte[]> tryReadContent(SeekableDataInputStream inputStream, Integer contentLength, boolean readLazily) throws IOException
HoodieMergedLogRecordScannerIOExceptionprotected void inflate()
throws HoodieIOException
HoodieIOExceptionprotected void deflate()
Copyright © 2024 The Apache Software Foundation. All rights reserved.