[HUDI-2551] Support DefaultHoodieRecordPayload for flink (#3792)
This commit is contained in:
@@ -100,7 +100,7 @@ public class FlinkOptions extends HoodieConfig {
|
||||
public static final ConfigOption<Integer> METADATA_COMPACTION_DELTA_COMMITS = ConfigOptions
|
||||
.key("metadata.compaction.delta_commits")
|
||||
.intType()
|
||||
.defaultValue(24)
|
||||
.defaultValue(10)
|
||||
.withDescription("Max delta commits for metadata table to trigger compaction, default 24");
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -129,6 +129,13 @@ public class BootstrapOperator<I, O extends HoodieRecord>
|
||||
WriteOperationType.fromValue(conf.getString(FlinkOptions.OPERATION)),
|
||||
HoodieTableType.valueOf(conf.getString(FlinkOptions.TABLE_TYPE)));
|
||||
|
||||
preLoadIndexRecords();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the index records before {@link #processElement}.
|
||||
*/
|
||||
protected void preLoadIndexRecords() throws Exception {
|
||||
String basePath = hoodieTable.getMetaClient().getBasePath();
|
||||
int taskID = getRuntimeContext().getIndexOfThisSubtask();
|
||||
LOG.info("Start loading records in table {} into the index state, taskId = {}", basePath, taskID);
|
||||
|
||||
@@ -56,6 +56,11 @@ public class BatchBootstrapOperator<I, O extends HoodieRecord>
|
||||
this.haveSuccessfulCommits = StreamerUtil.haveSuccessfulCommits(hoodieTable.getMetaClient());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preLoadIndexRecords() {
|
||||
// no operation
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void processElement(StreamRecord<I> element) throws Exception {
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.apache.hudi.common.util.ReflectionUtils;
|
||||
import org.apache.hudi.common.util.ValidationUtils;
|
||||
import org.apache.hudi.config.HoodieCompactionConfig;
|
||||
import org.apache.hudi.config.HoodieMemoryConfig;
|
||||
import org.apache.hudi.config.HoodiePayloadConfig;
|
||||
import org.apache.hudi.config.HoodieStorageConfig;
|
||||
import org.apache.hudi.config.HoodieWriteConfig;
|
||||
import org.apache.hudi.configuration.FlinkOptions;
|
||||
@@ -189,6 +190,10 @@ public class StreamerUtil {
|
||||
.enable(conf.getBoolean(FlinkOptions.METADATA_ENABLED))
|
||||
.withMaxNumDeltaCommitsBeforeCompaction(conf.getInteger(FlinkOptions.METADATA_COMPACTION_DELTA_COMMITS))
|
||||
.build())
|
||||
.withPayloadConfig(HoodiePayloadConfig.newBuilder()
|
||||
.withPayloadOrderingField(conf.getString(FlinkOptions.PRECOMBINE_FIELD))
|
||||
.withPayloadEventTimeField(conf.getString(FlinkOptions.PRECOMBINE_FIELD))
|
||||
.build())
|
||||
.withEmbeddedTimelineServerReuseEnabled(true) // make write client embedded timeline service singleton
|
||||
.withAutoCommit(false)
|
||||
.withAllowOperationMetadataField(conf.getBoolean(FlinkOptions.CHANGELOG_ENABLED))
|
||||
|
||||
Reference in New Issue
Block a user