From 8ac81a3447d0292b5546bba3cf6016ed4ea2374c Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Thu, 30 Jul 2020 13:53:59 -0700 Subject: [PATCH] Remove IndexFieldData#clear since it is unused. (#60475) This method was never called. It also seemed tricky that calling a method on `IndexFieldData` could clear the contents of a shared cache. --- .../index/mapper/ScaledFloatFieldMapper.java | 5 ----- .../elasticsearch/index/fielddata/IndexFieldData.java | 5 ----- .../index/fielddata/IndexHistogramFieldData.java | 4 ---- .../ordinals/GlobalOrdinalsIndexFieldData.java | 6 ------ .../index/fielddata/plain/AbstractIndexFieldData.java | 5 ----- .../plain/AbstractLatLonPointIndexFieldData.java | 5 ----- .../index/fielddata/plain/BinaryIndexFieldData.java | 4 ---- .../fielddata/plain/BytesBinaryIndexFieldData.java | 5 ----- .../index/fielddata/plain/ConstantIndexFieldData.java | 4 ---- .../fielddata/plain/SortedNumericIndexFieldData.java | 5 ----- .../plain/SortedSetOrdinalsIndexFieldData.java | 5 ----- .../fielddata/plain/StringBinaryIndexFieldData.java | 9 ++------- .../org/elasticsearch/index/mapper/IdFieldMapper.java | 6 ------ .../fielddata/NoOrdinalsStringFieldDataTests.java | 5 ----- .../index/query/functionscore/FunctionScoreTests.java | 10 ---------- .../xpack/flattened/mapper/FlatObjectFieldMapper.java | 5 ----- .../fielddata/AbstractLatLonShapeIndexFieldData.java | 5 ----- .../xpack/vectors/query/VectorIndexFieldData.java | 5 ----- 18 files changed, 2 insertions(+), 96 deletions(-) diff --git a/modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java b/modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java index c8946de34a2..e45ab1c4d9b 100644 --- a/modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java +++ b/modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java @@ -541,11 +541,6 @@ public class ScaledFloatFieldMapper extends FieldMapper { return true; } - @Override - public void clear() { - scaledFieldData.clear(); - } - @Override public NumericType getNumericType() { /* diff --git a/server/src/main/java/org/elasticsearch/index/fielddata/IndexFieldData.java b/server/src/main/java/org/elasticsearch/index/fielddata/IndexFieldData.java index f3bdb999767..92532e3e9d7 100644 --- a/server/src/main/java/org/elasticsearch/index/fielddata/IndexFieldData.java +++ b/server/src/main/java/org/elasticsearch/index/fielddata/IndexFieldData.java @@ -86,11 +86,6 @@ public interface IndexFieldData { BucketedSort newBucketedSort(BigArrays bigArrays, @Nullable Object missingValue, MultiValueMode sortMode, Nested nested, SortOrder sortOrder, DocValueFormat format, int bucketSize, BucketedSort.ExtraData extra); - /** - * Clears any resources associated with this field data. - */ - void clear(); - // we need this extended source we we have custom comparators to reuse our field data // in this case, we need to reduce type that will be used when search results are reduced // on another node (we don't have the custom source them...) diff --git a/server/src/main/java/org/elasticsearch/index/fielddata/IndexHistogramFieldData.java b/server/src/main/java/org/elasticsearch/index/fielddata/IndexHistogramFieldData.java index 9850c749305..18a19be17b8 100644 --- a/server/src/main/java/org/elasticsearch/index/fielddata/IndexHistogramFieldData.java +++ b/server/src/main/java/org/elasticsearch/index/fielddata/IndexHistogramFieldData.java @@ -44,8 +44,4 @@ public abstract class IndexHistogramFieldData implements IndexFieldData implement return valuesSourceType; } - @Override - public void clear() { - cache.clear(fieldName); - } - @Override public FD load(LeafReaderContext context) { if (context.reader().getFieldInfos().fieldInfo(fieldName) == null) { diff --git a/server/src/main/java/org/elasticsearch/index/fielddata/plain/AbstractLatLonPointIndexFieldData.java b/server/src/main/java/org/elasticsearch/index/fielddata/plain/AbstractLatLonPointIndexFieldData.java index 9aa2cc3325c..81f75df206e 100644 --- a/server/src/main/java/org/elasticsearch/index/fielddata/plain/AbstractLatLonPointIndexFieldData.java +++ b/server/src/main/java/org/elasticsearch/index/fielddata/plain/AbstractLatLonPointIndexFieldData.java @@ -59,11 +59,6 @@ public abstract class AbstractLatLonPointIndexFieldData implements IndexGeoPoint return valuesSourceType; } - @Override - public final void clear() { - // can't do - } - @Override public SortField sortField(@Nullable Object missingValue, MultiValueMode sortMode, XFieldComparatorSource.Nested nested, boolean reverse) { diff --git a/server/src/main/java/org/elasticsearch/index/fielddata/plain/BinaryIndexFieldData.java b/server/src/main/java/org/elasticsearch/index/fielddata/plain/BinaryIndexFieldData.java index c56653b8979..8dd58316ffe 100644 --- a/server/src/main/java/org/elasticsearch/index/fielddata/plain/BinaryIndexFieldData.java +++ b/server/src/main/java/org/elasticsearch/index/fielddata/plain/BinaryIndexFieldData.java @@ -69,10 +69,6 @@ public class BinaryIndexFieldData implements IndexFieldData