Skip to content

Commit

Permalink
Added logger (associated with shard) to CodecServiceConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta committed Mar 7, 2022
1 parent 5c136be commit eeeab29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.index.codec;

import org.apache.logging.log4j.Logger;
import org.opensearch.common.Nullable;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.mapper.MapperService;
Expand All @@ -20,10 +21,12 @@
public final class CodecServiceConfig {
private final IndexSettings indexSettings;
private final MapperService mapperService;
private final Logger logger;

public CodecServiceConfig(IndexSettings indexSettings, @Nullable MapperService mapperService) {
public CodecServiceConfig(IndexSettings indexSettings, @Nullable MapperService mapperService, Logger logger) {
this.indexSettings = Objects.requireNonNull(indexSettings);
this.mapperService = mapperService;
this.logger = logger;
}

public IndexSettings getIndexSettings() {
Expand All @@ -34,4 +37,8 @@ public IndexSettings getIndexSettings() {
public MapperService getMapperService() {
return mapperService;
}

public Logger getLogger() {
return logger;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.index.engine;

import org.apache.logging.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.MergePolicy;
import org.apache.lucene.search.QueryCache;
Expand Down Expand Up @@ -169,7 +170,8 @@ public EngineConfig newEngineConfig(
retentionLeasesSupplier,
primaryTermSupplier,
tombstoneDocSupplier,
null
null, /* mapperService */
null /* logger */
);
}

Expand Down Expand Up @@ -197,7 +199,8 @@ public EngineConfig newEngineConfig(
Supplier<RetentionLeases> retentionLeasesSupplier,
LongSupplier primaryTermSupplier,
EngineConfig.TombstoneDocSupplier tombstoneDocSupplier,
MapperService mapperService
MapperService mapperService,
Logger logger
) {

return new EngineConfig(
Expand All @@ -210,7 +213,7 @@ public EngineConfig newEngineConfig(
analyzer,
similarity,
this.codecServiceFactory != null
? this.codecServiceFactory.createCodecService(new CodecServiceConfig(indexSettings, mapperService))
? this.codecServiceFactory.createCodecService(new CodecServiceConfig(indexSettings, mapperService, logger))
: codecService,
eventListener,
queryCache,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,8 @@ private EngineConfig newEngineConfig(LongSupplier globalCheckpointSupplier) {
replicationTracker::getRetentionLeases,
() -> getOperationPrimaryTerm(),
tombstoneDocSupplier(),
mapperService
mapperService,
logger
);
}

Expand Down

0 comments on commit eeeab29

Please sign in to comment.