{"record":{"id":"4ebd9e66f719b753","repo":"apache/iceberg","slug":"the-method-stop-is-deprecated-and-will-be-remove","errorCode":null,"errorMessage":"The method stop() is deprecated and will be removed in 2.0.0. Use stop(Collection<TopicPartition>) instead.","messagePattern":"The method stop\\(\\) is deprecated and will be removed in 2\\.0\\.0\\. Use stop\\(Collection<TopicPartition>\\) instead\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java","lineNumber":155,"sourceCode":"            + \"Use start(Catalog, IcebergSinkConfig, SinkTaskContext, Collection<TopicPartition>) instead.\");\n  }\n\n  @Override\n  public void open(\n      Catalog icebergCatalog,\n      IcebergSinkConfig icebergSinkConfig,\n      SinkTaskContext sinkTaskContext,\n      Collection<TopicPartition> addedPartitions) {\n    initialize(icebergCatalog, icebergSinkConfig, sinkTaskContext);\n    if (hasLeaderPartition(addedPartitions)) {\n      LOG.info(\"Committer {} received leader partition. Starting Coordinator.\", taskId);\n      startCoordinator();\n    }\n  }\n\n  @Override\n  public void stop() {\n    throw new UnsupportedOperationException(\n        \"The method stop() is deprecated and will be removed in 2.0.0. \"\n            + \"Use stop(Collection<TopicPartition>) instead.\");\n  }\n\n  @Override\n  public void close(Collection<TopicPartition> closedPartitions) {\n    // Always try to stop the worker to avoid duplicates.\n    stopWorker();\n\n    // Defensive: close called without prior initialization (should not happen).\n    if (!isInitialized.get()) {\n      LOG.warn(\"Close unexpectedly called on committer {} without partition assignment\", taskId);\n      return;\n    }\n\n    // Empty partitions → task was stopped explicitly. Stop coordinator if running.\n    if (closedPartitions.isEmpty()) {\n      LOG.info(\"Committer {} stopped. Closing coordinator.\", taskId);","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java#L137-L173","documentation":"CommitterImpl.stop() with no arguments is the deprecated lifecycle hook and now throws UnsupportedOperationException unconditionally. Stopping the committer requires knowing which partitions are closing so in-flight coordinator work can be drained correctly; callers must migrate to stop(Collection<TopicPartition>).","triggerScenarios":"Kafka Connect calls the parameterless Committer.stop() when pausing or shutting down the sink task, instead of stop(Collection<TopicPartition>) with the set of closed partitions.","commonSituations":"Version mismatch between the Kafka Connect runtime and the Iceberg sink connector's Committer interface; custom task wrappers calling stop() directly during task rebalance or connector teardown.","solutions":["Call stop(Collection<TopicPartition>) with the partitions being closed in this rebalance/shutdown.","Align the Kafka Connect runtime version with the Iceberg sink connector so the framework uses the partition-aware stop overload.","Update any custom code wrapping CommitterImpl to pass closedPartitions through instead of the no-arg stop()."],"exampleFix":"// before\ncommitter.stop();\n\n// after\ncommitter.stop(closedPartitions);","handlingStrategy":"validation","validationCode":"// Java\nif (closedPartitions == null) {\n  throw new IllegalArgumentException(\"closedPartitions required: use stop(Collection<TopicPartition>)\");\n}\ncommitter.stop(closedPartitions);","typeGuard":null,"tryCatchPattern":"try { committer.stop(closedPartitions); } catch (UnsupportedOperationException e) { throw new IllegalStateException(\"Legacy stop() invoked — update task wrapper\", e); }","preventionTips":["Pass the partitions being closed from SinkTaskContext into the committer's stop","Update custom task wrappers whenever the Committer interface gains overloads","Keep kafka-clients/Iceberg connector versions consistent to avoid the framework calling removed hooks"],"tags":["kafka-connect","deprecated-api","unsupported-operation","lifecycle"],"backgroundTag":"deprecated-api-usage","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}