diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java index 4ca747d2395..872eeaaf721 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/translog/memory/MemoryTranslog.java @@ -27,12 +27,12 @@ import org.elasticsearch.index.translog.TranslogException; import org.elasticsearch.util.SizeUnit; import org.elasticsearch.util.SizeValue; import org.elasticsearch.util.concurrent.ThreadSafe; -import org.elasticsearch.util.concurrent.jsr166y.LinkedTransferQueue; import org.elasticsearch.util.guice.inject.Inject; import org.elasticsearch.util.settings.Settings; import java.util.ArrayList; import java.util.Queue; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicLong; /** @@ -49,7 +49,10 @@ public class MemoryTranslog extends AbstractIndexShardComponent implements Trans private volatile long id; - private final Queue operations = new LinkedTransferQueue(); + // we use LinkedBlockingQueue and not LinkedTransferQueue since we clear it on #newTranslog + // and with LinkedTransferQueue, nodes are not really cleared, just marked causing for memory + // not to be cleaned properly (besides, clear is heavy..., "while ... poll"). + private final Queue operations = new LinkedBlockingQueue(); @Inject public MemoryTranslog(ShardId shardId, @IndexSettings Settings indexSettings) { super(shardId, indexSettings);