move to use LinkedBlockingQueue instead of LinkedTransferQueue so we eagerly clear memory when a new translog is created
This commit is contained in:
parent
4ead4f5855
commit
5b231c68f8
|
@ -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<Operation> operations = new LinkedTransferQueue<Operation>();
|
||||
// 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<Operation> operations = new LinkedBlockingQueue<Operation>();
|
||||
|
||||
@Inject public MemoryTranslog(ShardId shardId, @IndexSettings Settings indexSettings) {
|
||||
super(shardId, indexSettings);
|
||||
|
|
Loading…
Reference in New Issue