summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2010-05-10 19:26:09 +0100
committerMatthias Radestock <matthias@lshift.net>2010-05-10 19:26:09 +0100
commitc4a0ea1d28dad8d10dc13cc90fd2170e490149fa (patch)
tree8f98ee1688b58ef7fdfc089f5ee35504ef0efb71
parent0909e6d20ee72fcfb8c57d24f8ef90151be8904b (diff)
downloadrabbitmq-server-git-c4a0ea1d28dad8d10dc13cc90fd2170e490149fa.tar.gz
correct harmless off-by-one mistake
a gc can only take place if we have at least three files - the current file (which we cannot gc), the source file and the destination file. We do a quick check wether there is enough data - garbage or otherwise - to require more than two files. This can give false positives since the last message in a file can overrun the limit, but that's ok as the code that follows performs more accurate (but also more expensive) checks.
-rw-r--r--src/rabbit_msg_store.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index ed7b55f243..cc1397734a 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -1438,8 +1438,8 @@ maybe_compact(State = #msstate { sum_valid_data = SumValid,
gc_active = false,
gc_pid = GCPid,
file_summary_ets = FileSummaryEts })
- when SumFileSize >= 3 * ?FILE_SIZE_LIMIT andalso
- (SumFileSize - SumValid) / SumFileSize > ?GARBAGE_FRACTION ->
+ when (SumFileSize > 2 * ?FILE_SIZE_LIMIT andalso
+ (SumFileSize - SumValid) / SumFileSize > ?GARBAGE_FRACTION) ->
case ets:first(FileSummaryEts) of
'$end_of_table' ->
State;