summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-06-17 18:04:25 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2013-06-17 18:04:25 +0100
commitb47d8173ca58fb4939edbdd35ab51e2ae347eb85 (patch)
treef9bd3485a80a197d4f32ae39024f08df54851505 /src
parentc4acf73d03824c83b4e3f7c4ae09130cbc6dacfb (diff)
parent20b2579d49b94073c45ea12e192a3d48bb62c61f (diff)
downloadrabbitmq-server-git-b47d8173ca58fb4939edbdd35ab51e2ae347eb85.tar.gz
merge stable into default
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_msg_store.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index 7c2aa13c78..b783aa1890 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -978,7 +978,7 @@ update_flying(Diff, MsgId, CRef, #msstate { flying_ets = FlyingEts }) ->
NDiff = -Diff,
case ets:lookup(FlyingEts, Key) of
[] -> ignore;
- [{_, Diff}] -> ignore;
+ [{_, Diff}] -> ignore; %% [1]
[{_, NDiff}] -> ets:update_counter(FlyingEts, Key, {2, Diff}),
true = ets:delete_object(FlyingEts, {Key, 0}),
process;
@@ -986,6 +986,13 @@ update_flying(Diff, MsgId, CRef, #msstate { flying_ets = FlyingEts }) ->
ignore;
[{_, Err}] -> throw({bad_flying_ets_record, Diff, Err, Key})
end.
+%% [1] We can get here, for example, in the following scenario: There
+%% is a write followed by a remove in flight. The counter will be 0,
+%% so on processing the write the server attempts to delete the
+%% entry. If at that point the client injects another write it will
+%% either insert a new entry, containing +1, or increment the existing
+%% entry to +1, thus preventing its removal. Either way therefore when
+%% the server processes the read, the counter will be +1.
write_action({true, not_found}, _MsgId, State) ->
{ignore, undefined, State};