Skip to content

Commit af0728c

Browse files
committed
rabbit_db_maintenance: Use local queries with Khepri
[Why] Ra consistent queries are currently fragile in the sense that the query function may run on a remote node and the function reference or MFA may not be valid on that node. See previous commit for more details. [How] We perform local queries in `rabbit_db_maintenance:get_consistent/1` when Khepri is enabled. This violates what the expectation from this API, that's why it is a temporary measure, until a proper solution is found.
1 parent 6ea19b9 commit af0728c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

deps/rabbit/src/rabbit_db_maintenance.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ get_consistent_in_mnesia(Node) ->
155155

156156
get_consistent_in_khepri(Node) ->
157157
Path = khepri_maintenance_path(Node),
158-
case rabbit_khepri:get(Path, #{favor => consistency}) of
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},
163+
case rabbit_khepri:get(Path, Options) of
159164
{ok, #node_maintenance_state{status = Status}} ->
160165
Status;
161166
_ ->

deps/rabbit/src/rabbit_maintenance.erl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
-include_lib("rabbit_common/include/rabbit.hrl").
1111

12+
%% FIXME: Ra consistent queries are currently fragile in the sense that the
13+
%% query function may run on a remote node and the function reference or MFA
14+
%% may not be valid on that node. That's why consistent queries in this module
15+
%% are in fact local queries when Khepri is enabled.
16+
%%
17+
%% See `rabbit_db_maintenance:get_consistent_in_khepri/1'.
18+
1219
-export([
1320
is_enabled/0,
1421
drain/0,

0 commit comments

Comments
 (0)