Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Clarification for zero UUIDs

...

The client instance ID is added as a tagged field in the RPC request header, so it is present on all RPCs that use the v2 request header, which is almost all of the current versions of the RPCs (only SaslHandshake and OffsetDelete use the v1 request header for their latest versions). The client is required to be consistent in its use of client instance ID in request headers. If it specifies the value in its request headers, every request on a connection must specify the same value. If it does not specify the value in its request headers, every request on a connection must not specified a value.

Note that omitting a client instance ID from the request header and explicitly sending a zero UUID as the client instance ID in the request header are indistinguishable in the protocol and are considered semantically equivalent. This means that if a client explicitly sets a zero UUID, the broker will treat it as if the client had not set a client instance ID. When the following text says "does not specify a client instance ID", this includes specifying a zero UUID as the client instance ID.

If a connection specifies a client instance ID in the request header of its first request which uses the v2 request header, it must specify the same client instance ID in the request header for all subsequent requests which use the v2 request header. The initial client instance ID for each connection will be cached by the broker for checking (this is an implementation detail, but caching it in the ChannelMetadataRegistry is an option). Once a client has specified a client instance ID in the request header of its first request, any subsequent requests which are missing the client instance ID (with the exception of requests using the v1 request header) or which specify a different value for the client instance ID will be rejected with error code INVALID_REQUEST.

...

Pre-KIP-1313 - broker does not expect ClientInstanceId  in request header and ignores it

Client sends

Broker responds

Notes

GetTelemetrySubscriptions v0

request.ClientInstanceId = 0

response.ClientInstanceId = UUID-B

response.ErrorCode = NONE

This is KIP-714 initial GetTelemetrySubscriptions .

Client is requesting a new client instance ID from the broker.

The client will henceforth use UUID-B for client telemetry.

GetTelemetrySubscriptions v0

request.ClientInstanceId = UUID-R

response.ClientInstanceId = 0

response.ErrorCode = NONE

This is KIP-714 non-initial GetTelemetrySubscriptions .

The client is using UUID-R for client telemetry.

Post-KIP-1313 - broker is aware of optional ClientInstanceId  in request header

Client sends

Broker responds

Notes

GetTelemetrySubscriptions v0

header.clientInstanceId not present or 0

request.ClientInstanceId = 0

response.ClientInstanceId = UUID-B

response.ErrorCode = NONE

This is KIP-714 initial GetTelemetrySubscriptions  request from a pre-KIP-1313 client.

The client is requesting a new client instance ID from the broker.

The client will henceforth use UUID-B for client telemetry.

GetTelemetrySubscriptions v0

header.ClientInstanceId not present or 0

request.ClientInstanceId = UUID-R

response.ClientInstanceId = 0

response.ErrorCode = NONE

This is KIP-714 non-initial GetTelemetrySubscriptions  request from a pre-KIP-1313 client.

The client is using UUID-R for client telemetry.

GetTelemetrySubscriptions v0

header.ClientInstanceId = UUID-H

request.ClientInstanceId = UUID-H

response.ClientInstanceId = 0

response.ErrorCode = NONE

This is KIP-714 GetTelemetrySubscriptions  request from a post-KIP-1313 client.

The client is using UUID-H for request headers and client telemetry. This is what we expect from the Apache Kafka Java client after this KIP.

GetTelemetrySubscriptions v0

header.ClientInstanceId = UUID-H

request.ClientInstanceId = 0

response.ErrorCode =  INVALID_REQUEST

This is not allowed.

If a client sends UUID-H in the request header, the request client instance ID must also be UUID-H.

After this KIP, the client generates the client instance ID and does not ask the broker to do so.

GetTelemetrySubscriptions v0

header.ClientInstanceId = UUID-H

request.ClientInstanceId = UUID-R≠UUID-H

response.ErrorCode =  INVALID_REQUEST

This is not allowed.

If a client sends UUID-H in the request header, the request client instance ID must also be UUID-H.

In summary, for GetTelemetrySubscriptions v0, here are the combinations:


Old brokerNew broker
Old client

Initial request:

  • request.ClientInstanceID=0
  • response.ClientInstanceId=UUID-B

Subsequent requests:

  • request.ClientInstanceId=UUID-B
  • response.ClientInstanceId=0

Initial request:

  • header.ClientInstanceId=0 (not sent by the client, but its absence is treated as 0)
  • request.ClientInstanceID=0
  • response.ClientInstanceId=UUID-B

Subsequent requests:

  • header.ClientInstanceId=0 (not sent by the client, but its absence is treated as 0)
  • request.ClientInstanceId=UUID-B
  • response.ClientInstanceId=0
New client

Initial request:

  • header.ClientInstanceId=UUID-H (ignored by broker)
  • request.ClientInstanceId=UUID-H
  • response.ClientInstanceId=0

Subsequent requests:

  • header.ClientInstanceId=UUID-H (ignored by broker)
  • request.ClientInstanceId=UUID-H
  • response.ClientInstanceId=0 

Initial request:

  • header.ClientInstanceId=UUID-H
  • request.ClientInstanceID=UUID-H
  • response.ClientInstanceId=0

Subsequent requests:

  • header.ClientInstanceId=UUID-H
  • request.ClientInstanceId=UUID-H
  • response.ClientInstanceId=0

...

As a result, the description for the ClientInstanceId  field in the request becomes "Unique id for this client instance. If a client is sending sends ClientInstanceId in the header, must equal that value. If not, must be set to 0 on the first request." .

...