...
New Metadata Request and Response version, v1, will be added to provide information on supported protocol versions to clients.
Code Block MetadataRequest => api_keys, topics api_keys => [INT16] topics => [STRING] MetadataResponse => api_versions, brokers, topic_metadata api_versions => [single_api_versions] single_api_versions => api_key, min_version, max_version api_key => INT16 min_version => INT16 max_version => INT16 brokers => node_id host port node_id => INT32 host => STRING port => INT32 topic_metadata => topic_error_code topic [partition_metadata] topic_error_code => INT16 topic => STRING partition_metadata => partition_error_code partition_id leader [replicas] [isr] partition_error_code => INT16 partition_id => INT32 leader => INT32
Metadata Request v1 can be used by clients to ask for supported protocol versions by a broker. Client can send Metadata Request, v1, with api_keys set to one of the following values.
Empty array, this will get the client supported versions for all ApiKeys.
Array of some ApiKeys, this will get client supported versions for the specified ApiKeys.
Null array, this will not get any information on ApiKeys.
Broker on receiving a Metadata Request v1, will respond with MetadataResponse v1. The response will contain information on supported versions for api keys specified in the request, if an empty array of api keys is sent, then broker will respond with info on all api keys, and if null array is sent for api keys, then no information on protocol versions is added to the response. Note that broker only provides information on its supported protocol versions. Broker will order the supported versions of an api key in the order of its preference, highest to lowest. Clients should use a version that has the highest priority, as per broker's priority order, and is supported by the client.
- Clients can choose to not receive topics metadata by specifying a null array for topics in Metadata Request v1.
Deprecation of a protocol version will be done by marking a protocol version as deprecated in protocol documentation. Documentation shall also be used to indicate a protocol version that must not be used, or for any such information.For instance, say 0.9.0 had protocol versions [0] for api key 1. On trunk, version 1 of the api key was added. Users running off trunk started using version 1 of the api and found out a major bug. To rectify that version 2 of the api is added to trunk. For some reason, it is now deemed important to have version 2 of the api in 0.9.1 as well. To do so, version 1 and version 2 both of the api will be backported to the 0.9.1 branch. 0.9.1 broker will return 0 as min supported version for the api and 2 for the max supported version for the api. However, the version 1 should be clearly marked as deprecated on its documentation. It will be client's responsibility to make sure they are not using any such deprecated version.
Supported protocol versions obtained from a broker, is good only for current connection on which that information is obtained. In the event of disconnection, the client should obtain the information from the broker again, as the broker might have upgraded/ downgraded in the mean time.
- If a client faces connection closure on sending MetadataRequest Vn, where n is >=1, seeking supported protocol versions, it could be due to following reasons.
- Broker does not support version Vn of MetadataRequest. It is advised that client starts from V1 of metadata request and incrementally try above versions for connection closures.
- Connection closure was caused by issues other than unknown MetadataRequest version.
...