diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-12-15 13:11:40 +0000 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-12-15 13:11:40 +0000 |
| commit | a38cf00a8179ed38181756b178245724bd7d24a8 (patch) | |
| tree | e94e20e4900b678f8a9499809fc68b566c4b2ce3 | |
| parent | 4fecf7d54eaa370465b6a7343ae88682adfa5edc (diff) | |
| download | rabbitmq-server-git-a38cf00a8179ed38181756b178245724bd7d24a8.tar.gz | |
qi: all_segment_nums was not returning its list sorted. As a result, find_lowest_seq_id_seg_and_next_seq_id could return the wrong values. vq: because of the bug in qi, vq could construct γ wrongly, violating the vq invariants. This would lead to explosions elsewhere.
| -rw-r--r-- | src/rabbit_queue_index.erl | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 003e2d625d..2007b00eab 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -384,15 +384,16 @@ maybe_flush_journal(State) -> State. all_segment_nums(#qistate { dir = Dir, segments = Segments }) -> - sets:to_list( - lists:foldl( - fun (SegName, Set) -> - sets:add_element( - list_to_integer( - lists:takewhile(fun(C) -> $0 =< C andalso C =< $9 end, - SegName)), Set) - end, sets:from_list(segment_fetch_keys(Segments)), - filelib:wildcard("*" ++ ?SEGMENT_EXTENSION, Dir))). + lists:sort( + sets:to_list( + lists:foldl( + fun (SegName, Set) -> + sets:add_element( + list_to_integer( + lists:takewhile(fun(C) -> $0 =< C andalso C =< $9 end, + SegName)), Set) + end, sets:from_list(segment_fetch_keys(Segments)), + filelib:wildcard("*" ++ ?SEGMENT_EXTENSION, Dir)))). blank_state(QueueName) -> StrName = queue_name_to_dir_name(QueueName), |
