diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2019-01-03 23:57:47 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2019-01-03 23:57:47 +0300 |
| commit | 7ba04a6a681e3e3f805b582a7f0aa3f8361c248a (patch) | |
| tree | 3f0f3d0c69ae435f014378177ec2ec19795c93d0 | |
| parent | e01dc9882a637cdb5b8b9415947d7d704b8dde91 (diff) | |
| download | rabbitmq-server-git-7ba04a6a681e3e3f805b582a7f0aa3f8361c248a.tar.gz | |
Filter out default exchange bindings that may already be in the database
This avoids duplicates after an existing installation is upgraded.
References #1721.
| -rw-r--r-- | src/rabbit_binding.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 635388db4f..258e85ffa2 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -255,9 +255,14 @@ list(VHostPath) -> destination = VHostResource, _ = '_'}, _ = '_'}, - implicit_bindings(VHostPath) ++ - [B || #route{binding = B} <- mnesia:dirty_match_object(rabbit_route, - Route)]. + %% if there are any default exchange bindings left after an upgrade + %% of a pre-3.8 database, filter them out + AllBindings = [B || #route{binding = B} <- mnesia:dirty_match_object(rabbit_route, + Route)], + Filtered = lists:filter(fun(#binding{source = S}) -> + S =/= ?DEFAULT_EXCHANGE(VHostPath) + end, AllBindings), + implicit_bindings(VHostPath) ++ Filtered. list_for_source(?DEFAULT_EXCHANGE(VHostPath)) -> implicit_bindings(VHostPath); |
