diff options
| author | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-14 20:12:52 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-14 20:12:52 +0100 |
| commit | 0c14e210ca1d08adac5239c264e24c209a2c0489 (patch) | |
| tree | 0cca9dbec18fb316ee79a2d580426cafff2ca2da /src | |
| parent | 7890666d64704e08f82a748ba76adddae83fb937 (diff) | |
| download | rabbitmq-server-git-0c14e210ca1d08adac5239c264e24c209a2c0489.tar.gz | |
A msg can appear > once in the same file because of multiple queues receiving the same msg. When we iterate through the msgs we find in the file, we must check that the msg corresponds to the msg in the index, by matching not just with guid but also with offset. Also just for fun, assert the total_size matches. Also, fixed a mistake in file_handle_cache where the dirty flag on the destination of copy wasn't being set.
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_handle_cache.erl | 3 | ||||
| -rw-r--r-- | src/rabbit_msg_store.erl | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index 5b3485807d..8db5a7944b 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -382,7 +382,8 @@ copy(Src, Dest, Count) -> {ok, Count1} = Result1 -> {Result1, [SHandle #handle { offset = SOffset + Count1 }, - DHandle #handle { offset = DOffset + Count1 }]}; + DHandle #handle { offset = DOffset + Count1, + is_dirty = true }]}; Error -> {Error, [SHandle, DHandle]} end; diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index c7ebfd97f7..60fcd25896 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -1671,9 +1671,10 @@ find_unremoved_messages_in_file(File, {ok, Messages, _FileSize} = scan_file_for_valid_messages(Dir, filenum_to_name(File)), %% foldl will reverse so will end up with msgs in ascending offset order - lists:foldl(fun ({Guid, TotalSize, _Offset}, Acc = {List, Size}) -> + lists:foldl(fun ({Guid, TotalSize, Offset}, Acc = {List, Size}) -> case Index:lookup(Guid, IndexState) of - #msg_location { file = File } = Entry -> + #msg_location { file = File, total_size = TotalSize, + offset = Offset } = Entry -> {[ Entry | List ], TotalSize + Size}; _ -> Acc |
