Guosmilesmile commented on code in PR #17251:
URL: https://github.com/apache/iceberg/pull/17251#discussion_r3595142097
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergCommitter.java:
##########
@@ -88,31 +89,43 @@ class IcebergCommitter implements
Committer<IcebergCommittable> {
int workerPoolSize,
String sinkId,
IcebergFilesCommitterMetrics committerMetrics,
- boolean tableMaintenanceEnabled) {
+ boolean tableMaintenanceEnabled,
+ int subtaskId) {
this.branch = branch;
this.snapshotProperties = snapshotProperties;
this.replacePartitions = replacePartitions;
this.committerMetrics = committerMetrics;
this.tableLoader = tableLoader;
- if (!tableLoader.isOpen()) {
- tableLoader.open();
+ this.tableMaintenanceEnabled = tableMaintenanceEnabled;
+ this.subtaskId = subtaskId;
+
+ if (subtaskId == 0) {
+ if (!tableLoader.isOpen()) {
+ tableLoader.open();
+ }
+
+ this.table = tableLoader.loadTable();
+ this.maxContinuousEmptyCommits =
+ PropertyUtil.propertyAsInt(table.properties(),
MAX_CONTINUOUS_EMPTY_COMMITS, 10);
+ Preconditions.checkArgument(
+ maxContinuousEmptyCommits > 0, MAX_CONTINUOUS_EMPTY_COMMITS + " must
be positive");
+ this.workerPool =
+ ThreadPools.newFixedThreadPool(
+ "iceberg-committer-pool-" + table.name() + "-" + sinkId,
workerPoolSize);
Review Comment:
Right, add comment on it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]