diff options
-rw-r--r-- | src/rabbit_amqqueue.erl | 22 | ||||
-rw-r--r-- | src/rabbit_msg_store.erl | 5 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index e5a113ae..77dbf03d 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -187,15 +187,23 @@ internal_declare(Q = #amqqueue{name = QueueName}, WantDefaultBinding) -> %% another node, beyond the knowledge of our own %% local queue_sup. case mnesia:wread({rabbit_queue, QueueName}) of - [] -> ok = store_queue(Q), - case WantDefaultBinding of - true -> add_default_binding(Q); - false -> ok - end, - Q; - [ExistingQ] -> ExistingQ + [] -> + case mnesia:read( + {rabbit_durable_queue, QueueName}) of + [] -> ok = store_queue(Q), + case WantDefaultBinding of + true -> add_default_binding(Q); + false -> ok + end, + Q; + [_] -> not_found %% existing Q on stopped node + end; + [ExistingQ] -> + ExistingQ end end) of + not_found -> exit(Q#amqqueue.pid, shutdown), + rabbit_misc:not_found(QueueName); Q -> Q; ExistingQ -> exit(Q#amqqueue.pid, shutdown), ExistingQ diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 6306ac32..c8d27ba6 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -405,9 +405,8 @@ handle_info({file_handle_cache, maximum_eldest_since_use, Age}, State) -> ok = file_handle_cache:set_maximum_since_use(Age), noreply(State); -handle_info({'EXIT', _Pid, normal}, State) -> - %% this is just the GC process going down - noreply(State). +handle_info({'EXIT', _Pid, Reason}, State) -> + {stop, Reason, State}. terminate(_Reason, State = #msstate { msg_locations = MsgLocations, file_summary = FileSummary, |