1
0

[HUDI-2352] The upgrade downgrade action of flink writer should be singleton (#3531)

This commit is contained in:
Danny Chan
2021-08-25 10:56:14 +08:00
committed by GitHub
parent 04ede8eecf
commit a60fab3a5c
2 changed files with 12 additions and 0 deletions

View File

@@ -399,6 +399,17 @@ public class HoodieFlinkWriteClient<T extends HoodieRecordPayload> extends
}
}
/**
* Upgrade downgrade the Hoodie table.
*
* <p>This action should only be executed once for each commit.
* The modification of the table properties is not thread safe.
*/
public void upgradeDowngrade(String instantTime) {
HoodieTableMetaClient metaClient = createMetaClient(true);
new FlinkUpgradeDowngrade(metaClient, config, context).run(metaClient, HoodieTableVersion.current(), config, context, instantTime);
}
/**
* Clean the write handles within a checkpoint interval.
* All the handles should have been closed already.

View File

@@ -335,6 +335,7 @@ public class StreamWriteOperatorCoordinator
this.writeClient.startCommitWithTime(instant, tableState.commitAction);
this.instant = instant;
this.writeClient.transitionRequestedToInflight(tableState.commitAction, this.instant);
this.writeClient.upgradeDowngrade(this.instant);
LOG.info("Create instant [{}] for table [{}] with type [{}]", this.instant,
this.conf.getString(FlinkOptions.TABLE_NAME), conf.getString(FlinkOptions.TABLE_TYPE));
}