public class CompactionUtil extends Object
| Constructor and Description |
|---|
CompactionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Option<String> |
getCompactionInstantTime(HoodieTableMetaClient metaClient)
Gets compaction Instant time.
|
static void |
inferChangelogMode(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
Infers the changelog mode based on the data file schema(including metadata fields).
|
static void |
inferMetadataConf(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
Infers the metadata config based on the existence of metadata folder.
|
static boolean |
isLIFO(String seq)
Returns whether the execution sequence is LIFO.
|
static void |
rollbackCompaction(HoodieFlinkTable<?> table)
Force rolls back all the inflight compaction instants, especially for job failover restart.
|
static void |
rollbackCompaction(HoodieFlinkTable<?> table,
String instantTime) |
static void |
rollbackEarliestCompaction(HoodieFlinkTable<?> table,
org.apache.flink.configuration.Configuration conf)
Rolls back the earliest compaction if there exists.
|
static void |
scheduleCompaction(HoodieTableMetaClient metaClient,
HoodieFlinkWriteClient<?> writeClient,
boolean deltaTimeCompaction,
boolean committed)
Schedules a new compaction instant.
|
static void |
setAvroSchema(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
Sets up the avro schema string into the give configuration
conf
through reading from the hoodie table metadata. |
static void |
setAvroSchema(HoodieWriteConfig writeConfig,
HoodieTableMetaClient metaClient)
Sets up the avro schema string into the HoodieWriteConfig
HoodieWriteConfig
through reading from the hoodie table metadata. |
static void |
setPreCombineField(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
Sets up the preCombine field into the given configuration
conf
through reading from the hoodie table metadata. |
public static void scheduleCompaction(HoodieTableMetaClient metaClient, HoodieFlinkWriteClient<?> writeClient, boolean deltaTimeCompaction, boolean committed)
metaClient - The metadata clientwriteClient - The write clientdeltaTimeCompaction - Whether the compaction is trigger by elapsed delta timecommitted - Whether the last instant was committed successfullypublic static Option<String> getCompactionInstantTime(HoodieTableMetaClient metaClient)
public static void setAvroSchema(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
throws Exception
conf
through reading from the hoodie table metadata.conf - The configurationExceptionpublic static void setAvroSchema(HoodieWriteConfig writeConfig, HoodieTableMetaClient metaClient) throws Exception
HoodieWriteConfig
through reading from the hoodie table metadata.writeConfig - The HoodieWriteConfigExceptionpublic static void setPreCombineField(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
conf
through reading from the hoodie table metadata.
This value is non-null as compaction can only be performed on MOR tables. Of which, MOR tables will have non-null precombine fields.
conf - The configurationpublic static void inferChangelogMode(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
We can improve the code if the changelog mode is set up as table config.
conf - The configurationmetaClient - The meta clientpublic static void inferMetadataConf(org.apache.flink.configuration.Configuration conf,
HoodieTableMetaClient metaClient)
We can improve the code if the metadata config is set up as table config.
conf - The configurationmetaClient - The meta clientpublic static void rollbackCompaction(HoodieFlinkTable<?> table, String instantTime)
public static void rollbackCompaction(HoodieFlinkTable<?> table)
table - The hoodie tablepublic static void rollbackEarliestCompaction(HoodieFlinkTable<?> table, org.apache.flink.configuration.Configuration conf)
Makes the strategy not that radical: firstly check whether there exists inflight compaction instants, rolls back the first inflight instant only if it has timed out. That means, if there are multiple timed out instants on the timeline, we only roll back the first one at a time.
public static boolean isLIFO(String seq)
Copyright © 2023 The Apache Software Foundation. All rights reserved.