[Umbrella] Kafka Protocols Compatibility - Basic Produce
Search before asking
- [x] I searched in the issues and found nothing similar.
Motivation
Apache Fluss needs a first Kafka protocol compatibility milestone that allows standard Kafka producers to discover Fluss tables and write records without changing the Kafka client.
The target workflow is DDL-first: users create and manage tables and schemas through Fluss DDL, then produce JSON records through the Kafka protocol. Schema-aware conversion maps records into the pre-defined table schema and existing Fluss storage format. Kafka CreateTopics, DeleteTopics, and automatic table creation are not part of this milestone.
This umbrella is issue-driven: define a focused child issue, link its implementation PR, review it, and then move to the next capability. The foundation and Basic Produce tasks below follow dependency order. The previous four-PR approach has been retired and is not part of the current dependency chain.
Sub-tasks
Child issues describe focused capabilities, with dependency order tracked below. An issue is complete after its implementation is reviewed and merged, not merely after a PR is opened.
Foundation
- [x] #4264 — PR01: Request and transport framework.
- [x] #4265 — PR02: Registry-backed ApiVersions API.
- [x] #4275 — PR03: DDL table mapping contract.
- [x] #4266 — PR04: Metadata API for pre-created Fluss tables.
Review and dependency order: #4264 → #4265 → #4275 → #4266.
Basic Produce
- [x] #4281 — PR05: Produce protocol handling.
- [x] #4282 — PR06: Raw/string record conversion.
- [x] #4283 — PR07: Native append integration.
- [x] #4298 — PR08: Produce lifecycle and replication regressions.
- [x] #4674 — PR09: Separate value decoding and preserve record metadata.
- [x] #4679 — PR10: Convert JSON scalar values to Fluss types.
- [x] #4681 — PR11: Add schema-aware JSON Produce, including complex values and field rescue (merged PR #4682).
- [x] #4683 — PR12: Support complex JSON values in Produce (completed in PR11).
- [x] #4685 — PR13: Preserve unknown fields and failed nullable values in
_kafka_rescue(completed in PR11).
Review and dependency order: #4281 → #4282 → #4283 → #4298 → #4674 → #4679 → #4681.
PR11 was merged with the PR12 and PR13 functionality: recursive ROW/ARRAY/MAP conversion and field rescue. Original PR12 (#4684) and PR13 (#4686) are closed as superseded and are no longer separate steps in the dependency chain.
SASL/PLAIN authentication
- [x] #4860 — Consolidated SASL/PLAIN authentication directly on main (PR #4861).
Earlier scoped tasks, completed by merged PR #4861 and retained for reference:
- [x] #4832 — PR14: Shared PLAIN server configuration and resource lifecycle.
- [x] #4834 — PR15: Per-connection SASL authentication state.
- [x] #4836 — PR16: Authenticated principal propagation to gateway sessions.
- [x] #4838 — PR17: SASL handshake and authentication APIs.
- [x] #4840 — PR18: SASL/PLAIN listener integration.
- [x] #4842 — PR19: SASL/PLAIN end-to-end regression coverage.
The consolidated implementation was merged in #4861, completing the SASL/PLAIN scope above. The original PR14–PR19 are closed as superseded and are no longer part of the dependency chain. The implementation uses main's native Produce integration and was reviewed independently of the JSON/rescue PRs.
Core changes (independent review and merge)
- [x] #3455 — Complete delayed fetch after produce.
Planned follow-ups
Create additional child issues progressively as the scoped foundation and Basic Produce tasks advance. These are directions for later issue scoping, not a commitment to reuse the closed implementation PRs.
JSON decoding performance
- [ ] #4863 — Convert JSON Produce values with Jackson streaming API; follow-up to #4682.
Server role isolation
- [ ] #4859 — Prevent Kafka endpoints from starting on CoordinatorServer.
Delivery
- End-to-end validation of DDL → Metadata → Kafka producer → Fluss readback, including schema handling, acknowledgements, authentication, and failure cases.
- Configuration and compatibility documentation, supported API/version boundaries, DDL/JSON examples, and Fluss RPC/server regression coverage.
Future Work
Outside this Basic Produce milestone:
- Idempotent and transactional Produce.
- Bounded Produce admission and flow control.
- Kafka consumer and Fetch compatibility.
- Further authoritative ISR propagation and publisher/cache hardening beyond Metadata discovery.
Review workflow
- Create a concise child issue describing a bounded capability, and record its dependency order here.
- Link a focused implementation PR to that child issue; do not close the umbrella from an individual PR.
- Review Kafka feature issues in dependency order. Keep dependent PRs as drafts and use incremental comparisons while prerequisites are unmerged.
- As prerequisites merge, rebase dependent branches onto the updated
mainand validate again. Record completion through the child issues, then scope the next unit.
Willingness to contribute
- [x] I'm willing to submit a PR!
Hi @gyang94 , I'd like to help with Kafka compatibility, starting with the Produce path. Is there a child issue I could pick up, and could I help with testing as the PRs land?
@dstolis Thanks for your interest in this topic and sorry for the late reply. Currently I have implemented the necessary code for the basic produce path and do some performance testing. There is a brief introduction about the progress in the last community call(in September 24th, doc: https://docs.google.com/document/d/1Fgj_ER50RhDRS6cAOggSHT2EPs3fGzsjz3EnW2ndJYU/edit?tab=t.0)
But it is not done. I believe there must be many places could be improved, and I am happy to work with you on any issue, testing and optimizing. One consideration is that, in the current status, the child issue you asked for, its feature implementation will be based on my "not yet merged" code instead of the main branch, which is not good since my code may change a lot after review. I'd suggest that, after merging existing code to the main, which means we settle down the fundamental necessary kafka compatibility codebase or framework, then we can work together to play around the code, do testing, and open issues to keep improving and optimizing it.
What do you think?
btw, I have put my whole implemented code in my forked repo, if you are interest you can take a look: https://github.com/gyang94/fluss/tree/kafka-compatibility-test-1
@dstolis Thanks for your interest in this topic and sorry for the late reply. Currently I have implemented the necessary code for the basic produce path and do some performance testing. There is a brief introduction about the progress in the last community call(in September 24th, doc: https://docs.google.com/document/d/1Fgj_ER50RhDRS6cAOggSHT2EPs3fGzsjz3EnW2ndJYU/edit?tab=t.0)
But it is not done. I believe there must be many places could be improved, and I am happy to work with you on any issue, testing and optimizing. One consideration is that, in the current status, the child issue you asked for, its feature implementation will be based on my "not yet merged" code instead of the main branch, which is not good since my code may change a lot after review. I'd suggest that, after merging existing code to the main, which means we settle down the fundamental necessary kafka compatibility codebase or framework, then we can work together to play around the code, do testing, and open issues to keep improving and optimizing it.
What do you think?
btw, I have put my whole implemented code in my forked repo, if you are interest you can take a look: https://github.com/gyang94/fluss/tree/kafka-compatibility-test-1
Hi @gyang94, thanks for the update. That plan makes sense. I opened a small PR against your fork with my initial findings. Feel free to cherry-pick what's useful and happy to support you further.
It seems that we have restarted the compatibility development of the Kafka protocol?
Hi @dao-jun, yes, the first stage focuses on producer compatibility, and the MVP features have been merged. All work is built upon the compatibility framework we previously established. Welcome your contributions to this module again!
@wuchong I noticed the kafka compatibility now not support idempotent producer, and from kafka client 3.0, idempotent.enable is set to true by default. And ordering guarantee is also very important, so I'm planning to handle the idempotent produce's development.
since the kafka protocol compatibility is not GA now, can we wait for idempotent produce? I read the source code and I find LogRecordBatch V2 have no writerEpoch(ProducerEpoch in kafka) field now, so for idempotent produce, we have to bump it to V3 to add writerEpoch.
/cc @gyang94
@dao-jun Thanks. Yes, the idempotent produce is the next step. In this month's community meeting, there is a doc to figure out the gaps about it (produceEpoch is one of them). You can take a look. https://docs.google.com/document/d/1WrezzTSNj61C-zc0hxo5jnAkQb45sWJn/edit
@gyang94 ok, since you are already planning to do this, i will not include it as part of my plan anymore