Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,12 @@ private FlinkOptions() {
.defaultValue(true)
.withDescription("Whether to cleanup the old commits immediately on new commits, enabled by default");

public static final ConfigOption<Boolean> BATCH_CLEAN_ENABLED = ConfigOptions
.key("clean.batch.enabled")
.booleanType()
.defaultValue(false)
.withDescription("Whether to clean the old commits when initial clean function, should only set to true when job is in batch mode");

public static final ConfigOption<String> CLEAN_POLICY = ConfigOptions
.key("clean.policy")
.stringType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void open(Configuration parameters) throws Exception {
this.writeClient = StreamerUtil.createWriteClient(conf, getRuntimeContext());
this.executor = NonThrownExecutor.builder(LOG).waitForTasksFinish(true).build();

if (OptionsResolver.isInsertOverwrite(conf)) {
if (OptionsResolver.isInsertOverwrite(conf) || conf.getBoolean(FlinkOptions.BATCH_CLEAN_ENABLED)) {
String instantTime = HoodieActiveTimeline.createNewInstantTime();
LOG.info(String.format("exec sync clean with instant time %s...", instantTime));
executor.execute(() -> writeClient.clean(instantTime), "wait for sync cleaning finish");
Expand Down