diff options
| author | Emile Joubert <emile@rabbitmq.com> | 2013-04-09 15:06:22 +0100 |
|---|---|---|
| committer | Emile Joubert <emile@rabbitmq.com> | 2013-04-09 15:06:22 +0100 |
| commit | 974dad425efc3e25d35c49b988973569f63a8b61 (patch) | |
| tree | 552fa5777d684c62e6613c99d06835296b6ce901 /src | |
| parent | 1977e9490ab0a909a861fb9ee2804824e4b2523a (diff) | |
| parent | 9c2fbd300ff5e6a16978e7b11f3e221d2756616f (diff) | |
| download | rabbitmq-server-git-974dad425efc3e25d35c49b988973569f63a8b61.tar.gz | |
Merged bug25514
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_msg_store.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl index c2d8e06e90..112d1ce280 100644 --- a/src/rabbit_msg_store.erl +++ b/src/rabbit_msg_store.erl @@ -51,6 +51,9 @@ -define(HANDLE_CACHE_BUFFER_SIZE, 1048576). %% 1MB + %% i.e. two pairs, so GC does not go idle when busy +-define(MAXIMUM_SIMULTANEOUS_GC_FILES, 4). + %%---------------------------------------------------------------------------- -record(msstate, @@ -1731,10 +1734,12 @@ maybe_compact(State = #msstate { sum_valid_data = SumValid, (SumFileSize - SumValid) / SumFileSize > ?GARBAGE_FRACTION -> %% TODO: the algorithm here is sub-optimal - it may result in a %% complete traversal of FileSummaryEts. - case ets:first(FileSummaryEts) of - '$end_of_table' -> + First = ets:first(FileSummaryEts), + case First =:= '$end_of_table' orelse + orddict:size(Pending) >= ?MAXIMUM_SIMULTANEOUS_GC_FILES of + true -> State; - First -> + false -> case find_files_to_combine(FileSummaryEts, FileSizeLimit, ets:lookup(FileSummaryEts, First)) of not_found -> |
