Remove allocation id from engine (#62680)
We no longer need the allocation id in Engine.
This commit is contained in:
parent
f69d268500
commit
8c6e197f51
|
@ -64,7 +64,7 @@ public class IndexingMemoryControllerIT extends ESSingleNodeTestCase {
|
|||
Settings settings = Settings.builder().put(config.getIndexSettings().getSettings())
|
||||
.put("indices.memory.index_buffer_size", "10mb").build();
|
||||
IndexSettings indexSettings = new IndexSettings(config.getIndexSettings().getIndexMetadata(), settings);
|
||||
return new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(),
|
||||
return new EngineConfig(config.getShardId(), config.getThreadPool(),
|
||||
indexSettings, config.getWarmer(), config.getStore(), config.getMergePolicy(), config.getAnalyzer(),
|
||||
config.getSimilarity(), new CodecService(null, LogManager.getLogger(IndexingMemoryControllerIT.class)),
|
||||
config.getEventListener(), config.getQueryCache(),
|
||||
|
|
|
@ -117,7 +117,6 @@ public abstract class Engine implements Closeable {
|
|||
public static final String CAN_MATCH_SEARCH_SOURCE = "can_match";
|
||||
|
||||
protected final ShardId shardId;
|
||||
protected final String allocationId;
|
||||
protected final Logger logger;
|
||||
protected final EngineConfig engineConfig;
|
||||
protected final Store store;
|
||||
|
@ -147,7 +146,6 @@ public abstract class Engine implements Closeable {
|
|||
|
||||
this.engineConfig = engineConfig;
|
||||
this.shardId = engineConfig.getShardId();
|
||||
this.allocationId = engineConfig.getAllocationId();
|
||||
this.store = engineConfig.getStore();
|
||||
// we use the engine class directly here to make sure all subclasses have the same logger name
|
||||
this.logger = Loggers.getLogger(Engine.class,
|
||||
|
|
|
@ -55,7 +55,6 @@ import java.util.function.Supplier;
|
|||
*/
|
||||
public final class EngineConfig {
|
||||
private final ShardId shardId;
|
||||
private final String allocationId;
|
||||
private final IndexSettings indexSettings;
|
||||
private final ByteSizeValue indexingBufferSize;
|
||||
private volatile boolean enableGcDeletes = true;
|
||||
|
@ -131,7 +130,7 @@ public final class EngineConfig {
|
|||
/**
|
||||
* Creates a new {@link org.elasticsearch.index.engine.EngineConfig}
|
||||
*/
|
||||
public EngineConfig(ShardId shardId, String allocationId, ThreadPool threadPool,
|
||||
public EngineConfig(ShardId shardId, ThreadPool threadPool,
|
||||
IndexSettings indexSettings, Engine.Warmer warmer, Store store,
|
||||
MergePolicy mergePolicy, Analyzer analyzer,
|
||||
Similarity similarity, CodecService codecService, Engine.EventListener eventListener,
|
||||
|
@ -144,7 +143,6 @@ public final class EngineConfig {
|
|||
LongSupplier primaryTermSupplier,
|
||||
TombstoneDocSupplier tombstoneDocSupplier) {
|
||||
this.shardId = shardId;
|
||||
this.allocationId = allocationId;
|
||||
this.indexSettings = indexSettings;
|
||||
this.threadPool = threadPool;
|
||||
this.warmer = warmer == null ? (a) -> {} : warmer;
|
||||
|
@ -286,15 +284,6 @@ public final class EngineConfig {
|
|||
*/
|
||||
public ShardId getShardId() { return shardId; }
|
||||
|
||||
/**
|
||||
* Returns the allocation ID for the shard.
|
||||
*
|
||||
* @return the allocation ID
|
||||
*/
|
||||
public String getAllocationId() {
|
||||
return allocationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the analyzer as the default analyzer in the engines {@link org.apache.lucene.index.IndexWriter}
|
||||
*/
|
||||
|
|
|
@ -2780,7 +2780,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
|||
this.warmer.warm(reader);
|
||||
}
|
||||
};
|
||||
return new EngineConfig(shardId, shardRouting.allocationId().getId(),
|
||||
return new EngineConfig(shardId,
|
||||
threadPool, indexSettings, warmer, store, indexSettings.getMergePolicy(),
|
||||
mapperService != null ? mapperService.indexAnalyzer() : null,
|
||||
similarityService.similarity(mapperService), codecService, shardEventListener,
|
||||
|
|
|
@ -3193,7 +3193,6 @@ public class InternalEngineTests extends EngineTestCase {
|
|||
|
||||
EngineConfig brokenConfig = new EngineConfig(
|
||||
shardId,
|
||||
allocationId.getId(),
|
||||
threadPool,
|
||||
config.getIndexSettings(),
|
||||
null,
|
||||
|
@ -6257,7 +6256,7 @@ public class InternalEngineTests extends EngineTestCase {
|
|||
EngineConfig config = engine.config();
|
||||
final TranslogConfig translogConfig = new TranslogConfig(config.getTranslogConfig().getShardId(),
|
||||
createTempDir(), config.getTranslogConfig().getIndexSettings(), config.getTranslogConfig().getBigArrays());
|
||||
EngineConfig configWithWarmer = new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(),
|
||||
EngineConfig configWithWarmer = new EngineConfig(config.getShardId(), config.getThreadPool(),
|
||||
config.getIndexSettings(), warmer, store, config.getMergePolicy(), config.getAnalyzer(),
|
||||
config.getSimilarity(), new CodecService(null, logger), config.getEventListener(), config.getQueryCache(),
|
||||
config.getQueryCachingPolicy(), translogConfig, config.getFlushMergesAfter(),
|
||||
|
|
|
@ -4175,7 +4175,7 @@ public class IndexShardTests extends IndexShardTestCase {
|
|||
throw new AssertionError(e);
|
||||
}
|
||||
};
|
||||
EngineConfig configWithWarmer = new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(),
|
||||
EngineConfig configWithWarmer = new EngineConfig(config.getShardId(), config.getThreadPool(),
|
||||
config.getIndexSettings(), warmer, config.getStore(), config.getMergePolicy(), config.getAnalyzer(),
|
||||
config.getSimilarity(), new CodecService(null, logger), config.getEventListener(), config.getQueryCache(),
|
||||
config.getQueryCachingPolicy(), config.getTranslogConfig(), config.getFlushMergesAfter(),
|
||||
|
|
|
@ -128,7 +128,6 @@ public class RefreshListenersTests extends ESTestCase {
|
|||
store.associateIndexWithNewTranslog(translogUUID);
|
||||
EngineConfig config = new EngineConfig(
|
||||
shardId,
|
||||
allocationId,
|
||||
threadPool,
|
||||
indexSettings,
|
||||
null,
|
||||
|
|
|
@ -376,7 +376,7 @@ public class IndexingMemoryControllerTests extends IndexShardTestCase {
|
|||
EngineConfig configWithRefreshListener(EngineConfig config, ReferenceManager.RefreshListener listener) {
|
||||
final List<ReferenceManager.RefreshListener> internalRefreshListener = new ArrayList<>(config.getInternalRefreshListener());;
|
||||
internalRefreshListener.add(listener);
|
||||
return new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(),
|
||||
return new EngineConfig(config.getShardId(), config.getThreadPool(),
|
||||
config.getIndexSettings(), config.getWarmer(), config.getStore(), config.getMergePolicy(), config.getAnalyzer(),
|
||||
config.getSimilarity(), new CodecService(null, logger), config.getEventListener(), config.getQueryCache(),
|
||||
config.getQueryCachingPolicy(), config.getTranslogConfig(), config.getFlushMergesAfter(),
|
||||
|
|
|
@ -233,7 +233,7 @@ public abstract class EngineTestCase extends ESTestCase {
|
|||
}
|
||||
|
||||
public EngineConfig copy(EngineConfig config, LongSupplier globalCheckpointSupplier) {
|
||||
return new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(), config.getIndexSettings(),
|
||||
return new EngineConfig(config.getShardId(), config.getThreadPool(), config.getIndexSettings(),
|
||||
config.getWarmer(), config.getStore(), config.getMergePolicy(), config.getAnalyzer(), config.getSimilarity(),
|
||||
new CodecService(null, logger), config.getEventListener(), config.getQueryCache(), config.getQueryCachingPolicy(),
|
||||
config.getTranslogConfig(), config.getFlushMergesAfter(),
|
||||
|
@ -243,7 +243,7 @@ public abstract class EngineTestCase extends ESTestCase {
|
|||
}
|
||||
|
||||
public EngineConfig copy(EngineConfig config, Analyzer analyzer) {
|
||||
return new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(), config.getIndexSettings(),
|
||||
return new EngineConfig(config.getShardId(), config.getThreadPool(), config.getIndexSettings(),
|
||||
config.getWarmer(), config.getStore(), config.getMergePolicy(), analyzer, config.getSimilarity(),
|
||||
new CodecService(null, logger), config.getEventListener(), config.getQueryCache(), config.getQueryCachingPolicy(),
|
||||
config.getTranslogConfig(), config.getFlushMergesAfter(),
|
||||
|
@ -253,7 +253,7 @@ public abstract class EngineTestCase extends ESTestCase {
|
|||
}
|
||||
|
||||
public EngineConfig copy(EngineConfig config, MergePolicy mergePolicy) {
|
||||
return new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(), config.getIndexSettings(),
|
||||
return new EngineConfig(config.getShardId(), config.getThreadPool(), config.getIndexSettings(),
|
||||
config.getWarmer(), config.getStore(), mergePolicy, config.getAnalyzer(), config.getSimilarity(),
|
||||
new CodecService(null, logger), config.getEventListener(), config.getQueryCache(), config.getQueryCachingPolicy(),
|
||||
config.getTranslogConfig(), config.getFlushMergesAfter(),
|
||||
|
@ -686,7 +686,6 @@ public abstract class EngineTestCase extends ESTestCase {
|
|||
}
|
||||
return new EngineConfig(
|
||||
shardId,
|
||||
allocationId.getId(),
|
||||
threadPool,
|
||||
indexSettings,
|
||||
null,
|
||||
|
@ -716,7 +715,7 @@ public abstract class EngineTestCase extends ESTestCase {
|
|||
Settings.builder().put(config.getIndexSettings().getSettings())
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build());
|
||||
TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE);
|
||||
return new EngineConfig(config.getShardId(), config.getAllocationId(), config.getThreadPool(),
|
||||
return new EngineConfig(config.getShardId(), config.getThreadPool(),
|
||||
indexSettings, config.getWarmer(), store, config.getMergePolicy(), config.getAnalyzer(), config.getSimilarity(),
|
||||
new CodecService(null, logger), config.getEventListener(), config.getQueryCache(), config.getQueryCachingPolicy(),
|
||||
translogConfig, config.getFlushMergesAfter(), config.getExternalRefreshListener(),
|
||||
|
|
|
@ -246,7 +246,6 @@ public class FollowingEngineTests extends ESTestCase {
|
|||
final TranslogConfig translogConfig = new TranslogConfig(shardId, translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE);
|
||||
return new EngineConfig(
|
||||
shardId,
|
||||
"allocation-id",
|
||||
threadPool,
|
||||
indexSettings,
|
||||
null,
|
||||
|
|
Loading…
Reference in New Issue