Skip to content

[kafka] Handle basic Produce requests independently of storage - #4284

Draft
gyang94 wants to merge 6 commits into
apache:mainfrom
gyang94:codex/kafka-produce-protocol
Draft

[kafka] Handle basic Produce requests independently of storage#4284
gyang94 wants to merge 6 commits into
apache:mainfrom
gyang94:codex/kafka-produce-protocol

Conversation

@gyang94

@gyang94 gyang94 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Closes #4281. Part of #4185.

Implement non-idempotent Produce v3-v11 with a narrow backend contract. Validate acknowledgements, topic/partition identities and record batches; isolate invalid partitions, preserve response order and copy record data independently of the network buffer.

This is PR05, depending on #4261 (PR04 Metadata).

Brief change log

  • Valid requests preserve records, headers, listener context, acks and timeout.
  • Invalid batches and topics do not suppress valid partitions in the same request.
  • Transactional/idempotent/control batches and duplicate partition entries are rejected.
  • acks=0 emits no response and releases the request buffer on success and failure.
  • Production ApiVersions continues to expose only the existing capabilities until append is integrated.

Incremental scope: 5 files, +987 / -0 (621 implementation and 366 test lines). The implementation contract and its failure-path tests are kept together as one review unit; the line count includes Javadoc and license headers.

Tests

Java 11 at 936fd3f39e9e6fe595ed6bf8e30f0e2b5185ffe3:

  • mvn -o -pl fluss-kafka spotless:apply clean verify: 69 unit tests and 2 integration tests passed.
  • Checkstyle, Spotless, RAT and git diff --check passed.
  • The two existing integration tests cover Kafka transport and native DDL mapping; this stage does not activate production Produce.

The full repository test suite and Flink SQL runtime were not run.

API and Format

Adds independently testable non-idempotent Produce v3-v11 handling. Production API registration, native conversion and append follow in the later PRs.

Stack and review

Draft while prerequisites are unmerged. The PR targets Apache main, so the full Files changed view includes prerequisites. Use this incremental comparison to review this stage alone.

Generative AI disclosure: Codex assisted with extraction, implementation, tests and commit organization. Human review is required before merge.

gyang94 and others added 6 commits September 9, 2026 14:04
Introduce API registration, request context, version validation, and
asynchronous error mapping. Fix request buffer ownership and response
serialization cleanup while preserving the existing ApiVersions entry point.

Validated with mvn -o -pl fluss-rpc,fluss-kafka verify.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 555/555
AI-Contributed/UT: 525/525
Route requests through the dispatcher and advertise only implemented APIs.
Return version-aware errors for unsupported APIs and invalid requests.

Validated with mvn -o -pl fluss-kafka verify (23 unit tests and 1 IT).

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 313/313
AI-Contributed/UT: 137/137
Add Metadata v0-v11 handling over pre-created Fluss tables, with listener-aware
gateway access, table/topic mapping, partition metadata, and error handling.
Do not implement CreateTopics, DeleteTopics, or automatic table creation.

Honor authoritative ISR values when bucket epochs are present. For legacy
metadata without an epoch, conservatively report only an available leader.

Verified fluss-kafka: 37 unit tests and 1 integration test, with Spotless and
Checkstyle passing. Rebuilt the matching RPC dependency from the same base.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 909/909
AI-Contributed/UT: 540/540
Extract topic identity and the raw/string table mapping contract before Metadata. Validate table kinds, field projections and metadata columns independently of request handling and record decoding.

Validation: Java 11, mvn -o -pl fluss-kafka clean verify (47 unit tests and 2 integration tests); Checkstyle, Spotless and RAT passed.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 769/769
AI-Contributed/UT: 480/480
Integrate the DDL mapping prerequisite and use its resolver for Metadata discovery. Omit unsupported tables from all-topic queries and return per-topic mapping errors for named queries. Preserve metadata for compatible tables in mixed requests.

Validation: Java 11, mvn -o -pl fluss-kafka clean verify (62 unit tests and 2 integration tests); Checkstyle, Spotless and RAT passed.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 742/742
AI-Contributed/UT: 571/571
Validate non-idempotent Produce v3-v11 and isolate invalid partitions before invoking a protocol-independent backend. Preserve partition order, acknowledgements and owned record data. Leave production registration to the append integration PR.

Validation: Java 11, mvn -o -pl fluss-kafka spotless:apply clean verify; 69 unit tests and 2 integration tests passed, including Checkstyle, Spotless and RAT.

Co-Authored-By: Codex <noreply@openai.com>
AI-Model: gpt-6
AI-Contributed/Feature: 621/621
AI-Contributed/UT: 366/366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[kafka] Handle basic Produce requests independently of storage

1 participant