Skip to content

Commit

Permalink
Add a table for tracking node maintenance/draining state
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jul 14, 2020
1 parent c57b82a commit b6d8181
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/rabbit_maintenance.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
-export([
mark_as_drained/0,
unmark_as_drained/0,
is_drained_using_dirty_read/1,
is_drained_using_consistent_read/1,
suspend_all_client_listeners/0,
resume_all_client_listeners/0,
close_all_client_connections/0]).
Expand All @@ -35,6 +37,14 @@ mark_as_drained() ->
unmark_as_drained() ->
ok.

-spec is_drained_using_dirty_read(node()) -> boolean().
is_drained_using_dirty_read(_Node) ->
false.

-spec is_drained_using_consistent_read(node()) -> boolean().
is_drained_using_consistent_read(_Node) ->
false.

-spec suspend_all_client_listeners() -> rabbit_types:ok_or_error(any()).

%% Pauses all listeners on the current node except for
Expand Down
11 changes: 10 additions & 1 deletion src/rabbit_upgrade_functions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
-rabbit_upgrade({user_password_hashing, mnesia, [hash_passwords]}).
-rabbit_upgrade({operator_policies, mnesia, [slave_pids_pending_shutdown, internal_system_x]}).
-rabbit_upgrade({vhost_limits, mnesia, []}).
-rabbit_upgrade({queue_vhost_field, mnesia, [operator_policies]}).
-rabbit_upgrade({queue_vhost_field, mnesia, [operator_policies]}).
-rabbit_upgrade({topic_permission, mnesia, []}).
-rabbit_upgrade({queue_options, mnesia, [queue_vhost_field]}).
-rabbit_upgrade({exchange_options, mnesia, [operator_policies]}).
-rabbit_upgrade({node_maintenance_states, mnesia, []}).

%% -------------------------------------------------------------------

Expand Down Expand Up @@ -610,6 +611,7 @@ user_password_hashing() ->
end,
[username, password_hash, tags, hashing_algorithm]).

-spec topic_permission() -> 'ok'.
topic_permission() ->
create(rabbit_topic_permission,
[{record_name, topic_permission},
Expand All @@ -633,6 +635,13 @@ exchange_options(Table) ->
[name, type, durable, auto_delete, internal, arguments, scratches, policy,
operator_policy, decorators, options]).

-spec node_maintenance_states() -> 'ok'.
node_maintenance_states() ->
create(rabbit_node_maintenance_states,
[{record_name, node_maintenance_state},
{attributes, [node, state, context]},
{disc_copies, [node()]}]).

%%--------------------------------------------------------------------

transform(TableName, Fun, FieldList) ->
Expand Down

0 comments on commit b6d8181

Please sign in to comment.