Hello everyone. I'd like to ask a question about exception handling in the connect framework for sink tasks.
I noticed something that appears a bit odd when looking through the code that commits offsets in the WorkerSinkTask, specifically when the task preCommit() is called (currently org/apache/kafka/connect/runtime/WorkerSinkTask.java:444 in the trunk branch). If preCommit() throws an exception, it is assumed that the exception is of such a nature that the correct way to handle it is to rewind to last committed offsets. This is in contrast to how exception handling is done when calling task.put(); there we explicitly check if the exception is a RetriableException and if not we kill the task. Why do we not do something similar when calling task.preCommit() ? I.e. check if any exception is a RetriableException and kill the task if this is not the case. I'd also argue that catching Throwable the way we do is an anti-pattern that is explicitly discouraged in the java documentation, but that's another matter. Regards, Martin
