Skip to content

Commit 2e5e19c

Browse files
committed
Update Khepri from 0.14.0 to 0.15.0
Release notes: https://github.com/rabbitmq/khepri/releases/tag/v0.15.0 The `favor` default value is now `low_latency`. Therefore, we don't need to specify it explicitly anymore.
1 parent e396c16 commit 2e5e19c

File tree

4 files changed

+25
-42
lines changed

4 files changed

+25
-42
lines changed

MODULE.bazel

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,13 @@ erlang_package.hex_package(
207207
version = "1.4.1",
208208
)
209209

210-
erlang_package.hex_package(
210+
erlang_package.git_package(
211211
name = "khepri",
212212
build_file = "@rabbitmq-server//bazel:BUILD.khepri",
213-
sha256 = "dccfaeb3583a04722e2258911f7f906ce67f8efac80504be4923aaafae6d4e21",
214-
version = "0.14.0",
213+
#sha256 = "dccfaeb3583a04722e2258911f7f906ce67f8efac80504be4923aaafae6d4e21",
214+
#version = "0.14.0",
215+
repository = "rabbitmq/khepri",
216+
branch = "main",
215217
)
216218

217219
erlang_package.hex_package(

deps/rabbit/src/rabbit_db_maintenance.erl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ get_consistent_in_mnesia(Node) ->
155155

156156
get_consistent_in_khepri(Node) ->
157157
Path = khepri_maintenance_path(Node),
158-
%% FIXME: Ra consistent queries are fragile in the sense that the query
159-
%% function may run on a remote node and the function reference or MFA may
160-
%% not be valid on that node. That's why we force a local query for now.
161-
%Options = #{favor => consistent},
162-
Options = #{favor => local},
158+
Options = #{favor => consistency},
163159
case rabbit_khepri:get(Path, Options) of
164160
{ok, #node_maintenance_state{status = Status}} ->
165161
Status;

deps/rabbit/src/rabbit_khepri.erl

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ wait_for_leader(_Timeout, 0) ->
293293
wait_for_leader(Timeout, Retries) ->
294294
rabbit_log:info("Waiting for Khepri leader for ~tp ms, ~tp retries left",
295295
[Timeout, Retries - 1]),
296-
Options = #{timeout => Timeout,
297-
favor => low_latency},
296+
Options = #{timeout => Timeout},
298297
case khepri:exists(?STORE_ID, [], Options) of
299298
Exists when is_boolean(Exists) ->
300299
rabbit_log:info("Khepri leader elected"),
@@ -917,50 +916,46 @@ cas(Path, Pattern, Data) ->
917916
?STORE_ID, Path, Pattern, Data, ?DEFAULT_COMMAND_OPTIONS).
918917

919918
fold(Path, Pred, Acc) ->
920-
khepri:fold(?STORE_ID, Path, Pred, Acc, #{favor => low_latency}).
919+
khepri:fold(?STORE_ID, Path, Pred, Acc).
921920

922921
fold(Path, Pred, Acc, Options) ->
923-
Options1 = Options#{favor => low_latency},
924-
khepri:fold(?STORE_ID, Path, Pred, Acc, Options1).
922+
khepri:fold(?STORE_ID, Path, Pred, Acc, Options).
925923

926924
foreach(Path, Pred) ->
927-
khepri:foreach(?STORE_ID, Path, Pred, #{favor => low_latency}).
925+
khepri:foreach(?STORE_ID, Path, Pred).
928926

929927
filter(Path, Pred) ->
930-
khepri:filter(?STORE_ID, Path, Pred, #{favor => low_latency}).
928+
khepri:filter(?STORE_ID, Path, Pred).
931929

932930
get(Path) ->
933-
khepri:get(?STORE_ID, Path, #{favor => low_latency}).
931+
khepri:get(?STORE_ID, Path).
934932

935933
get(Path, Options) ->
936-
Options1 = Options#{favor => low_latency},
937-
khepri:get(?STORE_ID, Path, Options1).
934+
khepri:get(?STORE_ID, Path, Options).
938935

939936
get_many(PathPattern) ->
940-
khepri:get_many(?STORE_ID, PathPattern, #{favor => low_latency}).
937+
khepri:get_many(?STORE_ID, PathPattern).
941938

942939
adv_get(Path) ->
943-
khepri_adv:get(?STORE_ID, Path, #{favor => low_latency}).
940+
khepri_adv:get(?STORE_ID, Path).
944941

945942
adv_get_many(PathPattern) ->
946-
khepri_adv:get_many(?STORE_ID, PathPattern, #{favor => low_latency}).
943+
khepri_adv:get_many(?STORE_ID, PathPattern).
947944

948945
match(Path) ->
949946
match(Path, #{}).
950947

951948
match(Path, Options) ->
952-
Options1 = Options#{favor => low_latency},
953-
khepri:get_many(?STORE_ID, Path, Options1).
949+
khepri:get_many(?STORE_ID, Path, Options).
954950

955-
exists(Path) -> khepri:exists(?STORE_ID, Path, #{favor => low_latency}).
951+
exists(Path) -> khepri:exists(?STORE_ID, Path).
956952

957953
list(Path) ->
958954
khepri:get_many(
959-
?STORE_ID, Path ++ [?KHEPRI_WILDCARD_STAR], #{favor => low_latency}).
955+
?STORE_ID, Path ++ [?KHEPRI_WILDCARD_STAR]).
960956

961957
list_child_nodes(Path) ->
962-
Options = #{props_to_return => [child_names],
963-
favor => low_latency},
958+
Options = #{props_to_return => [child_names]},
964959
case khepri_adv:get_many(?STORE_ID, Path, Options) of
965960
{ok, Result} ->
966961
case maps:values(Result) of
@@ -974,8 +969,7 @@ list_child_nodes(Path) ->
974969
end.
975970

976971
count_children(Path) ->
977-
Options = #{props_to_return => [child_list_length],
978-
favor => low_latency},
972+
Options = #{props_to_return => [child_list_length]},
979973
case khepri_adv:get_many(?STORE_ID, Path, Options) of
980974
{ok, Map} ->
981975
lists:sum([L || #{child_list_length := L} <- maps:values(Map)]);
@@ -1026,18 +1020,9 @@ transaction(Fun) ->
10261020
transaction(Fun, ReadWrite) ->
10271021
transaction(Fun, ReadWrite, #{}).
10281022

1029-
transaction(Fun, ReadWrite, Options0) ->
1030-
%% If the transaction is read-only, use the same default options we use
1031-
%% for most queries.
1032-
DefaultQueryOptions = case ReadWrite of
1033-
ro ->
1034-
#{favor => low_latency};
1035-
_ ->
1036-
#{}
1037-
end,
1038-
Options1 = maps:merge(DefaultQueryOptions, Options0),
1039-
Options = maps:merge(?DEFAULT_COMMAND_OPTIONS, Options1),
1040-
case khepri:transaction(?STORE_ID, Fun, ReadWrite, Options) of
1023+
transaction(Fun, ReadWrite, Options) ->
1024+
Options1 = maps:merge(?DEFAULT_COMMAND_OPTIONS, Options),
1025+
case khepri:transaction(?STORE_ID, Fun, ReadWrite, Options1) of
10411026
ok -> ok;
10421027
{ok, Result} -> Result;
10431028
{error, Reason} -> throw({error, Reason})

rabbitmq-components.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ dep_credentials_obfuscation = hex 3.4.0
120120
dep_cuttlefish = hex 3.4.0
121121
dep_gen_batch_server = hex 0.8.8
122122
dep_jose = hex 1.11.10
123-
dep_khepri = hex 0.14.0
123+
dep_khepri = git https://github.com/rabbitmq/khepri main # XXX
124124
dep_khepri_mnesia_migration = hex 0.5.0
125125
dep_prometheus = hex 4.11.0
126126
dep_ra = hex 2.13.6

0 commit comments

Comments
 (0)