don't schedule a flush if there are no operations in the translog

this can happen with the 30m time base setting expires
This commit is contained in:
Shay Banon 2014-01-07 18:53:51 +01:00
parent 2cb40fcb17
commit abf68c472e
1 changed files with 6 additions and 1 deletions

View File

@ -145,8 +145,13 @@ public class TranslogService extends AbstractIndexShardComponent {
return; return;
} }
int currentNumberOfOperations = translog.estimatedNumberOfOperations();
if (currentNumberOfOperations == 0) {
reschedule();
return;
}
if (flushThresholdOperations > 0) { if (flushThresholdOperations > 0) {
int currentNumberOfOperations = translog.estimatedNumberOfOperations();
if (currentNumberOfOperations > flushThresholdOperations) { if (currentNumberOfOperations > flushThresholdOperations) {
logger.trace("flushing translog, operations [{}], breached [{}]", currentNumberOfOperations, flushThresholdOperations); logger.trace("flushing translog, operations [{}], breached [{}]", currentNumberOfOperations, flushThresholdOperations);
asyncFlushAndReschedule(); asyncFlushAndReschedule();