Skip to content

Commit

Permalink
Merge pull request #11668 from rabbitmq/md/bump-khepri-0.14.0
Browse files Browse the repository at this point in the history
Bump `khepri` to 0.14.0, `khepri_mnesia_migration` to 0.5.0
  • Loading branch information
the-mikedavis authored Jul 10, 2024
2 parents ae0663d + 88c1ad2 commit cabf4dd
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
8 changes: 4 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ erlang_package.hex_package(
erlang_package.hex_package(
name = "khepri",
build_file = "@rabbitmq-server//bazel:BUILD.khepri",
sha256 = "1157d963eb5c002e040bbc86348669818d1da86d259a3705008655fefbd7f1c2",
version = "0.13.0",
sha256 = "dccfaeb3583a04722e2258911f7f906ce67f8efac80504be4923aaafae6d4e21",
version = "0.14.0",
)

erlang_package.hex_package(
name = "khepri_mnesia_migration",
build_file = "@rabbitmq-server//bazel:BUILD.khepri_mnesia_migration",
sha256 = "007568909c726057a6e06fb110a7309bf8bbdb9d233f09987da9388048726cbd",
version = "0.4.0",
sha256 = "f56d277ca7876371615cef9c5674c78854f31cf9f26ce97fd3f4b5a65573ccc4",
version = "0.5.0",
)

erlang_package.hex_package(
Expand Down
2 changes: 2 additions & 0 deletions bazel/BUILD.khepri
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ filegroup(
"src/khepri_export_erlang.erl",
"src/khepri_import_export.erl",
"src/khepri_machine.erl",
"src/khepri_machine_v0.erl",
"src/khepri_path.erl",
"src/khepri_pattern_tree.erl",
"src/khepri_payload.erl",
Expand Down Expand Up @@ -148,6 +149,7 @@ erlang_bytecode(
"src/khepri_evf.erl",
"src/khepri_export_erlang.erl",
"src/khepri_machine.erl",
"src/khepri_machine_v0.erl",
"src/khepri_path.erl",
"src/khepri_pattern_tree.erl",
"src/khepri_payload.erl",
Expand Down
12 changes: 7 additions & 5 deletions deps/rabbit/src/rabbit_khepri.erl
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ wait_for_leader(Timeout, Retries) ->
Exists when is_boolean(Exists) ->
rabbit_log:info("Khepri leader elected"),
ok;
{error, {timeout, _ServerId}} ->
{error, timeout} -> %% Khepri >= 0.14.0
wait_for_leader(Timeout, Retries -1);
{error, {timeout, _ServerId}} -> %% Khepri < 0.14.0
wait_for_leader(Timeout, Retries -1);
{error, Reason} ->
throw(Reason)
Expand Down Expand Up @@ -491,13 +493,13 @@ remove_down_member(NodeToRemove) ->
[NodeToRemove, ?RA_CLUSTER_NAME, Reason],
#{domain => ?RMQLOG_DOMAIN_GLOBAL}),
Error;
{timeout, _} = Reason ->
{timeout, _LeaderId} ->
?LOG_ERROR(
"Failed to remove remote down node ~s from Khepri "
"cluster \"~s\": ~p",
[NodeToRemove, ?RA_CLUSTER_NAME, Reason],
"cluster \"~s\" due to timeout",
[NodeToRemove, ?RA_CLUSTER_NAME],
#{domain => ?RMQLOG_DOMAIN_GLOBAL}),
{error, Reason}
{error, timeout}
end.

%% @private
Expand Down
10 changes: 5 additions & 5 deletions deps/rabbit/test/cluster_minority_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -187,27 +187,27 @@ consume_from_queue(Config) ->
amqp_channel:call(Ch, #'basic.consume'{queue = <<"test-queue">>})).

add_vhost(Config) ->
?assertMatch({error, {timeout, _}},
?assertMatch({error, timeout},
rabbit_ct_broker_helpers:add_vhost(Config, <<"vhost1">>)).

update_vhost(Config) ->
?assertThrow({error, {timeout, _}},
?assertThrow({error, timeout},
rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_vhost, update_tags,
[<<"/">>, [carrots], <<"user">>])).

delete_vhost(Config) ->
?assertMatch({'EXIT', _}, rabbit_ct_broker_helpers:delete_vhost(Config, <<"vhost1">>)).

add_user(Config) ->
?assertMatch({error, {timeout, _}},
?assertMatch({error, timeout},
rabbit_ct_broker_helpers:add_user(Config, <<"user1">>)).

update_user(Config) ->
?assertMatch({error, {timeout, _}},
?assertMatch({error, timeout},
rabbit_ct_broker_helpers:set_user_tags(Config, 0, <<"user1">>, [<<"admin">>])).

delete_user(Config) ->
?assertMatch({error, {timeout, _}},
?assertMatch({error, timeout},
rabbit_ct_broker_helpers:delete_user(Config, <<"user1">>)).

set_policy(Config) ->
Expand Down
6 changes: 6 additions & 0 deletions deps/rabbitmq_cli/lib/rabbitmq/cli/default_output.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ defmodule RabbitMQ.CLI.DefaultOutput do
defp normalize_output({unknown, _} = input, _opts) when is_atom(unknown), do: {:error, input}
defp normalize_output(result, _opts) when not is_atom(result), do: {:ok, result}

defp format_khepri_output({:error, :timeout}, %{node: node_name}) do
# Khepri >= 0.14.0
{:error, RabbitMQ.CLI.Core.ExitCodes.exit_tempfail(), khepri_timeout_error(node_name)}
end

defp format_khepri_output({:error, {:timeout, {:rabbitmq_metadata, _}}}, %{node: node_name}) do
# Khepri < 0.14.0
{:error, RabbitMQ.CLI.Core.ExitCodes.exit_tempfail(), khepri_timeout_error(node_name)}
end

Expand Down
1 change: 1 addition & 0 deletions moduleindex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ khepri:
- khepri_export_erlang
- khepri_import_export
- khepri_machine
- khepri_machine_v0
- khepri_path
- khepri_pattern_tree
- khepri_payload
Expand Down
4 changes: 2 additions & 2 deletions rabbitmq-components.mk
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ dep_credentials_obfuscation = hex 3.4.0
dep_cuttlefish = hex 3.1.0
dep_gen_batch_server = hex 0.8.8
dep_jose = hex 1.11.10
dep_khepri = hex 0.13.0
dep_khepri_mnesia_migration = hex 0.4.0
dep_khepri = hex 0.14.0
dep_khepri_mnesia_migration = hex 0.5.0
dep_prometheus = hex 4.11.0
dep_ra = hex 2.11.0
dep_ranch = hex 2.1.0
Expand Down

0 comments on commit cabf4dd

Please sign in to comment.