Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix compaction bug: flush compaction queue if it's too old.

The compaction queue needs to be flushed if either it's grown too
large or it's been too long since the last flush.  That second
condition wasn't implemented properly because the timestamp that
tracks the time at which we last flushed was never set and always
remained 0.  This would only impact very low-traffic TSDs that
never manage to exceed the threshold on the size of the queue.

Thanks to Brent Evans for spotting and reporting this bug.
  • Loading branch information...
commit eda7d24f75408244f1ed372f5098d304ea2a09d0 1 parent c3f94de
@tsuna tsuna authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/core/CompactionQueue.java
View
3  src/core/CompactionQueue.java
@@ -879,8 +879,9 @@ public void run() {
// or (2) we have too many rows to recompact already.
// Note that in the case (2) we might not be able to flush anything
// if the rows aren't old enough.
- if (last_flush - now > Const.MAX_TIMESPAN // (1)
+ if (now - last_flush > Const.MAX_TIMESPAN // (1)
|| size > maxflushes) { // (2)
+ last_flush = now;
flush(now / 1000 - Const.MAX_TIMESPAN - 1, maxflushes);
if (LOG.isDebugEnabled()) {
final int newsize = size();
Please sign in to comment.
Something went wrong with that request. Please try again.