Remove IndexFieldData.getHighestNumberOfSeenUniqueValues().
Closes #4426
This commit is contained in:
parent
f0e1f9215b
commit
e2e19203d7
|
@ -9,14 +9,11 @@ import org.elasticsearch.index.Index;
|
|||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.settings.IndexSettings;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class AbstractIndexFieldData<FD extends AtomicFieldData> extends AbstractIndexComponent implements IndexFieldData<FD> {
|
||||
|
||||
private final FieldMapper.Names fieldNames;
|
||||
private final AtomicLong highestUniqueValuesCount = new AtomicLong();
|
||||
protected final FieldDataType fieldDataType;
|
||||
protected final IndexFieldDataCache cache;
|
||||
|
||||
|
@ -42,16 +39,10 @@ public abstract class AbstractIndexFieldData<FD extends AtomicFieldData> extends
|
|||
cache.clear(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getHighestNumberOfSeenUniqueValues() {
|
||||
return highestUniqueValuesCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final FD load(AtomicReaderContext context) {
|
||||
try {
|
||||
FD fd = cache.load(context, this);
|
||||
updateHighestSeenValuesCount(fd.getNumberUniqueValues());
|
||||
return fd;
|
||||
} catch (Throwable e) {
|
||||
if (e instanceof ElasticSearchException) {
|
||||
|
@ -62,13 +53,4 @@ public abstract class AbstractIndexFieldData<FD extends AtomicFieldData> extends
|
|||
}
|
||||
}
|
||||
|
||||
private void updateHighestSeenValuesCount(long newValuesCount) {
|
||||
long current;
|
||||
do {
|
||||
if ((current = highestUniqueValuesCount.get()) >= newValuesCount) {
|
||||
break;
|
||||
}
|
||||
} while (!highestUniqueValuesCount.compareAndSet(current, newValuesCount));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,11 +81,6 @@ public interface IndexFieldData<FD extends AtomicFieldData> extends IndexCompone
|
|||
|
||||
void clear(IndexReader reader);
|
||||
|
||||
/**
|
||||
* Returns the highest ever seen uniqiue values in an atomic reader.
|
||||
*/
|
||||
long getHighestNumberOfSeenUniqueValues();
|
||||
|
||||
// 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...)
|
||||
|
|
|
@ -76,11 +76,6 @@ public class NoOrdinalsStringFieldDataTests extends PagedBytesStringFieldDataTes
|
|||
in.clear(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getHighestNumberOfSeenUniqueValues() {
|
||||
return in.getHighestNumberOfSeenUniqueValues();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue