summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-06-17 18:04:06 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2013-06-17 18:04:06 +0100
commit20b2579d49b94073c45ea12e192a3d48bb62c61f (patch)
tree50118bfd511b48753b703d2813eee510adc22f16 /src
parent6f7065945494a8dc49324e446e55352dec2b7a59 (diff)
downloadrabbitmq-server-git-20b2579d49b94073c45ea12e192a3d48bb62c61f.tar.gz
cosmetic: state the not-immediatly-obvious
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};