|
@@ -35,8 +35,6 @@ import org.elasticsearch.index.store.distributor.LeastUsedDistributor;
|
|
|
import org.elasticsearch.index.store.distributor.RandomWeightedDistributor;
|
|
|
import org.elasticsearch.test.DummyShardLock;
|
|
|
import org.elasticsearch.test.ElasticsearchLuceneTestCase;
|
|
|
-import org.junit.AfterClass;
|
|
|
-import org.junit.BeforeClass;
|
|
|
import org.junit.Test;
|
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
@@ -55,7 +53,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
public void testRefCount() throws IOException {
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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);
|
|
|
for (int i = 0; i < incs; i++) {
|
|
|
if (randomBoolean()) {
|
|
@@ -117,7 +115,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
DirectoryService directoryService = new LuceneManagedDirectoryService(random());
|
|
|
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);
|
|
|
Store.OnCloseListener listener = new Store.OnCloseListener() {
|
|
|
@Override
|
|
@@ -251,7 +249,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
public void testWriteLegacyChecksums() throws IOException {
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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
|
|
|
final boolean usesOldCodec = randomBoolean();
|
|
|
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 {
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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
|
|
|
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(actualDefaultCodec()));
|
|
|
int docs = 1 + random().nextInt(100);
|
|
@@ -392,7 +390,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
public void testMixedChecksums() throws IOException {
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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....
|
|
|
IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(actualDefaultCodec()));
|
|
|
int docs = 1 + random().nextInt(100);
|
|
@@ -484,7 +482,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
public void testRenameFile() throws IOException {
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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);
|
|
|
int iters = scaledRandomIntBetween(10, 100);
|
|
@@ -772,7 +770,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
iwc.setMaxThreadStates(1);
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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);
|
|
|
final boolean lotsOfSegments = rarely(random);
|
|
|
for (Document d : docs) {
|
|
@@ -803,7 +801,7 @@ public class StoreTest extends ElasticsearchLuceneTestCase {
|
|
|
iwc.setMaxThreadStates(1);
|
|
|
final ShardId shardId = new ShardId(new Index("index"), 1);
|
|
|
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);
|
|
|
final boolean lotsOfSegments = rarely(random);
|
|
|
for (Document d : docs) {
|