{"record":{"id":"ed7fd5831210ba7d","repo":"apache/iceberg","slug":"writersink-is-used-only-for-writing-committing-is-ed7fd5","errorCode":null,"errorMessage":"WriterSink is used only for writing; committing is handled by the main sink","messagePattern":"WriterSink is used only for writing; committing is handled by the main sink","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicIcebergSink.java","lineNumber":219,"sourceCode":"      this.flinkConfig = flinkConfig;\n      this.cacheMaximumSize = cacheMaximumSize;\n    }\n\n    @Override\n    public SinkWriter<DynamicRecordInternal> createWriter(WriterInitContext context) {\n      return new DynamicWriter(\n          catalogLoader.loadCatalog(),\n          writeProperties,\n          flinkConfig,\n          cacheMaximumSize,\n          new DynamicWriterMetrics(context.metricGroup()),\n          context.getTaskInfo().getIndexOfThisSubtask(),\n          context.getTaskInfo().getAttemptNumber());\n    }\n\n    @Override\n    public Committer<DynamicWriteResult> createCommitter(CommitterInitContext context) {\n      throw new UnsupportedOperationException(\n          \"WriterSink is used only for writing; committing is handled by the main sink\");\n    }\n\n    @Override\n    public SimpleVersionedSerializer<DynamicWriteResult> getCommittableSerializer() {\n      return new DynamicWriteResultSerializer();\n    }\n  }\n\n  public static class Builder<T> {\n    private DataStream<T> input;\n    private DynamicRecordGenerator<T> generator;\n    private CatalogLoader catalogLoader;\n    private String uidPrefix = null;\n    private final Map<String, String> writeOptions = Maps.newHashMap();\n    private final Map<String, String> snapshotSummary = Maps.newHashMap();\n    private ReadableConfig readableConfig = new Configuration();\n    private TableCreator tableCreator = TableCreator.DEFAULT;","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicIcebergSink.java#L201-L237","documentation":"DynamicIcebergSink's WriterSink is a write-only topology; committing is performed by a separate main sink operator. Its createCommitter always throws UnsupportedOperationException because a committer is intentionally not provided for the writer sub-job.","triggerScenarios":"Calling createCommitter on the writer sink's sink provider — e.g. misconfiguring the sink so Flink tries to instantiate a committer for the WriterSink branch, or calling the method directly in custom code.","commonSituations":"Custom sink topology wiring that expects the writer to also commit; framework changes that probe createCommitter unconditionally.","solutions":["Use the main DynamicIcebergSink's committer path for committing; do not wire the WriterSink as a committing sink.","If integrating programmatically, only invoke createCommitter on the committer sink's provider, not the writer's.","Guard custom code with a check of which sink branch is being configured before requesting a committer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (sinkProvider instanceof WriterSinkProvider) { throw new IllegalStateException(\"WriterSink cannot commit; use the main sink's committer\"); }","typeGuard":null,"tryCatchPattern":"try { provider.createCommitter(ctx); } catch (UnsupportedOperationException e) { /* route to the main DynamicIcebergSink committer instead */ }","preventionTips":["Wire committing only through the main DynamicIcebergSink","Do not call createCommitter on the writer branch","Keep custom topology code aware of the writer/committer split"],"tags":["flink","sink","unsupported-operation"],"backgroundTag":"method-not-implemented","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}