summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-08-14 20:27:07 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-08-14 20:27:07 +0100
commit60dfe6e6eb87c28156bffceaf1b660b81fd5fd40 (patch)
tree1cf155e4c69146c667fd433111214187eba7d073
parent70005c42e1c5c40df7f75532392d39cd540b12e9 (diff)
downloadrabbitmq-server-60dfe6e6eb87c28156bffceaf1b660b81fd5fd40.tar.gz
When recovering, because of the possibility of finding the same msg twice, ensure that we only count and include the first copy. Other copies are then ignored.
-rw-r--r--src/rabbit_msg_store.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index 60fcd258..46b4582d 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -1199,6 +1199,7 @@ count_msg_refs(Gen, Seed, State) ->
ok = case index_lookup(Guid, State) of
not_found ->
index_insert(#msg_location { guid = Guid,
+ file = undefined,
ref_count = Delta },
State);
#msg_location { ref_count = RefCount } = StoreEntry ->
@@ -1409,14 +1410,14 @@ build_index_worker(Gatherer, State = #msstate { dir = Dir },
lists:foldl(
fun (Obj = {Guid, TotalSize, Offset}, {VMAcc, VTSAcc}) ->
case index_lookup(Guid, State) of
- not_found ->
- {VMAcc, VTSAcc};
- StoreEntry ->
+ StoreEntry = #msg_location { file = undefined } ->
ok = index_update(StoreEntry #msg_location {
file = File, offset = Offset,
total_size = TotalSize },
State),
- {[Obj | VMAcc], VTSAcc + TotalSize}
+ {[Obj | VMAcc], VTSAcc + TotalSize};
+ _ ->
+ {VMAcc, VTSAcc}
end
end, {[], 0}, Messages),
%% foldl reverses lists, find_contiguous_block_prefix needs