summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-05-31 13:31:39 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-05-31 13:31:39 +0100
commit79b05bef4e1eeed3db0f222fd94fad78d09c4135 (patch)
tree21ca1d832eeb701629b61ea02ffa9138fb75da87
parent4baf7769574fe1afb76648d9351f785595191787 (diff)
downloadrabbitmq-server-bug25576.tar.gz
Attempt to deal with missing segment file.bug25576
-rw-r--r--src/rabbit_queue_index.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index ea70208f..9a2d2a4a 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -1022,7 +1022,18 @@ journal_minus_segment1({no_pub, del, ack}, {?PUB, no_del, no_ack}) ->
journal_minus_segment1({no_pub, del, ack}, {?PUB, del, no_ack}) ->
{{no_pub, no_del, ack}, 0};
journal_minus_segment1({no_pub, del, ack}, {?PUB, del, ack}) ->
- {undefined, -1}.
+ {undefined, -1};
+
+%% Missing segment. If flush_journal/1 is interrupted after deleting
+%% the segment but before truncating the journal we can get these
+%% cases: a delivery and an acknowledgement in the journal, or just an
+%% acknowledgement in the journal, but with no segment. In both cases
+%% we have really forgotten the message; so ignore what's in the
+%% journal.
+journal_minus_segment1({no_pub, no_del, ack}, undefined) ->
+ {undefined, 0};
+journal_minus_segment1({no_pub, del, ack}, undefined) ->
+ {undefined, 0}.
%%----------------------------------------------------------------------------
%% upgrade