diff options
| author | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-14 20:27:07 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-14 20:27:07 +0100 |
| commit | 7b05055eb9ae4d2b7a0a291d03bdc04ad286e556 (patch) | |
| tree | 1cf155e4c69146c667fd433111214187eba7d073 | |
| parent | 0c14e210ca1d08adac5239c264e24c209a2c0489 (diff) | |
| download | rabbitmq-server-git-7b05055eb9ae4d2b7a0a291d03bdc04ad286e556.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.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index 60fcd25896..46b4582d23 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 |
