Remove unused member / argument on Store
This commit is contained in:
parent
9b5b281fe8
commit
942e752ac1
|
@ -88,7 +88,6 @@ public class Store extends AbstractIndexShardComponent implements Closeable, Ref
|
||||||
private static final String CORRUPTED = "corrupted_";
|
private static final String CORRUPTED = "corrupted_";
|
||||||
|
|
||||||
private final AtomicBoolean isClosed = new AtomicBoolean(false);
|
private final AtomicBoolean isClosed = new AtomicBoolean(false);
|
||||||
private final CodecService codecService;
|
|
||||||
private final DirectoryService directoryService;
|
private final DirectoryService directoryService;
|
||||||
private final StoreDirectory directory;
|
private final StoreDirectory directory;
|
||||||
private final ReentrantReadWriteLock metadataLock = new ReentrantReadWriteLock();
|
private final ReentrantReadWriteLock metadataLock = new ReentrantReadWriteLock();
|
||||||
|
@ -104,9 +103,8 @@ public class Store extends AbstractIndexShardComponent implements Closeable, Ref
|
||||||
private volatile OnCloseListener onClose;
|
private volatile OnCloseListener onClose;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Store(ShardId shardId, @IndexSettings Settings indexSettings, CodecService codecService, DirectoryService directoryService, Distributor distributor, ShardLock shardLock) throws IOException {
|
public Store(ShardId shardId, @IndexSettings Settings indexSettings, DirectoryService directoryService, Distributor distributor, ShardLock shardLock) throws IOException {
|
||||||
super(shardId, indexSettings);
|
super(shardId, indexSettings);
|
||||||
this.codecService = codecService;
|
|
||||||
this.directoryService = directoryService;
|
this.directoryService = directoryService;
|
||||||
this.directory = new StoreDirectory(directoryService.newFromDistributor(distributor));
|
this.directory = new StoreDirectory(directoryService.newFromDistributor(distributor));
|
||||||
this.shardLock = shardLock;
|
this.shardLock = shardLock;
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class InternalEngineTests extends ElasticsearchTestCase {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return new Store(shardId, EMPTY_SETTINGS, null, directoryService, new LeastUsedDistributor(directoryService), new DummyShardLock(shardId));
|
return new Store(shardId, EMPTY_SETTINGS, directoryService, new LeastUsedDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Store createStoreReplica() throws IOException {
|
protected Store createStoreReplica() throws IOException {
|
||||||
|
@ -199,7 +199,7 @@ public class InternalEngineTests extends ElasticsearchTestCase {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return new Store(shardId, EMPTY_SETTINGS, null, directoryService, new LeastUsedDistributor(directoryService), new DummyShardLock(shardId));
|
return new Store(shardId, EMPTY_SETTINGS, directoryService, new LeastUsedDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Translog createTranslog() throws IOException {
|
protected Translog createTranslog() throws IOException {
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return new Store(shardId, settings, null, directoryService, new LeastUsedDistributor(directoryService), new DummyShardLock(shardId));
|
return new Store(shardId, settings, directoryService, new LeastUsedDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,6 @@ import org.elasticsearch.index.store.distributor.LeastUsedDistributor;
|
||||||
import org.elasticsearch.index.store.distributor.RandomWeightedDistributor;
|
import org.elasticsearch.index.store.distributor.RandomWeightedDistributor;
|
||||||
import org.elasticsearch.test.DummyShardLock;
|
import org.elasticsearch.test.DummyShardLock;
|
||||||
import org.elasticsearch.test.ElasticsearchLuceneTestCase;
|
import org.elasticsearch.test.ElasticsearchLuceneTestCase;
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
@ -55,7 +53,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
public void testRefCount() throws IOException {
|
public void testRefCount() throws IOException {
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
int incs = randomIntBetween(1, 100);
|
int incs = randomIntBetween(1, 100);
|
||||||
for (int i = 0; i < incs; i++) {
|
for (int i = 0; i < incs; i++) {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
|
@ -117,7 +115,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
||||||
final ShardLock shardLock = new DummyShardLock(shardId);
|
final ShardLock shardLock = new DummyShardLock(shardId);
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(directoryService), shardLock);
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(directoryService), shardLock);
|
||||||
final AtomicBoolean called = new AtomicBoolean(false);
|
final AtomicBoolean called = new AtomicBoolean(false);
|
||||||
Store.OnCloseListener listener = new Store.OnCloseListener() {
|
Store.OnCloseListener listener = new Store.OnCloseListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -251,7 +249,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
public void testWriteLegacyChecksums() throws IOException {
|
public void testWriteLegacyChecksums() throws IOException {
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
// set default codec - all segments need checksums
|
// set default codec - all segments need checksums
|
||||||
final boolean usesOldCodec = randomBoolean();
|
final boolean usesOldCodec = randomBoolean();
|
||||||
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(usesOldCodec ? new OldSIMockingCodec() : actualDefaultCodec()));
|
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(usesOldCodec ? new OldSIMockingCodec() : actualDefaultCodec()));
|
||||||
|
@ -332,7 +330,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
public void testNewChecksums() throws IOException {
|
public void testNewChecksums() throws IOException {
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
// set default codec - all segments need checksums
|
// set default codec - all segments need checksums
|
||||||
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(actualDefaultCodec()));
|
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(actualDefaultCodec()));
|
||||||
int docs = 1 + random().nextInt(100);
|
int docs = 1 + random().nextInt(100);
|
||||||
|
@ -392,7 +390,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
public void testMixedChecksums() throws IOException {
|
public void testMixedChecksums() throws IOException {
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
// this time random codec....
|
// this time random codec....
|
||||||
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(actualDefaultCodec()));
|
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(actualDefaultCodec()));
|
||||||
int docs = 1 + random().nextInt(100);
|
int docs = 1 + random().nextInt(100);
|
||||||
|
@ -484,7 +482,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
public void testRenameFile() throws IOException {
|
public void testRenameFile() throws IOException {
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random(), false);
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random(), false);
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(directoryService), new DummyShardLock(shardId));
|
||||||
{
|
{
|
||||||
IndexOutput output = store.directory().createOutput("foo.bar", IOContext.DEFAULT);
|
IndexOutput output = store.directory().createOutput("foo.bar", IOContext.DEFAULT);
|
||||||
int iters = scaledRandomIntBetween(10, 100);
|
int iters = scaledRandomIntBetween(10, 100);
|
||||||
|
@ -772,7 +770,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
iwc.setMaxThreadStates(1);
|
iwc.setMaxThreadStates(1);
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random);
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random);
|
||||||
Store store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(random, directoryService), new DummyShardLock(shardId));
|
Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(random, directoryService), new DummyShardLock(shardId));
|
||||||
IndexWriter writer = new IndexWriter(store.directory(), iwc);
|
IndexWriter writer = new IndexWriter(store.directory(), iwc);
|
||||||
final boolean lotsOfSegments = rarely(random);
|
final boolean lotsOfSegments = rarely(random);
|
||||||
for (Document d : docs) {
|
for (Document d : docs) {
|
||||||
|
@ -803,7 +801,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
||||||
iwc.setMaxThreadStates(1);
|
iwc.setMaxThreadStates(1);
|
||||||
final ShardId shardId = new ShardId(new Index("index"), 1);
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
DirectoryService directoryService = new LuceneManagedDirectoryService(random);
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random);
|
||||||
store = new Store(shardId, ImmutableSettings.EMPTY, null, directoryService, randomDistributor(random, directoryService), new DummyShardLock(shardId));
|
store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, randomDistributor(random, directoryService), new DummyShardLock(shardId));
|
||||||
IndexWriter writer = new IndexWriter(store.directory(), iwc);
|
IndexWriter writer = new IndexWriter(store.directory(), iwc);
|
||||||
final boolean lotsOfSegments = rarely(random);
|
final boolean lotsOfSegments = rarely(random);
|
||||||
for (Document d : docs) {
|
for (Document d : docs) {
|
||||||
|
|
Loading…
Reference in New Issue