summaryrefslogtreecommitdiff
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
commitb106047a4df6a5d230097a4ada549be69fade0c7 (patch)
tree50118bfd511b48753b703d2813eee510adc22f16
parent4ce8175ae3c026f2a1b190216243e9a6950756c8 (diff)
downloadrabbitmq-server-b106047a4df6a5d230097a4ada549be69fade0c7.tar.gz
cosmetic: state the not-immediatly-obvious
-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 7c2aa13c..b783aa18 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};