Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleRequest Header (all single non-multi requests begin with this)
borderStylesolid
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                       REQUEST_LENGTH                          |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |         REQUEST_TYPE          |        TOPIC_LENGTH           |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  /                                                               /
  /                    TOPIC (variable length)                    /
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                           PARTITION                           |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  REQUEST_LENGTH = int32 // Length in bytes of entire request (excluding this field)
  REQUEST_TYPE   = int16 // See table below
  TOPIC_LENGTH   = int16 // Length in bytes of the topic name

  TOPIC = String // Topic name, ASCII, not null terminated
                 // This becomes the name of a directory on the broker, so no
                 // chars that would be illegal on the filesystem.

  PARTITION = int32 // Partition to act on. Number of available partitions is
                    // controlled by broker config. Partition numbering
                    // starts at 0.

  ============  =====  =======================================================
  REQUEST_TYPE  VALUE  DEFINITION
  ============  =====  =======================================================
  PRODUCE         0    Send a group of messages to a topic and partition.
  FETCH           1    Fetch a group of messages from a topic and partition.
  MULTIFETCH      2    Multiple FETCH requests, chained together
  MULTIPRODUCE    3    Multiple PRODUCE requests, chained together
  OFFSETS         4    Find offsets before a certain time (this can be a bit
                       misleading, please read the details of this request).
  ============  =====  =======================================================

Very similar to the Request-Header is the multi-request header used for requesting more than one topic-partition combo at a time. Either for multi-produce, or multi-fetch.

Code Block
titleResponse Header (all responses begin with this 6 byte headerMulti-Request Header (more than one topic-partition combo)
borderStylesolid
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                        RESPONSEREQUEST_LENGTH                          |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |         ERROR_CODE REQUEST_TYPE          |    TOPICPARTITION_COUNT       |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
  RESPONSEREQUEST_LENGTH =      = int32 // Length in bytes of entire responserequest (excluding this field)
 REQUEST_TYPE        ERROR_CODE = int16 // See table below.
above
 TOPICPARTITION_COUNT === int16 // number of unique topic-partition combos in this request

Code Block
titleResponse Header (all responses begin with this 6 byte header)
borderStylesolid

   0   =============  =====  ===================================================
  ERROR_CODE        VALUE  DEFINITION
  ================  =====  ===================================================
  Unknown            -1    Unknown1 Error
  NoError             0   2 Success
  OffsetOutOfRange    1    Offset requested is no longer available on the server3
  InvalidMessage 0 1    2 3 4 5 A6 message7 you8 sent9 failed0 its1 checksum2 and3 is4 corrupt.
5 6 WrongPartition7 8 9 0 1 2 3 4 5 6 You7 tried8 to9 access0 a1
 partition that doesn't exist
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                         (was not between 0 and (num_partitions - 1)).
  InvalidFetchSizeRESPONSE_LENGTH            4    The size you requested for fetching is smaller than|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |         ERROR_CODE              the message you're trying to fetch.
  ====|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  RESPONSE_LENGTH = int32 // Length in bytes of entire response (excluding this field)
  ERROR_CODE = int16 // See table below.

  ================  =====  ===================================================

Very similar to the Request-Header is the multi-request header used for requesting more than one topic-partition combo at a time. Either for multi-produce, or multi-fetch.

Code Block
titleMulti-Request Header (more than one topic-partition combo)
borderStylesolid

 0                   1                   2  ERROR_CODE        VALUE  DEFINITION
  ================  =====  ===================================================
  Unknown            -1            3Unknown Error
 0 1NoError 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4Success
 5 6OffsetOutOfRange 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |   Offset requested is no longer available on the server
  InvalidMessage      2    REQUEST_LENGTHA message you sent failed its checksum and is corrupt.
  WrongPartition      3    You tried to access a partition that doesn't |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |exist
                  REQUEST_TYPE         (was |not between 0 and TOPICPARTITION_COUNT (num_partitions - 1)).
  InvalidFetchSize    4  |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
 REQUEST_LENGTH       = int32 // Length in bytes of entire request (excluding this field)
 REQUEST_TYPE The size you requested for fetching is smaller than
                     = int16 // See table above
 TOPICPARTITION_COUNTthe =message int16 // number of unique topic-partition combos in this request
you're trying to fetch.
  ================  =====  ===================================================

FIXME: Add tests to verify all these codes.

...

Role

ZooKeeper Path

Type

Data Description

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6ed5e6fe0e87aa7a-b23d2a88-4b2d457e-bd15abef-23bb8d183f7cc5f07d0896db"><ac:plain-text-body><![CDATA[

ID Registry

/brokers/ids/[0..N]

Ephemeral

String in the format of "creator:host:port" of the broker.

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="16678430dc40425c-6f667683-49b84d80-882ab56f-0c3111d9eb9a551ccbbc8512"><ac:plain-text-body><![CDATA[

Topic Registry

/brokers/topics/[topic]/[0..N]

Ephemeral

Number of partitions that topic has on that Broker.

]]></ac:plain-text-body></ac:structured-macro>

...