From 01f6e845135469b90fad4962b846e549a3bcea6f Mon Sep 17 00:00:00 2001 From: Yash Mayya Date: Sat, 1 Jul 2023 16:16:03 +0530 Subject: [PATCH 1/2] KAFKA-15091: Fix misleading Javadoc for SourceTask::commit --- .../java/org/apache/kafka/connect/source/SourceTask.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java b/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java index 6ce3c25dc21e5..fab9067a1f2fe 100644 --- a/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java +++ b/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java @@ -105,9 +105,11 @@ public void initialize(SourceTaskContext context) { public abstract List poll() throws InterruptedException; /** - *

- * Commit the offsets, up to the offsets that have been returned by {@link #poll()}. This - * method should block until the commit is complete. + * This method is invoked periodically when offsets are committed for this source task. Note that the offsets + * being committed won't necessarily correspond to the latest offsets returned by this source task via + * {@link #poll()}. When exactly-once support is disabled, offsets are committed periodically and asynchronously + * (i.e. on a separate thread from the one which calls {@link #poll()}). When exactly-once support is enabled, + * offsets are committed on transaction commits (also see {@link TransactionBoundary}). *

* SourceTasks are not required to implement this functionality; Kafka Connect will record offsets * automatically. This hook is provided for systems that also need to store offsets internally From 37232c3b835da18ff4ee46e562068731fb88010b Mon Sep 17 00:00:00 2001 From: Yash Mayya Date: Fri, 14 Jul 2023 17:22:33 +0530 Subject: [PATCH 2/2] Remove difference between EoS and non-EoS; add reference to SourceTask::commitRecord --- .../java/org/apache/kafka/connect/source/SourceTask.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java b/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java index fab9067a1f2fe..abe3e36bf1e76 100644 --- a/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java +++ b/connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java @@ -107,9 +107,8 @@ public void initialize(SourceTaskContext context) { /** * This method is invoked periodically when offsets are committed for this source task. Note that the offsets * being committed won't necessarily correspond to the latest offsets returned by this source task via - * {@link #poll()}. When exactly-once support is disabled, offsets are committed periodically and asynchronously - * (i.e. on a separate thread from the one which calls {@link #poll()}). When exactly-once support is enabled, - * offsets are committed on transaction commits (also see {@link TransactionBoundary}). + * {@link #poll()}. Also see {@link #commitRecord(SourceRecord, RecordMetadata)} which allows for a more + * fine-grained tracking of records that have been successfully delivered. *

* SourceTasks are not required to implement this functionality; Kafka Connect will record offsets * automatically. This hook is provided for systems that also need to store offsets internally