diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2012-11-22 13:10:24 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2012-11-22 13:10:24 +0000 |
| commit | f99023b923d4670bc49578321c23798bb12e061f (patch) | |
| tree | b62425791c5146f0176ba1469a1899d606a6d8d9 | |
| parent | 156e38650dcd268971b72314ddf3fdff13b2c85f (diff) | |
| download | rabbitmq-server-git-f99023b923d4670bc49578321c23798bb12e061f.tar.gz | |
Fix a race where we decide on the BQ before writing the #amqqueue{} to Mnesia, then the policy changes and we are therefore not notified. We now only make the initial decision after we can be assured we will be informed of subsequent changes.
| -rw-r--r-- | src/rabbit_amqqueue_process.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 6af43193f8..6f8c930588 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -122,11 +122,10 @@ info_keys() -> ?INFO_KEYS. init(Q) -> process_flag(trap_exit, true), - State = #q{q = Q#amqqueue{pid = self()}, exclusive_consumer = none, has_had_consumers = false, - backing_queue = backing_queue_module(Q), + backing_queue = undefined, backing_queue_state = undefined, active_consumers = queue:new(), expires = undefined, @@ -193,7 +192,7 @@ code_change(_OldVsn, State, _Extra) -> %%---------------------------------------------------------------------------- declare(Recover, From, State = #q{q = Q, - backing_queue = BQ, + backing_queue = undefined, backing_queue_state = undefined}) -> case rabbit_amqqueue:internal_declare(Q, Recover =/= new) of #amqqueue{} = Q1 -> @@ -205,9 +204,11 @@ declare(Recover, From, State = #q{q = Q, ok = rabbit_memory_monitor:register( self(), {rabbit_amqqueue, set_ram_duration_target, [self()]}), + BQ = backing_queue_module(Q1), BQS = bq_init(BQ, Q, Recover), recovery_barrier(Recover), - State1 = process_args(State#q{backing_queue_state = BQS}), + State1 = process_args(State#q{backing_queue = BQ, + backing_queue_state = BQS}), rabbit_event:notify(queue_created, infos(?CREATION_EVENT_KEYS, State1)), rabbit_event:if_enabled(State1, #q.stats_timer, |
