Remove unnecessary logger creation for doc values field data

This commit removes an unnecessary logger instance creation from the
constructor for doc values field data. This construction is expensive
for this oft-created class because of a synchronized block in the
constructor for the logger.

Relates #27349
This commit is contained in:
tinder-xli 2017-11-10 19:28:58 -08:00 committed by Jason Tedor
parent 8904fc8210
commit 1e99195743
2 changed files with 3 additions and 2 deletions

View File

@ -46,13 +46,11 @@ public abstract class DocValuesIndexFieldData {
protected final Index index;
protected final String fieldName;
protected final Logger logger;
public DocValuesIndexFieldData(Index index, String fieldName) {
super();
this.index = index;
this.fieldName = fieldName;
this.logger = Loggers.getLogger(getClass());
}
public final String getFieldName() {

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index.fielddata.plain;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.OrdinalMap;
@ -28,6 +29,7 @@ import org.apache.lucene.search.SortedSetSelector;
import org.apache.lucene.search.SortedSetSortField;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.fielddata.AtomicOrdinalsFieldData;
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
@ -48,6 +50,7 @@ public class SortedSetDVOrdinalsIndexFieldData extends DocValuesIndexFieldData i
private final IndexFieldDataCache cache;
private final CircuitBreakerService breakerService;
private final Function<SortedSetDocValues, ScriptDocValues<?>> scriptFunction;
private static final Logger logger = Loggers.getLogger(SortedSetDVOrdinalsIndexFieldData.class);
public SortedSetDVOrdinalsIndexFieldData(IndexSettings indexSettings, IndexFieldDataCache cache, String fieldName,
CircuitBreakerService breakerService, Function<SortedSetDocValues, ScriptDocValues<?>> scriptFunction) {