parent
e89d5d0d86
commit
8247e4beae
|
@ -4,7 +4,7 @@
|
||||||
The refresh API allows to explicitly refresh one or more index, making
|
The refresh API allows to explicitly refresh one or more index, making
|
||||||
all operations performed since the last refresh available for search.
|
all operations performed since the last refresh available for search.
|
||||||
The (near) real-time capabilities depend on the index engine used. For
|
The (near) real-time capabilities depend on the index engine used. For
|
||||||
example, the robin one requires refresh to be called, but by default a
|
example, the internal one requires refresh to be called, but by default a
|
||||||
refresh is scheduled periodically.
|
refresh is scheduled periodically.
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time
|
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time
|
||||||
* capabilities depends on the index engine used. For example, the robin one requires refresh to be called, but by
|
* capabilities depends on the index engine used. For example, the internal one requires refresh to be called, but by
|
||||||
* default a refresh is scheduled periodically.
|
* default a refresh is scheduled periodically.
|
||||||
*
|
*
|
||||||
* @see org.elasticsearch.client.Requests#refreshRequest(String...)
|
* @see org.elasticsearch.client.Requests#refreshRequest(String...)
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time
|
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time
|
||||||
* capabilities depends on the index engine used. For example, the robin one requires refresh to be called, but by
|
* capabilities depends on the index engine used. For example, the internal one requires refresh to be called, but by
|
||||||
* default a refresh is scheduled periodically.
|
* default a refresh is scheduled periodically.
|
||||||
*/
|
*/
|
||||||
public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
|
public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class SnapshotDeletionPolicy extends AbstractESDeletionPolicy {
|
||||||
@Override
|
@Override
|
||||||
public IndexDeletionPolicy clone() {
|
public IndexDeletionPolicy clone() {
|
||||||
// Lucene IW makes a clone internally but since we hold on to this instance
|
// Lucene IW makes a clone internally but since we hold on to this instance
|
||||||
// the clone will just be the identity. See RobinEngine recovery why we need this.
|
// the clone will just be the identity. See InternalEngine recovery why we need this.
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.inject.SpawnModules;
|
import org.elasticsearch.common.inject.SpawnModules;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.engine.robin.RobinEngineModule;
|
import org.elasticsearch.index.engine.internal.InternalEngineModule;
|
||||||
import org.elasticsearch.index.engine.robin.RobinIndexEngineModule;
|
import org.elasticsearch.index.engine.internal.InternalIndexEngineModule;
|
||||||
|
|
||||||
import static org.elasticsearch.common.inject.Modules.createModule;
|
import static org.elasticsearch.common.inject.Modules.createModule;
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ public class IndexEngineModule extends AbstractModule implements SpawnModules {
|
||||||
public static final class EngineSettings {
|
public static final class EngineSettings {
|
||||||
public static final String ENGINE_TYPE = "index.engine.type";
|
public static final String ENGINE_TYPE = "index.engine.type";
|
||||||
public static final String INDEX_ENGINE_TYPE = "index.index_engine.type";
|
public static final String INDEX_ENGINE_TYPE = "index.index_engine.type";
|
||||||
public static final Class<? extends Module> DEFAULT_INDEX_ENGINE = RobinIndexEngineModule.class;
|
public static final Class<? extends Module> DEFAULT_INDEX_ENGINE = InternalIndexEngineModule.class;
|
||||||
public static final Class<? extends Module> DEFAULT_ENGINE = RobinEngineModule.class;
|
public static final Class<? extends Module> DEFAULT_ENGINE = InternalEngineModule.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.engine.robin;
|
package org.elasticsearch.index.engine.internal;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.lucene.index.*;
|
import org.apache.lucene.index.*;
|
||||||
|
@ -89,7 +89,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
public class InternalEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
|
|
||||||
private volatile ByteSizeValue indexingBufferSize;
|
private volatile ByteSizeValue indexingBufferSize;
|
||||||
private volatile int indexConcurrency;
|
private volatile int indexConcurrency;
|
||||||
|
@ -119,7 +119,7 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
|
|
||||||
private volatile IndexWriter indexWriter;
|
private volatile IndexWriter indexWriter;
|
||||||
|
|
||||||
private final SearcherFactory searcherFactory = new RobinSearchFactory();
|
private final SearcherFactory searcherFactory = new SearchFactory();
|
||||||
private volatile SearcherManager searcherManager;
|
private volatile SearcherManager searcherManager;
|
||||||
|
|
||||||
private volatile boolean closed = false;
|
private volatile boolean closed = false;
|
||||||
|
@ -159,11 +159,11 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
private SegmentInfos lastCommittedSegmentInfos;
|
private SegmentInfos lastCommittedSegmentInfos;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RobinEngine(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool,
|
public InternalEngine(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool,
|
||||||
IndexSettingsService indexSettingsService, ShardIndexingService indexingService, @Nullable IndicesWarmer warmer,
|
IndexSettingsService indexSettingsService, ShardIndexingService indexingService, @Nullable IndicesWarmer warmer,
|
||||||
Store store, SnapshotDeletionPolicy deletionPolicy, Translog translog,
|
Store store, SnapshotDeletionPolicy deletionPolicy, Translog translog,
|
||||||
MergePolicyProvider mergePolicyProvider, MergeSchedulerProvider mergeScheduler,
|
MergePolicyProvider mergePolicyProvider, MergeSchedulerProvider mergeScheduler,
|
||||||
AnalysisService analysisService, SimilarityService similarityService, CodecService codecService) throws EngineException {
|
AnalysisService analysisService, SimilarityService similarityService, CodecService codecService) throws EngineException {
|
||||||
super(shardId, indexSettings);
|
super(shardId, indexSettings);
|
||||||
Preconditions.checkNotNull(store, "Store must be provided to the engine");
|
Preconditions.checkNotNull(store, "Store must be provided to the engine");
|
||||||
Preconditions.checkNotNull(deletionPolicy, "Snapshot deletion policy must be provided to the engine");
|
Preconditions.checkNotNull(deletionPolicy, "Snapshot deletion policy must be provided to the engine");
|
||||||
|
@ -694,7 +694,7 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Searcher newSearcher(String source, IndexSearcher searcher, SearcherManager manager) {
|
protected Searcher newSearcher(String source, IndexSearcher searcher, SearcherManager manager) {
|
||||||
return new RobinSearcher(source, searcher, manager);
|
return new EngineSearcher(source, searcher, manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1409,45 +1409,45 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshSettings(Settings settings) {
|
public void onRefreshSettings(Settings settings) {
|
||||||
long gcDeletesInMillis = settings.getAsTime(INDEX_GC_DELETES, TimeValue.timeValueMillis(RobinEngine.this.gcDeletesInMillis)).millis();
|
long gcDeletesInMillis = settings.getAsTime(INDEX_GC_DELETES, TimeValue.timeValueMillis(InternalEngine.this.gcDeletesInMillis)).millis();
|
||||||
if (gcDeletesInMillis != RobinEngine.this.gcDeletesInMillis) {
|
if (gcDeletesInMillis != InternalEngine.this.gcDeletesInMillis) {
|
||||||
logger.info("updating index.gc_deletes from [{}] to [{}]", TimeValue.timeValueMillis(RobinEngine.this.gcDeletesInMillis), TimeValue.timeValueMillis(gcDeletesInMillis));
|
logger.info("updating index.gc_deletes from [{}] to [{}]", TimeValue.timeValueMillis(InternalEngine.this.gcDeletesInMillis), TimeValue.timeValueMillis(gcDeletesInMillis));
|
||||||
RobinEngine.this.gcDeletesInMillis = gcDeletesInMillis;
|
InternalEngine.this.gcDeletesInMillis = gcDeletesInMillis;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean compoundOnFlush = settings.getAsBoolean(INDEX_COMPOUND_ON_FLUSH, RobinEngine.this.compoundOnFlush);
|
final boolean compoundOnFlush = settings.getAsBoolean(INDEX_COMPOUND_ON_FLUSH, InternalEngine.this.compoundOnFlush);
|
||||||
if (compoundOnFlush != RobinEngine.this.compoundOnFlush) {
|
if (compoundOnFlush != InternalEngine.this.compoundOnFlush) {
|
||||||
logger.info("updating {} from [{}] to [{}]", RobinEngine.INDEX_COMPOUND_ON_FLUSH, RobinEngine.this.compoundOnFlush, compoundOnFlush);
|
logger.info("updating {} from [{}] to [{}]", InternalEngine.INDEX_COMPOUND_ON_FLUSH, InternalEngine.this.compoundOnFlush, compoundOnFlush);
|
||||||
RobinEngine.this.compoundOnFlush = compoundOnFlush;
|
InternalEngine.this.compoundOnFlush = compoundOnFlush;
|
||||||
indexWriter.getConfig().setUseCompoundFile(compoundOnFlush);
|
indexWriter.getConfig().setUseCompoundFile(compoundOnFlush);
|
||||||
}
|
}
|
||||||
|
|
||||||
int indexConcurrency = settings.getAsInt(INDEX_INDEX_CONCURRENCY, RobinEngine.this.indexConcurrency);
|
int indexConcurrency = settings.getAsInt(INDEX_INDEX_CONCURRENCY, InternalEngine.this.indexConcurrency);
|
||||||
boolean failOnMergeFailure = settings.getAsBoolean(INDEX_FAIL_ON_MERGE_FAILURE, RobinEngine.this.failOnMergeFailure);
|
boolean failOnMergeFailure = settings.getAsBoolean(INDEX_FAIL_ON_MERGE_FAILURE, InternalEngine.this.failOnMergeFailure);
|
||||||
String codecName = settings.get(INDEX_CODEC, RobinEngine.this.codecName);
|
String codecName = settings.get(INDEX_CODEC, InternalEngine.this.codecName);
|
||||||
final boolean codecBloomLoad = settings.getAsBoolean(CodecService.INDEX_CODEC_BLOOM_LOAD, codecService.isLoadBloomFilter());
|
final boolean codecBloomLoad = settings.getAsBoolean(CodecService.INDEX_CODEC_BLOOM_LOAD, codecService.isLoadBloomFilter());
|
||||||
boolean requiresFlushing = false;
|
boolean requiresFlushing = false;
|
||||||
if (indexConcurrency != RobinEngine.this.indexConcurrency ||
|
if (indexConcurrency != InternalEngine.this.indexConcurrency ||
|
||||||
!codecName.equals(RobinEngine.this.codecName) ||
|
!codecName.equals(InternalEngine.this.codecName) ||
|
||||||
failOnMergeFailure != RobinEngine.this.failOnMergeFailure ||
|
failOnMergeFailure != InternalEngine.this.failOnMergeFailure ||
|
||||||
codecBloomLoad != codecService.isLoadBloomFilter()) {
|
codecBloomLoad != codecService.isLoadBloomFilter()) {
|
||||||
rwl.readLock().lock();
|
rwl.readLock().lock();
|
||||||
try {
|
try {
|
||||||
if (indexConcurrency != RobinEngine.this.indexConcurrency) {
|
if (indexConcurrency != InternalEngine.this.indexConcurrency) {
|
||||||
logger.info("updating index.index_concurrency from [{}] to [{}]", RobinEngine.this.indexConcurrency, indexConcurrency);
|
logger.info("updating index.index_concurrency from [{}] to [{}]", InternalEngine.this.indexConcurrency, indexConcurrency);
|
||||||
RobinEngine.this.indexConcurrency = indexConcurrency;
|
InternalEngine.this.indexConcurrency = indexConcurrency;
|
||||||
// we have to flush in this case, since it only applies on a new index writer
|
// we have to flush in this case, since it only applies on a new index writer
|
||||||
requiresFlushing = true;
|
requiresFlushing = true;
|
||||||
}
|
}
|
||||||
if (!codecName.equals(RobinEngine.this.codecName)) {
|
if (!codecName.equals(InternalEngine.this.codecName)) {
|
||||||
logger.info("updating index.codec from [{}] to [{}]", RobinEngine.this.codecName, codecName);
|
logger.info("updating index.codec from [{}] to [{}]", InternalEngine.this.codecName, codecName);
|
||||||
RobinEngine.this.codecName = codecName;
|
InternalEngine.this.codecName = codecName;
|
||||||
// we want to flush in this case, so the new codec will be reflected right away...
|
// we want to flush in this case, so the new codec will be reflected right away...
|
||||||
requiresFlushing = true;
|
requiresFlushing = true;
|
||||||
}
|
}
|
||||||
if (failOnMergeFailure != RobinEngine.this.failOnMergeFailure) {
|
if (failOnMergeFailure != InternalEngine.this.failOnMergeFailure) {
|
||||||
logger.info("updating {} from [{}] to [{}]", RobinEngine.INDEX_FAIL_ON_MERGE_FAILURE, RobinEngine.this.failOnMergeFailure, failOnMergeFailure);
|
logger.info("updating {} from [{}] to [{}]", InternalEngine.INDEX_FAIL_ON_MERGE_FAILURE, InternalEngine.this.failOnMergeFailure, failOnMergeFailure);
|
||||||
RobinEngine.this.failOnMergeFailure = failOnMergeFailure;
|
InternalEngine.this.failOnMergeFailure = failOnMergeFailure;
|
||||||
}
|
}
|
||||||
if (codecBloomLoad != codecService.isLoadBloomFilter()) {
|
if (codecBloomLoad != codecService.isLoadBloomFilter()) {
|
||||||
logger.info("updating {} from [{}] to [{}]", CodecService.INDEX_CODEC_BLOOM_LOAD, codecService.isLoadBloomFilter(), codecBloomLoad);
|
logger.info("updating {} from [{}] to [{}]", CodecService.INDEX_CODEC_BLOOM_LOAD, codecService.isLoadBloomFilter(), codecBloomLoad);
|
||||||
|
@ -1469,13 +1469,13 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
return new SearcherManager(indexWriter, true, searcherFactory);
|
return new SearcherManager(indexWriter, true, searcherFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class RobinSearcher implements Searcher {
|
static class EngineSearcher implements Searcher {
|
||||||
|
|
||||||
private final String source;
|
private final String source;
|
||||||
private final IndexSearcher searcher;
|
private final IndexSearcher searcher;
|
||||||
private final SearcherManager manager;
|
private final SearcherManager manager;
|
||||||
|
|
||||||
private RobinSearcher(String source, IndexSearcher searcher, SearcherManager manager) {
|
private EngineSearcher(String source, IndexSearcher searcher, SearcherManager manager) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.searcher = searcher;
|
this.searcher = searcher;
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
@ -1542,7 +1542,7 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RobinSearchFactory extends SearcherFactory {
|
class SearchFactory extends SearcherFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexSearcher newSearcher(IndexReader reader) throws IOException {
|
public IndexSearcher newSearcher(IndexReader reader) throws IOException {
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.engine.robin;
|
package org.elasticsearch.index.engine.internal;
|
||||||
|
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.index.engine.Engine;
|
import org.elasticsearch.index.engine.Engine;
|
||||||
|
@ -25,10 +25,10 @@ import org.elasticsearch.index.engine.Engine;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RobinEngineModule extends AbstractModule {
|
public class InternalEngineModule extends AbstractModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Engine.class).to(RobinEngine.class).asEagerSingleton();
|
bind(Engine.class).to(InternalEngine.class).asEagerSingleton();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.engine.robin;
|
package org.elasticsearch.index.engine.internal;
|
||||||
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -31,14 +31,14 @@ import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RobinIndexEngine extends AbstractIndexComponent implements IndexEngine {
|
public class InternalIndexEngine extends AbstractIndexComponent implements IndexEngine {
|
||||||
|
|
||||||
public RobinIndexEngine(Index index) {
|
public InternalIndexEngine(Index index) {
|
||||||
this(index, EMPTY_SETTINGS);
|
this(index, EMPTY_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RobinIndexEngine(Index index, @IndexSettings Settings indexSettings) {
|
public InternalIndexEngine(Index index, @IndexSettings Settings indexSettings) {
|
||||||
super(index, indexSettings);
|
super(index, indexSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.engine.robin;
|
package org.elasticsearch.index.engine.internal;
|
||||||
|
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.index.engine.IndexEngine;
|
import org.elasticsearch.index.engine.IndexEngine;
|
||||||
|
@ -25,10 +25,10 @@ import org.elasticsearch.index.engine.IndexEngine;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RobinIndexEngineModule extends AbstractModule {
|
public class InternalIndexEngineModule extends AbstractModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(IndexEngine.class).to(RobinIndexEngine.class).asEagerSingleton();
|
bind(IndexEngine.class).to(InternalIndexEngine.class).asEagerSingleton();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ import org.elasticsearch.cluster.settings.Validator;
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.gateway.local.LocalGatewayAllocator;
|
import org.elasticsearch.gateway.local.LocalGatewayAllocator;
|
||||||
import org.elasticsearch.index.codec.CodecService;
|
import org.elasticsearch.index.codec.CodecService;
|
||||||
import org.elasticsearch.index.engine.robin.RobinEngine;
|
import org.elasticsearch.index.engine.internal.InternalEngine;
|
||||||
import org.elasticsearch.index.gateway.IndexShardGatewayService;
|
import org.elasticsearch.index.gateway.IndexShardGatewayService;
|
||||||
import org.elasticsearch.index.indexing.slowlog.ShardSlowLogIndexingService;
|
import org.elasticsearch.index.indexing.slowlog.ShardSlowLogIndexingService;
|
||||||
import org.elasticsearch.index.merge.policy.LogByteSizeMergePolicyProvider;
|
import org.elasticsearch.index.merge.policy.LogByteSizeMergePolicyProvider;
|
||||||
|
@ -80,12 +80,12 @@ public class IndexDynamicSettingsModule extends AbstractModule {
|
||||||
indexDynamicSettings.addDynamicSetting(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, Validator.POSITIVE_INTEGER);
|
indexDynamicSettings.addDynamicSetting(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, Validator.POSITIVE_INTEGER);
|
||||||
indexDynamicSettings.addDynamicSetting(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, Validator.INTEGER_GTE_2);
|
indexDynamicSettings.addDynamicSetting(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, Validator.INTEGER_GTE_2);
|
||||||
indexDynamicSettings.addDynamicSetting(LogDocMergePolicyProvider.INDEX_COMPOUND_FORMAT);
|
indexDynamicSettings.addDynamicSetting(LogDocMergePolicyProvider.INDEX_COMPOUND_FORMAT);
|
||||||
indexDynamicSettings.addDynamicSetting(RobinEngine.INDEX_INDEX_CONCURRENCY, Validator.NON_NEGATIVE_INTEGER);
|
indexDynamicSettings.addDynamicSetting(InternalEngine.INDEX_INDEX_CONCURRENCY, Validator.NON_NEGATIVE_INTEGER);
|
||||||
indexDynamicSettings.addDynamicSetting(RobinEngine.INDEX_COMPOUND_ON_FLUSH, Validator.BOOLEAN);
|
indexDynamicSettings.addDynamicSetting(InternalEngine.INDEX_COMPOUND_ON_FLUSH, Validator.BOOLEAN);
|
||||||
indexDynamicSettings.addDynamicSetting(CodecService.INDEX_CODEC_BLOOM_LOAD, Validator.BOOLEAN);
|
indexDynamicSettings.addDynamicSetting(CodecService.INDEX_CODEC_BLOOM_LOAD, Validator.BOOLEAN);
|
||||||
indexDynamicSettings.addDynamicSetting(RobinEngine.INDEX_GC_DELETES, Validator.TIME);
|
indexDynamicSettings.addDynamicSetting(InternalEngine.INDEX_GC_DELETES, Validator.TIME);
|
||||||
indexDynamicSettings.addDynamicSetting(RobinEngine.INDEX_CODEC);
|
indexDynamicSettings.addDynamicSetting(InternalEngine.INDEX_CODEC);
|
||||||
indexDynamicSettings.addDynamicSetting(RobinEngine.INDEX_FAIL_ON_MERGE_FAILURE);
|
indexDynamicSettings.addDynamicSetting(InternalEngine.INDEX_FAIL_ON_MERGE_FAILURE);
|
||||||
indexDynamicSettings.addDynamicSetting(ShardSlowLogIndexingService.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN, Validator.TIME);
|
indexDynamicSettings.addDynamicSetting(ShardSlowLogIndexingService.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN, Validator.TIME);
|
||||||
indexDynamicSettings.addDynamicSetting(ShardSlowLogIndexingService.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO, Validator.TIME);
|
indexDynamicSettings.addDynamicSetting(ShardSlowLogIndexingService.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO, Validator.TIME);
|
||||||
indexDynamicSettings.addDynamicSetting(ShardSlowLogIndexingService.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG, Validator.TIME);
|
indexDynamicSettings.addDynamicSetting(ShardSlowLogIndexingService.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG, Validator.TIME);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public interface IndexShardRepository {
|
||||||
/**
|
/**
|
||||||
* Creates a snapshot of the shard based on the index commit point.
|
* Creates a snapshot of the shard based on the index commit point.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The index commit point can be obtained by using {@link org.elasticsearch.index.engine.robin.RobinEngine#snapshotIndex()} method.
|
* The index commit point can be obtained by using {@link org.elasticsearch.index.engine.internal.InternalEngine#snapshotIndex()} method.
|
||||||
* IndexShardRepository implementations shouldn't release the snapshot index commit point. It is done by the method caller.
|
* IndexShardRepository implementations shouldn't release the snapshot index commit point. It is done by the method caller.
|
||||||
* <p/>
|
* <p/>
|
||||||
* As snapshot process progresses, implementation of this method should update {@link IndexShardSnapshotStatus} object and check
|
* As snapshot process progresses, implementation of this method should update {@link IndexShardSnapshotStatus} object and check
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ContextIndexSearcher extends IndexSearcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The wrapped {@link IndexSearcher}. The reason why we sometimes prefer delegating to this searcher instead of <tt>super</tt> is that
|
/** The wrapped {@link IndexSearcher}. The reason why we sometimes prefer delegating to this searcher instead of <tt>super</tt> is that
|
||||||
* this instance may have more assertions, for example if it comes from MockRobinEngine which wraps the IndexSearcher into an
|
* this instance may have more assertions, for example if it comes from MockInternalEngine which wraps the IndexSearcher into an
|
||||||
* AssertingIndexSearcher. */
|
* AssertingIndexSearcher. */
|
||||||
private final IndexSearcher in;
|
private final IndexSearcher in;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class HistogramAggregationSearchBenchmark {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("index.engine.robin.refreshInterval", "-1")
|
.put("refresh_interval", "-1")
|
||||||
.put("gateway.type", "local")
|
.put("gateway.type", "local")
|
||||||
.put(SETTING_NUMBER_OF_SHARDS, 2)
|
.put(SETTING_NUMBER_OF_SHARDS, 2)
|
||||||
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class ChildSearchAndIndexingBenchmark {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("index.engine.robin.refreshInterval", "-1")
|
.put("refresh_interval", "-1")
|
||||||
.put("gateway.type", "local")
|
.put("gateway.type", "local")
|
||||||
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
||||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class ChildSearchBenchmark {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("index.engine.robin.refreshInterval", "-1")
|
.put("index.refresh_interval", "-1")
|
||||||
.put("gateway.type", "local")
|
.put("gateway.type", "local")
|
||||||
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
||||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class ChildSearchShortCircuitBenchmark {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("index.engine.robin.refreshInterval", "-1")
|
.put("index.refresh_interval", "-1")
|
||||||
.put("gateway.type", "local")
|
.put("gateway.type", "local")
|
||||||
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
||||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class NestedSearchBenchMark {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("index.engine.robin.refreshInterval", "-1")
|
.put("index.refresh_interval", "-1")
|
||||||
.put("gateway.type", "local")
|
.put("gateway.type", "local")
|
||||||
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
.put(SETTING_NUMBER_OF_SHARDS, 1)
|
||||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class NodesStressTest {
|
||||||
|
|
||||||
public NodesStressTest build(Settings settings) throws Exception {
|
public NodesStressTest build(Settings settings) throws Exception {
|
||||||
settings = settingsBuilder()
|
settings = settingsBuilder()
|
||||||
// .put("index.engine.robin.refreshInterval", 1, TimeUnit.SECONDS)
|
// .put("index.refresh_interval", 1, TimeUnit.SECONDS)
|
||||||
.put(SETTING_NUMBER_OF_SHARDS, 5)
|
.put(SETTING_NUMBER_OF_SHARDS, 5)
|
||||||
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
.put(SETTING_NUMBER_OF_REPLICAS, 1)
|
||||||
.put(settings)
|
.put(settings)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.engine.robin;
|
package org.elasticsearch.index.engine.internal;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
|
@ -45,14 +45,14 @@ import java.util.Collection;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
|
||||||
public class RobinEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
public class InternalEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Slow
|
@Slow
|
||||||
public void testSettingLoadBloomFilterDefaultTrue() throws Exception {
|
public void testSettingLoadBloomFilterDefaultTrue() throws Exception {
|
||||||
Field allowRamBytesUsed = RobinEngine.class.getDeclaredField("allowRamBytesUsed");
|
Field allowRamBytesUsed = InternalEngine.class.getDeclaredField("allowRamBytesUsed");
|
||||||
allowRamBytesUsed.setAccessible(true);
|
allowRamBytesUsed.setAccessible(true);
|
||||||
allowRamBytesUsed.set(RobinEngine.class, Boolean.TRUE);
|
allowRamBytesUsed.set(InternalEngine.class, Boolean.TRUE);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1)).get();
|
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1)).get();
|
||||||
|
@ -87,16 +87,16 @@ public class RobinEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
allowRamBytesUsed.set(RobinEngine.class, Boolean.FALSE);
|
allowRamBytesUsed.set(InternalEngine.class, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Slow
|
@Slow
|
||||||
public void testSettingLoadBloomFilterDefaultFalse() throws Exception {
|
public void testSettingLoadBloomFilterDefaultFalse() throws Exception {
|
||||||
Field allowRamBytesUsed = RobinEngine.class.getDeclaredField("allowRamBytesUsed");
|
Field allowRamBytesUsed = InternalEngine.class.getDeclaredField("allowRamBytesUsed");
|
||||||
allowRamBytesUsed.setAccessible(true);
|
allowRamBytesUsed.setAccessible(true);
|
||||||
allowRamBytesUsed.set(RobinEngine.class, Boolean.TRUE);
|
allowRamBytesUsed.set(InternalEngine.class, Boolean.TRUE);
|
||||||
try {
|
try {
|
||||||
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1).put(CodecService.INDEX_CODEC_BLOOM_LOAD, false)).get();
|
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1).put(CodecService.INDEX_CODEC_BLOOM_LOAD, false)).get();
|
||||||
client().prepareIndex("test", "foo").setSource("field", "foo").get();
|
client().prepareIndex("test", "foo").setSource("field", "foo").get();
|
||||||
|
@ -131,7 +131,7 @@ public class RobinEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
allowRamBytesUsed.set(RobinEngine.class, Boolean.FALSE);
|
allowRamBytesUsed.set(InternalEngine.class, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -143,13 +143,13 @@ public class RobinEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
||||||
refresh();
|
refresh();
|
||||||
assertTotalCompoundSegments(1, 1, "test");
|
assertTotalCompoundSegments(1, 1, "test");
|
||||||
client().admin().indices().prepareUpdateSettings("test")
|
client().admin().indices().prepareUpdateSettings("test")
|
||||||
.setSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, false)).get();
|
.setSettings(ImmutableSettings.builder().put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, false)).get();
|
||||||
client().prepareIndex("test", "foo").setSource("field", "foo").get();
|
client().prepareIndex("test", "foo").setSource("field", "foo").get();
|
||||||
refresh();
|
refresh();
|
||||||
assertTotalCompoundSegments(1, 2, "test");
|
assertTotalCompoundSegments(1, 2, "test");
|
||||||
|
|
||||||
client().admin().indices().prepareUpdateSettings("test")
|
client().admin().indices().prepareUpdateSettings("test")
|
||||||
.setSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, true)).get();
|
.setSettings(ImmutableSettings.builder().put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, true)).get();
|
||||||
client().prepareIndex("test", "foo").setSource("field", "foo").get();
|
client().prepareIndex("test", "foo").setSource("field", "foo").get();
|
||||||
refresh();
|
refresh();
|
||||||
assertTotalCompoundSegments(2, 3, "test");
|
assertTotalCompoundSegments(2, 3, "test");
|
||||||
|
@ -186,7 +186,7 @@ public class RobinEngineIntegrationTest extends ElasticsearchIntegrationTest {
|
||||||
.put("index.number_of_shards", "1")
|
.put("index.number_of_shards", "1")
|
||||||
.put("index.number_of_replicas", "0")
|
.put("index.number_of_replicas", "0")
|
||||||
.put("gateway.type", "none")
|
.put("gateway.type", "none")
|
||||||
.put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, randomBoolean())
|
.put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, randomBoolean())
|
||||||
.put("index.warmer.enabled", false)
|
.put("index.warmer.enabled", false)
|
||||||
.build()).get());
|
.build()).get());
|
||||||
NodesInfoResponse nodeInfos = client().admin().cluster().prepareNodesInfo().setJvm(true).get();
|
NodesInfoResponse nodeInfos = client().admin().cluster().prepareNodesInfo().setJvm(true).get();
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.index.engine.robin;
|
package org.elasticsearch.index.engine.internal;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.Analyzer;
|
import org.apache.lucene.analysis.Analyzer;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -84,7 +84,7 @@ import static org.hamcrest.Matchers.*;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RobinEngineTests extends ElasticsearchTestCase {
|
public class InternalEngineTests extends ElasticsearchTestCase {
|
||||||
|
|
||||||
protected final ShardId shardId = new ShardId(new Index("index"), 1);
|
protected final ShardId shardId = new ShardId(new Index("index"), 1);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public class RobinEngineTests extends ElasticsearchTestCase {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
defaultSettings = ImmutableSettings.builder()
|
defaultSettings = ImmutableSettings.builder()
|
||||||
.put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, getRandom().nextBoolean())
|
.put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, getRandom().nextBoolean())
|
||||||
.build(); // TODO randomize more settings
|
.build(); // TODO randomize more settings
|
||||||
threadPool = new ThreadPool();
|
threadPool = new ThreadPool();
|
||||||
store = createStore();
|
store = createStore();
|
||||||
|
@ -194,7 +194,7 @@ public class RobinEngineTests extends ElasticsearchTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Engine createEngine(IndexSettingsService indexSettingsService, Store store, Translog translog, MergeSchedulerProvider<?> mergeSchedulerProvider) {
|
protected Engine createEngine(IndexSettingsService indexSettingsService, Store store, Translog translog, MergeSchedulerProvider<?> mergeSchedulerProvider) {
|
||||||
return new RobinEngine(shardId, defaultSettings, threadPool, indexSettingsService, new ShardIndexingService(shardId, EMPTY_SETTINGS, new ShardSlowLogIndexingService(shardId, EMPTY_SETTINGS, indexSettingsService)), null, store, createSnapshotDeletionPolicy(), translog, createMergePolicy(), mergeSchedulerProvider,
|
return new InternalEngine(shardId, defaultSettings, threadPool, indexSettingsService, new ShardIndexingService(shardId, EMPTY_SETTINGS, new ShardSlowLogIndexingService(shardId, EMPTY_SETTINGS, indexSettingsService)), null, store, createSnapshotDeletionPolicy(), translog, createMergePolicy(), mergeSchedulerProvider,
|
||||||
new AnalysisService(shardId.index()), new SimilarityService(shardId.index()), new CodecService(shardId.index()));
|
new AnalysisService(shardId.index()), new SimilarityService(shardId.index()), new CodecService(shardId.index()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ public class RobinEngineTests extends ElasticsearchTestCase {
|
||||||
List<Segment> segments = engine.segments();
|
List<Segment> segments = engine.segments();
|
||||||
assertThat(segments.isEmpty(), equalTo(true));
|
assertThat(segments.isEmpty(), equalTo(true));
|
||||||
assertThat(engine.segmentsStats().getCount(), equalTo(0l));
|
assertThat(engine.segmentsStats().getCount(), equalTo(0l));
|
||||||
final boolean defaultCompound = defaultSettings.getAsBoolean(RobinEngine.INDEX_COMPOUND_ON_FLUSH, true);
|
final boolean defaultCompound = defaultSettings.getAsBoolean(InternalEngine.INDEX_COMPOUND_ON_FLUSH, true);
|
||||||
|
|
||||||
// create a doc and refresh
|
// create a doc and refresh
|
||||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocumentWithTextField(), Lucene.STANDARD_ANALYZER, B_1, false);
|
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocumentWithTextField(), Lucene.STANDARD_ANALYZER, B_1, false);
|
||||||
|
@ -237,7 +237,7 @@ public class RobinEngineTests extends ElasticsearchTestCase {
|
||||||
assertThat(segments.get(0).getDeletedDocs(), equalTo(0));
|
assertThat(segments.get(0).getDeletedDocs(), equalTo(0));
|
||||||
assertThat(segments.get(0).isCompound(), equalTo(defaultCompound));
|
assertThat(segments.get(0).isCompound(), equalTo(defaultCompound));
|
||||||
|
|
||||||
engineSettingsService.refreshSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, false).build());
|
engineSettingsService.refreshSettings(ImmutableSettings.builder().put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, false).build());
|
||||||
|
|
||||||
ParsedDocument doc3 = testParsedDocument("3", "3", "test", null, -1, -1, testDocumentWithTextField(), Lucene.STANDARD_ANALYZER, B_3, false);
|
ParsedDocument doc3 = testParsedDocument("3", "3", "test", null, -1, -1, testDocumentWithTextField(), Lucene.STANDARD_ANALYZER, B_3, false);
|
||||||
engine.create(new Engine.Create(null, newUid("3"), doc3));
|
engine.create(new Engine.Create(null, newUid("3"), doc3));
|
||||||
|
@ -280,7 +280,7 @@ public class RobinEngineTests extends ElasticsearchTestCase {
|
||||||
assertThat(segments.get(1).getDeletedDocs(), equalTo(0));
|
assertThat(segments.get(1).getDeletedDocs(), equalTo(0));
|
||||||
assertThat(segments.get(1).isCompound(), equalTo(false));
|
assertThat(segments.get(1).isCompound(), equalTo(false));
|
||||||
|
|
||||||
engineSettingsService.refreshSettings(ImmutableSettings.builder().put(RobinEngine.INDEX_COMPOUND_ON_FLUSH, true).build());
|
engineSettingsService.refreshSettings(ImmutableSettings.builder().put(InternalEngine.INDEX_COMPOUND_ON_FLUSH, true).build());
|
||||||
ParsedDocument doc4 = testParsedDocument("4", "4", "test", null, -1, -1, testDocumentWithTextField(), Lucene.STANDARD_ANALYZER, B_3, false);
|
ParsedDocument doc4 = testParsedDocument("4", "4", "test", null, -1, -1, testDocumentWithTextField(), Lucene.STANDARD_ANALYZER, B_3, false);
|
||||||
engine.create(new Engine.Create(null, newUid("4"), doc4));
|
engine.create(new Engine.Create(null, newUid("4"), doc4));
|
||||||
engine.refresh(new Engine.Refresh("test").force(false));
|
engine.refresh(new Engine.Refresh("test").force(false));
|
|
@ -35,7 +35,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
import org.elasticsearch.search.sort.SortOrder;
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||||
import org.elasticsearch.test.engine.MockRobinEngine;
|
import org.elasticsearch.test.engine.MockInternalEngine;
|
||||||
import org.elasticsearch.test.engine.ThrowingAtomicReaderWrapper;
|
import org.elasticsearch.test.engine.ThrowingAtomicReaderWrapper;
|
||||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||||
import org.elasticsearch.test.store.MockDirectoryHelper;
|
import org.elasticsearch.test.store.MockDirectoryHelper;
|
||||||
|
@ -167,7 +167,7 @@ public class RandomExceptionCircuitBreakerTests extends ElasticsearchIntegration
|
||||||
public static final String EXCEPTION_LOW_LEVEL_RATIO_KEY = "index.engine.exception.ratio.low";
|
public static final String EXCEPTION_LOW_LEVEL_RATIO_KEY = "index.engine.exception.ratio.low";
|
||||||
|
|
||||||
// TODO: Generalize this class and add it as a utility
|
// TODO: Generalize this class and add it as a utility
|
||||||
public static class RandomExceptionDirectoryReaderWrapper extends MockRobinEngine.DirectoryReaderWrapper {
|
public static class RandomExceptionDirectoryReaderWrapper extends MockInternalEngine.DirectoryReaderWrapper {
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
static class ThrowingSubReaderWrapper extends SubReaderWrapper implements ThrowingAtomicReaderWrapper.Thrower {
|
static class ThrowingSubReaderWrapper extends SubReaderWrapper implements ThrowingAtomicReaderWrapper.Thrower {
|
||||||
private final Random random;
|
private final Random random;
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRobinEngineGCDeletesSetting() throws InterruptedException {
|
public void testEngineGCDeletesSetting() throws InterruptedException {
|
||||||
createIndex("test");
|
createIndex("test");
|
||||||
client().prepareIndex("test", "type", "1").setSource("f", 1).get(); // set version to 1
|
client().prepareIndex("test", "type", "1").setSource("f", 1).get(); // set version to 1
|
||||||
client().prepareDelete("test", "type", "1").get(); // sets version to 2
|
client().prepareDelete("test", "type", "1").get(); // sets version to 2
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||||
import org.elasticsearch.test.engine.MockRobinEngine;
|
import org.elasticsearch.test.engine.MockInternalEngine;
|
||||||
import org.elasticsearch.test.engine.ThrowingAtomicReaderWrapper;
|
import org.elasticsearch.test.engine.ThrowingAtomicReaderWrapper;
|
||||||
import org.elasticsearch.test.store.MockDirectoryHelper;
|
import org.elasticsearch.test.store.MockDirectoryHelper;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
@ -186,10 +186,10 @@ public class SearchWithRandomExceptionsTests extends ElasticsearchIntegrationTes
|
||||||
Builder settings = settingsBuilder()
|
Builder settings = settingsBuilder()
|
||||||
.put("index.number_of_shards", numShards)
|
.put("index.number_of_shards", numShards)
|
||||||
.put("index.number_of_replicas", randomIntBetween(0, 1))
|
.put("index.number_of_replicas", randomIntBetween(0, 1))
|
||||||
.put(MockRobinEngine.READER_WRAPPER_TYPE, RandomExceptionDirectoryReaderWrapper.class.getName())
|
.put(MockInternalEngine.READER_WRAPPER_TYPE, RandomExceptionDirectoryReaderWrapper.class.getName())
|
||||||
.put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate)
|
.put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate)
|
||||||
.put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate)
|
.put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate)
|
||||||
.put(MockRobinEngine.WRAP_READER_RATIO, 1.0d);
|
.put(MockInternalEngine.WRAP_READER_RATIO, 1.0d);
|
||||||
logger.info("creating index: [test] using settings: [{}]", settings.build().getAsMap());
|
logger.info("creating index: [test] using settings: [{}]", settings.build().getAsMap());
|
||||||
client().admin().indices().prepareCreate("test")
|
client().admin().indices().prepareCreate("test")
|
||||||
.setSettings(settings)
|
.setSettings(settings)
|
||||||
|
@ -243,7 +243,7 @@ public class SearchWithRandomExceptionsTests extends ElasticsearchIntegrationTes
|
||||||
public static final String EXCEPTION_LOW_LEVEL_RATIO_KEY = "index.engine.exception.ratio.low";
|
public static final String EXCEPTION_LOW_LEVEL_RATIO_KEY = "index.engine.exception.ratio.low";
|
||||||
|
|
||||||
|
|
||||||
public static class RandomExceptionDirectoryReaderWrapper extends MockRobinEngine.DirectoryReaderWrapper {
|
public static class RandomExceptionDirectoryReaderWrapper extends MockInternalEngine.DirectoryReaderWrapper {
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
static class ThrowingSubReaderWrapper extends SubReaderWrapper implements ThrowingAtomicReaderWrapper.Thrower {
|
static class ThrowingSubReaderWrapper extends SubReaderWrapper implements ThrowingAtomicReaderWrapper.Thrower {
|
||||||
private final Random random;
|
private final Random random;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.elasticsearch.common.logging.ESLogger;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.common.util.concurrent.EsAbortPolicy;
|
import org.elasticsearch.common.util.concurrent.EsAbortPolicy;
|
||||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
||||||
import org.elasticsearch.test.engine.MockRobinEngine;
|
import org.elasticsearch.test.engine.MockInternalEngine;
|
||||||
import org.elasticsearch.test.junit.listeners.LoggingListener;
|
import org.elasticsearch.test.junit.listeners.LoggingListener;
|
||||||
import org.elasticsearch.test.store.MockDirectoryHelper;
|
import org.elasticsearch.test.store.MockDirectoryHelper;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
@ -131,27 +131,27 @@ public abstract class ElasticsearchTestCase extends AbstractRandomizedTest {
|
||||||
try {
|
try {
|
||||||
if (awaitBusy(new Predicate<Object>() {
|
if (awaitBusy(new Predicate<Object>() {
|
||||||
public boolean apply(Object o) {
|
public boolean apply(Object o) {
|
||||||
return MockRobinEngine.INFLIGHT_ENGINE_SEARCHERS.isEmpty();
|
return MockInternalEngine.INFLIGHT_ENGINE_SEARCHERS.isEmpty();
|
||||||
}
|
}
|
||||||
}, 5, TimeUnit.SECONDS)) {
|
}, 5, TimeUnit.SECONDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
if (MockRobinEngine.INFLIGHT_ENGINE_SEARCHERS.isEmpty()) {
|
if (MockInternalEngine.INFLIGHT_ENGINE_SEARCHERS.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
RuntimeException ex = null;
|
RuntimeException ex = null;
|
||||||
StringBuilder builder = new StringBuilder("Unclosed Searchers instance for shards: [");
|
StringBuilder builder = new StringBuilder("Unclosed Searchers instance for shards: [");
|
||||||
for (Entry<MockRobinEngine.AssertingSearcher, RuntimeException> entry : MockRobinEngine.INFLIGHT_ENGINE_SEARCHERS.entrySet()) {
|
for (Entry<MockInternalEngine.AssertingSearcher, RuntimeException> entry : MockInternalEngine.INFLIGHT_ENGINE_SEARCHERS.entrySet()) {
|
||||||
ex = entry.getValue();
|
ex = entry.getValue();
|
||||||
builder.append(entry.getKey().shardId()).append(",");
|
builder.append(entry.getKey().shardId()).append(",");
|
||||||
}
|
}
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
throw new RuntimeException(builder.toString(), ex);
|
throw new RuntimeException(builder.toString(), ex);
|
||||||
} finally {
|
} finally {
|
||||||
MockRobinEngine.INFLIGHT_ENGINE_SEARCHERS.clear();
|
MockInternalEngine.INFLIGHT_ENGINE_SEARCHERS.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,6 @@ public class MockEngineModule extends AbstractModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Engine.class).to(MockRobinEngine.class).asEagerSingleton();
|
bind(Engine.class).to(MockInternalEngine.class).asEagerSingleton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.index.codec.CodecService;
|
||||||
import org.elasticsearch.index.deletionpolicy.SnapshotDeletionPolicy;
|
import org.elasticsearch.index.deletionpolicy.SnapshotDeletionPolicy;
|
||||||
import org.elasticsearch.index.engine.Engine;
|
import org.elasticsearch.index.engine.Engine;
|
||||||
import org.elasticsearch.index.engine.EngineException;
|
import org.elasticsearch.index.engine.EngineException;
|
||||||
import org.elasticsearch.index.engine.robin.RobinEngine;
|
import org.elasticsearch.index.engine.internal.InternalEngine;
|
||||||
import org.elasticsearch.index.indexing.ShardIndexingService;
|
import org.elasticsearch.index.indexing.ShardIndexingService;
|
||||||
import org.elasticsearch.index.merge.policy.MergePolicyProvider;
|
import org.elasticsearch.index.merge.policy.MergePolicyProvider;
|
||||||
import org.elasticsearch.index.merge.scheduler.MergeSchedulerProvider;
|
import org.elasticsearch.index.merge.scheduler.MergeSchedulerProvider;
|
||||||
|
@ -52,7 +52,7 @@ import java.util.Random;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
public final class MockRobinEngine extends RobinEngine implements Engine {
|
public final class MockInternalEngine extends InternalEngine implements Engine {
|
||||||
public static final ConcurrentMap<AssertingSearcher, RuntimeException> INFLIGHT_ENGINE_SEARCHERS = new ConcurrentHashMap<AssertingSearcher, RuntimeException>();
|
public static final ConcurrentMap<AssertingSearcher, RuntimeException> INFLIGHT_ENGINE_SEARCHERS = new ConcurrentHashMap<AssertingSearcher, RuntimeException>();
|
||||||
public static final String WRAP_READER_RATIO = "index.engine.mock.random.wrap_reader_ratio";
|
public static final String WRAP_READER_RATIO = "index.engine.mock.random.wrap_reader_ratio";
|
||||||
public static final String READER_WRAPPER_TYPE = "index.engine.mock.random.wrapper";
|
public static final String READER_WRAPPER_TYPE = "index.engine.mock.random.wrapper";
|
||||||
|
@ -62,11 +62,11 @@ public final class MockRobinEngine extends RobinEngine implements Engine {
|
||||||
private final Class<? extends FilterDirectoryReader> wrapper;
|
private final Class<? extends FilterDirectoryReader> wrapper;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public MockRobinEngine(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool,
|
public MockInternalEngine(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool,
|
||||||
IndexSettingsService indexSettingsService, ShardIndexingService indexingService, @Nullable IndicesWarmer warmer, Store store,
|
IndexSettingsService indexSettingsService, ShardIndexingService indexingService, @Nullable IndicesWarmer warmer, Store store,
|
||||||
SnapshotDeletionPolicy deletionPolicy, Translog translog, MergePolicyProvider mergePolicyProvider,
|
SnapshotDeletionPolicy deletionPolicy, Translog translog, MergePolicyProvider mergePolicyProvider,
|
||||||
MergeSchedulerProvider mergeScheduler, AnalysisService analysisService, SimilarityService similarityService,
|
MergeSchedulerProvider mergeScheduler, AnalysisService analysisService, SimilarityService similarityService,
|
||||||
CodecService codecService) throws EngineException {
|
CodecService codecService) throws EngineException {
|
||||||
super(shardId, indexSettings, threadPool, indexSettingsService, indexingService, warmer, store,
|
super(shardId, indexSettings, threadPool, indexSettingsService, indexingService, warmer, store,
|
||||||
deletionPolicy, translog, mergePolicyProvider, mergeScheduler, analysisService, similarityService, codecService);
|
deletionPolicy, translog, mergePolicyProvider, mergeScheduler, analysisService, similarityService, codecService);
|
||||||
final long seed = indexSettings.getAsLong(ElasticsearchIntegrationTest.INDEX_SEED_SETTING, 0l);
|
final long seed = indexSettings.getAsLong(ElasticsearchIntegrationTest.INDEX_SEED_SETTING, 0l);
|
||||||
|
@ -86,7 +86,7 @@ public final class MockRobinEngine extends RobinEngine implements Engine {
|
||||||
} finally {
|
} finally {
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
// log debug if we have pending searchers
|
// log debug if we have pending searchers
|
||||||
for (Entry<MockRobinEngine.AssertingSearcher, RuntimeException> entry : MockRobinEngine.INFLIGHT_ENGINE_SEARCHERS.entrySet()) {
|
for (Entry<MockInternalEngine.AssertingSearcher, RuntimeException> entry : MockInternalEngine.INFLIGHT_ENGINE_SEARCHERS.entrySet()) {
|
||||||
logger.trace("Unreleased Searchers instance for shard [{}]", entry.getValue(), entry.getKey().shardId);
|
logger.trace("Unreleased Searchers instance for shard [{}]", entry.getValue(), entry.getKey().shardId);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue