summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kuryloski <pkuryloski@pivotal.io>2020-03-23 09:18:59 +0100
committerPhilip Kuryloski <pkuryloski@pivotal.io>2020-03-23 13:29:49 +0100
commit5d32cc351af0c291b6b84aef65ed6abf7694827c (patch)
tree504862d8737f58c843c2cc799ff208d59938aab3
parent01270fd3cdd381d14af7a1861e7f8b839a5d3130 (diff)
downloadrabbitmq-server-git-5d32cc351af0c291b6b84aef65ed6abf7694827c.tar.gz
Fail vhost startup if index workers are queued unsuccessfully
using spawn_link in rabbit_msg_store:build_index alters the supervision tree such that there are unwanted side effects in rabbit_vhost_msg_store. We monitor the spawned process so that if there is a failure to enqueue the scan for each file, the vhost fails to start and reports an error.
-rw-r--r--src/rabbit_msg_store.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index 56d65d75e9..32c30e48f9 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -1837,11 +1837,12 @@ rebuild_index(Gatherer, Files, State) ->
lists:foreach(fun (File) ->
ok = gatherer:fork(Gatherer)
end, Files),
- spawn(
- fun () ->
- enqueue_build_index_workers(Gatherer, undefined, Files,
- State)
- end),
+ Pid = spawn(
+ fun () ->
+ enqueue_build_index_workers(Gatherer, undefined,
+ Files, State)
+ end),
+ erlang:monitor(process, Pid),
reduce_index(Gatherer, lists:last(Files), State).
%%----------------------------------------------------------------------------