8000 Kayrock based client doesn't respect kpro_schema limitations · Issue #373 · kafkaex/kafka_ex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Kayrock based client doesn't respect kpro_schema limitations #373
Closed
@kennethito

Description

@kennethito

I'm trying to use current master with kafka_version: "kayrock" against a 2.2.0 kafka cluster. During app startup, I'm erroring out in the new client's retrieve_metadata on Kayrock.Metadata.get_request_struct

** (Mix) Could not start application kafka_ex: KafkaEx.start(:normal, []) returned an error: an exception was raised:
    ** (FunctionClauseError) no function clause matching in Kayrock.Metadata.get_request_struct/1
        lib/generated/metadata.ex:281: Kayrock.Metadata.get_request_struct(7)
        (kafka_ex) lib/kafka_ex/new/client.ex:315: KafkaEx.New.Client.retrieve_metadata/5
        (kafka_ex) lib/kafka_ex/new/client.ex:212: KafkaEx.New.Client.update_metadata/2
        (kafka_ex) lib/kafka_ex/new/client.ex:124: KafkaEx.New.Client.init/1
        (stdlib) gen_server.erl:365: :gen_server.init_it/2
        (stdlib) gen_server.erl:333: :gen_server.init_it/6
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

The api_version being passed in is 7 which doesn't exist (max is 5).

Looking at KafkaEx.New.Client.State.max_supported_api_version with the below values, the code is translating :metadata to api_key 3 and finding a max api version of 7. However, as far as I can tell, Kayrock and kafka_protocol's :kpro_schema don't support that version. See krpo_schema.erl.

To fix this I think Kayrock.KafkaSchemaMetadata.version_range(:metadata) can be used (returns {0, 5}).

The max_supported_api_version should really be the minimum of (max_supported_by_kakfa_server, max_supported_by_kayrock), which in my case would be version 5 instead of 7.

api: :metadata
api_key: 3
api_versions: %{
  11 => {0, 4},
  39 => {0, 1},
  34 => {0, 1},
  26 => {0, 1},
  15 => {0, 2},
  20 => {0, 3},
  17 => {0, 1},
  25 => {0, 1},
  13 => {0, 2},
  0 => {0, 7},
  8 => {0, 6},
  36 => {0, 1},
  7 => {0, 2},
  1 => {0, 10},
  32 => {0, 2},
  37 => {0, 1},
  35 => {0, 1},
  3 => {0, 7},
  6 => {0, 5},
  2 => {0, 5},
  41 => {0, 1},
  33 => {0, 1},
  42 => {0, 1},
  43 => {0, 0},
  10 => {0, 2},
  9 => {0, 5},
  19 => {0, 3},
  14 => {0, 2},
  5 => {0, 1},
  18 => {0, 2},
  31 => {0, 1},
  22 => {0, 1},
  29 => {0, 1},
  21 => {0, 1},
  27 => {0, 0},
  24 => {0, 1},
  40 => {0, 1},
  30 => {0, 1},
  23 => {0, 2},
  28 => {0, 2},
  16 => {0, 2},
  38 => {0, 1},
  4 => {0, 2},
  12 => {0, 2}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0