bryanck commented on code in PR #12372: URL: https://github.com/apache/iceberg/pull/12372#discussion_r1966908971
########## kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java: ########## @@ -46,26 +45,31 @@ public String version() { @Override public void start(Map<String, String> props) { this.config = new IcebergSinkConfig(props); + catalog = CatalogUtils.loadCatalog(config); + committer = CommitterFactory.createCommitter(catalog, config, context); } @Override public void open(Collection<TopicPartition> partitions) { - Preconditions.checkArgument(catalog == null, "Catalog already open"); - Preconditions.checkArgument(committer == null, "Committer already open"); - - catalog = CatalogUtils.loadCatalog(config); - committer = CommitterFactory.createCommitter(config); - committer.start(catalog, config, context); + if(committer.isLeader(partitions)) { + committer.start(ResourceType.COORDINATOR); + } + committer.syncLastCommittedOffsets(); } @Override public void close(Collection<TopicPartition> partitions) { - close(); + // We need to close worker here in every case to ensure exactly once. + committer.stop(ResourceType.WORKER); + if(committer.isLeader(partitions)) { Review Comment: The name `isLeader` now that it has been reworked, we should rename 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org