summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-03-09 16:39:59 +0000
committerMatthew Sackman <matthew@rabbitmq.com>2011-03-09 16:39:59 +0000
commit0c83a88f5af258d56c891991e0e9fa45b8c1fcaf (patch)
tree13d5ef432dee380eb0421c09e9249c9bc7f5b9ed /src
parent82435afc8e946bbf487b779ee92c6fa7ac1583f3 (diff)
downloadrabbitmq-server-git-0c83a88f5af258d56c891991e0e9fa45b8c1fcaf.tar.gz
There's a chance that might be it
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mirror_queue_slave.erl24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl
index 8c765d3c7d..6369e11463 100644
--- a/src/rabbit_mirror_queue_slave.erl
+++ b/src/rabbit_mirror_queue_slave.erl
@@ -397,12 +397,12 @@ promote_me(From, #state { q = Q,
%% published via gm only, and confirmed; pending publication
%% from channel.
%%
- %% The middle form only, needs to go through to the queue_process
- %% state to form the msg_id_to_channel mapping (MTC).
- %%
%% The two outer forms only, need to go to the master state
%% seen_status (SS).
%%
+ %% The middle form only, needs to go through to the queue_process
+ %% state to form the msg_id_to_channel mapping (MTC).
+ %%
%% No messages that are enqueued from SQ at this point will have
%% entries in MS.
%%
@@ -411,15 +411,21 @@ promote_me(From, #state { q = Q,
%% this does not affect MS, nor which bits go through to SS in
%% Master, or MTC in queue_process.
+ SS = dict:filter(fun ({published, _ChPid}) -> true;
+ ({published, _ChPid, _MsgSeqNo}) -> false;
+ ({confirmed, _ChPid}) -> true
+ end, MS),
+
MasterState = rabbit_mirror_queue_master:promote_backing_queue_state(
- CPid, BQ, BQS, GM, MS),
+ CPid, BQ, BQS, GM, SS),
- MTC = dict:from_list(
- [{MsgId, {ChPid, MsgSeqNo}} ||
- {MsgId, {published, ChPid, MsgSeqNo}} <- dict:to_list(MS)]),
+ MTC = dict:filter(fun ({published, _ChPid}) -> false;
+ ({published, _ChPid, _MsgSeqNo}) -> true;
+ ({confirmed, _ChPid}) -> false
+ end, MS),
AckTags = [AckTag || {_MsgId, AckTag} <- dict:to_list(MA)],
- Deliveries = lists:append([queue:to_list(PubQ)
- || {_ChPid, PubQ} <- dict:to_list(SQ)]),
+ Deliveries = [Delivery || {_ChPid, PubQ} <- dict:to_list(SQ),
+ {Delivery, true} <- queue:to_list(PubQ)],
QueueState = rabbit_amqqueue_process:init_with_backing_queue_state(
Q, rabbit_mirror_queue_master, MasterState, RateTRef,
AckTags, Deliveries, MTC),