Skip to content

Commit ced137d

Browse files
committed
feat: update Produce stage description to clarify handling of multiple partitions, including validation, response structure, and log file requirements
1 parent 536b478 commit ced137d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

stage_descriptions/produce-06_mf2.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ In this stage, you'll add support for producing to multiple partitions of the sa
22

33
## Partition Routing
44

5-
Your Kafka implementation should handle writes to multiple partitions within the same topic, manage independent offset assignment per partition, and aggregate responses correctly. Each partition maintains its own offset sequence independently.
5+
When a Kafka broker receives a Produce request targeting multiple partitions of the same topic, it needs to validate that the topic and all partitions exist, write records to each partition's log file independently, and return a response containing results for all partitions. Each partition maintains its own offset sequence independently, so partition 0 and partition 1 can both have records starting at offset 0.
6+
7+
The request will contain multiple RecordBatches, one for each partition. Each RecordBatch will contain a single record.
8+
9+
We've created an interactive protocol inspector for the request & response structures for `Produce`:
10+
11+
- 🔎 [Produce Request (v11)](https://binspec.org/kafka-produce-request-v11)
12+
- 🔎 [Produce Response (v11)](https://binspec.org/kafka-produce-response-v11)
613

714
## Tests
815

@@ -23,18 +30,18 @@ The tester will validate that:
2330
- The `name` field in the topic response matches the topic name in the request.
2431
- Each partition in the request has a corresponding partition response.
2532
- Each partition response contains:
26-
- The correct `partition` field matching the request.
33+
- The correct `index` field matching the partition in the request.
2734
- An error code of `0` (NO_ERROR).
28-
- A valid `offset` field with the assigned offset for that partition.
29-
- A valid `timestamp` field.
30-
- A correct `log_start_offset` field.
35+
- A valid `base_offset` field with the assigned offset for that partition.
36+
- The `log_append_time_ms` field contains `-1` (signifying that the timestamp is latest).
37+
- The `log_start_offset` field is `0`.
3138
- Records are persisted to the correct partition log files.
3239
- Offset assignment is independent per partition (partition 0 and partition 1 can both have offset 0).
3340

41+
The tester will also verify that the records are persisted to the correct partition log files.
42+
3443
## Notes
3544

36-
- Each partition maintains its own offset sequence starting from 0.
37-
- Multiple partitions can be written to simultaneously in a single request.
3845
- The response must include entries for all requested partitions.
39-
- Partition-level errors should be handled independently (one partition failure shouldn't affect others).
40-
- The official docs for the `Produce` request can be found [here](https://kafka.apache.org/protocol.html#The_Messages_Produce).
46+
- On-disk log files must be stored in RecordBatch format with proper CRC validation.
47+
- The official docs for the `Produce` request can be found [here](https://kafka.apache.org/protocol.html#The_Messages_Produce). Make sure to scroll down to the "Produce Response (Version: 11)" section.

0 commit comments

Comments
 (0)