diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 209da873..70d17a88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: - master env: OTP_VERSION: "26" - REBAR_VERSION: "3.20.0" + REBAR_VERSION: "3.23.0" jobs: lint: @@ -44,7 +44,7 @@ jobs: strategy: fail-fast: false matrix: - otp: ["26"] + otp: ["26", "27"] kafka: ["0.9", "0.10", "0.11", "2.8", "1.1", "3.6"] steps: - name: Checkout diff --git a/rebar.config b/rebar.config index d6a68551..c9ca8c2c 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ {deps, [ {kafka_protocol, "4.1.5"} , {snappyer, "1.2.9"} ]}. -{project_plugins, [{coveralls, "~> 2.2.0"}, {rebar3_lint, "~> 1.0.2"}]}. +{project_plugins, [{coveralls, "~> 2.2.0"}, {rebar3_lint, "~> 3.2.5"}]}. {edoc_opts, [{preprocess, true}, {macros, [{build_brod_cli, true}]}]}. {erl_opts, [warnings_as_errors, warn_unused_vars,warn_shadow_vars,warn_obsolete_guard,debug_info]}. {xref_checks, [undefined_function_calls, undefined_functions, @@ -28,7 +28,7 @@ , {jsone, "1.7.0"} , {meck, "0.9.2"} , {proper, "1.4.0"} - , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {branch, "1.0.8"}}} + , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {branch, "1.0.10"}}} ]}, {erl_opts, [warnings_as_errors, {d, build_brod_cli}]} ]} diff --git a/rebar.lock b/rebar.lock index 0a925d0e..71217547 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,14 +1,14 @@ {"1.2.0", [{<<"crc32cer">>,{pkg,<<"crc32cer">>,<<"0.1.8">>},1}, - {<<"kafka_protocol">>,{pkg,<<"kafka_protocol">>,<<"4.1.3">>},0}, + {<<"kafka_protocol">>,{pkg,<<"kafka_protocol">>,<<"4.1.5">>},0}, {<<"snappyer">>,{pkg,<<"snappyer">>,<<"1.2.9">>},0}]}. [ {pkg_hash,[ {<<"crc32cer">>, <<"C6C2275C5FB60A95F4935D414F30B50EE9CFED494081C9B36EBB02EDFC2F48DB">>}, - {<<"kafka_protocol">>, <<"362D85A898D4148A43DBABB10A30BB2D6FF32BA0097EB06981D11B34E2E0A9CD">>}, + {<<"kafka_protocol">>, <<"D15E64994A8CA99716AB47DB4132614359AC1BFA56D6C5B4341FDC1AA4041518">>}, {<<"snappyer">>, <<"9CC58470798648CE34C662CA0AA6DAAE31367667714C9A543384430A3586E5D3">>}]}, {pkg_hash_ext,[ {<<"crc32cer">>, <<"251499085482920DEB6C9B7AADABF9FB4C432F96ADD97AB42AEE4501E5B6F591">>}, - {<<"kafka_protocol">>, <<"28CF73001270D972524DD0FAD4A59074F4441219F9CF237AD808A2AC1EC97487">>}, + {<<"kafka_protocol">>, <<"C956C9357FEF493B7072A35D0C3E2BE02AA5186C804A412D29E62423BB15E5D9">>}, {<<"snappyer">>, <<"18D00CA218AE613416E6EECAFE1078DB86342A66F86277BD45C95F05BF1C8B29">>}]} ]. diff --git a/src/brod_producer.erl b/src/brod_producer.erl index 9f9466f5..1cd55583 100644 --- a/src/brod_producer.erl +++ b/src/brod_producer.erl @@ -36,9 +36,14 @@ , handle_info/2 , init/1 , terminate/2 - , format_status/2 ]). +-if(?OTP_RELEASE < 25). +-export([format_status/2]). +-else. +-export([format_status/1]). +-endif. + -export([ do_send_fun/4 , do_no_ack/2 , do_bufcb/2 @@ -408,12 +413,21 @@ terminate(Reason, #state{client_pid = ClientPid ok. %% @private +-if(?OTP_RELEASE < 25). format_status(normal, [_PDict, State=#state{}]) -> [{data, [{"State", State}]}]; format_status(terminate, [_PDict, State=#state{buffer = Buffer}]) -> %% Do not format the buffer attribute when process terminates abnormally and logs an error %% but allow it when is a sys:get_status/1.2 State#state{buffer = brod_producer_buffer:empty_buffers(Buffer)}. +-else. +format_status(#{reason := normal} = Status) -> + Status; +format_status(#{reason := terminate, state := #state{buffer = Buffer} = State} = Status) -> + %% Do not format the buffer attribute when process terminates abnormally and logs an error + %% but allow it when is a sys:get_status/1.2 + Status#{state => State#state{buffer = brod_producer_buffer:empty_buffers(Buffer)}}. +-endif. %%%_* Internal Functions ======================================================= diff --git a/src/brod_supervisor3.erl b/src/brod_supervisor3.erl index dd2e4b3e..ba5187c6 100644 --- a/src/brod_supervisor3.erl +++ b/src/brod_supervisor3.erl @@ -82,7 +82,7 @@ %% Internal exports -export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3, format_status/2]). + terminate/2, code_change/3]). -export([try_again_restart/3]). %%-------------------------------------------------------------------------- @@ -735,12 +735,6 @@ code_change(_, State, _) -> Error end. -format_status(terminate, [_PDict, State]) -> - State; -format_status(_, [_PDict, State]) -> - [{data, [{"State", State}]}, - {supervisor, [{"Callback", State#state.module}]}]. - check_flags({Strategy, MaxIntensity, Period}) -> valid_strategy(Strategy), valid_intensity(MaxIntensity),