Skip to content

Commit 4be40ca

Browse files
Ayanda-Dansd
authored andcommitted
add more logging on vhost deletion procedure steps
1 parent b9b6b3d commit 4be40ca

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

deps/rabbit/src/rabbit_connection_tracking.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ handle_cast({user_deleted, Details}) ->
127127
%% Schedule user entry deletion, allowing time for connections to close
128128
_ = timer:apply_after(?TRACKING_EXECUTION_TIMEOUT, ?MODULE,
129129
delete_tracked_connection_user_entry, [Username]),
130-
rabbit_log_connection:info("Closing all connections from user '~ts' because it's being deleted", [Username]),
130+
rabbit_log_connection:info("Closing all connections for user '~ts' because the user is being deleted", [Username]),
131131
shutdown_tracked_items(
132132
rabbit_connection_tracking:list_of_user(Username),
133133
rabbit_misc:format("user '~ts' is deleted", [Username])).

deps/rabbit/src/rabbit_vhost.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,23 @@ delete(VHost, ActingUser) ->
271271
%% modules, like `rabbit_amqqueue:delete_all_for_vhost(VHost)'. These new
272272
%% calls would be responsible for the atomicity, not this code.
273273
%% Clear the permissions first to prohibit new incoming connections when deleting a vhost
274+
rabbit_log:info("Clearing permissions in vhost '~ts' because it's being deleted", [VHost]),
274275
_ = rabbit_auth_backend_internal:clear_permissions_for_vhost(VHost, ActingUser),
275276
_ = rabbit_auth_backend_internal:clear_topic_permissions_for_vhost(VHost, ActingUser),
277+
rabbit_log:info("Deleting queues in vhost '~ts' because it's being deleted", [VHost]),
276278
QDelFun = fun (Q) -> rabbit_amqqueue:delete(Q, false, false, ActingUser) end,
277279
[begin
278280
Name = amqqueue:get_name(Q),
279281
assert_benign(rabbit_amqqueue:with(Name, QDelFun), ActingUser)
280282
end || Q <- rabbit_amqqueue:list(VHost)],
283+
rabbit_log:info("Deleting exchanges in vhost '~ts' because it's being deleted", [VHost]),
281284
[assert_benign(rabbit_exchange:delete(Name, false, ActingUser), ActingUser) ||
282285
#exchange{name = Name} <- rabbit_exchange:list(VHost)],
286+
rabbit_log:info("Clearing policies and runtime parameters in vhost '~ts' because it's being deleted", [VHost]),
283287
_ = rabbit_runtime_parameters:clear_vhost(VHost, ActingUser),
284288
_ = [rabbit_policy:delete(VHost, proplists:get_value(name, Info), ActingUser)
285289
|| Info <- rabbit_policy:list(VHost)],
290+
rabbit_log:debug("Removing vhost '~ts' from the metadata storage because it's being deleted", [VHost]),
286291
case rabbit_db_vhost:delete(VHost) of
287292
true ->
288293
ok = rabbit_event:notify(

deps/rabbit/src/rabbit_vhost_sup_sup.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,17 @@ delete_on_all_nodes(VHost) ->
7575

7676
stop_and_delete_vhost(VHost) ->
7777
StopResult = case lookup_vhost_sup_record(VHost) of
78-
not_found -> ok;
78+
not_found ->
79+
rabbit_log:warning("Supervisor for vhost '~ts' not found during deletion procedure",
80+
[VHost]),
81+
ok;
7982
#vhost_sup{wrapper_pid = WrapperPid,
8083
vhost_sup_pid = VHostSupPid} ->
8184
case is_process_alive(WrapperPid) of
82-
false -> ok;
85+
false ->
86+
rabbit_log:info("Supervisor ~tp for vhost '~ts' already stopped",
87+
[VHostSupPid, VHost]),
88+
ok;
8389
true ->
8490
rabbit_log:info("Stopping vhost supervisor ~tp"
8591
" for vhost '~ts'",

0 commit comments

Comments
 (0)