Revert "test"

This reverts commit 783f01bab3e096f4f843b9de62af25d6fbe07340.
This commit is contained in:
Adrien Grand 2018-12-11 10:11:27 +01:00
parent adf73ff6bd
commit 21dc237248
3 changed files with 10 additions and 60 deletions

View File

@ -107,14 +107,6 @@ final class BinaryDocValuesFieldUpdates extends DocValuesFieldUpdates {
lengths.set(i, tmpLength);
}
@Override
protected void copy(int i, int j) {
super.copy(i, j);
offsets.set(j, offsets.get(i));
lengths.set(j, lengths.get(i));
}
@Override
protected void grow(int size) {
super.grow(size);

View File

@ -21,10 +21,10 @@ import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.BitSet;
import org.apache.lucene.util.BitSetIterator;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.InPlaceMergeSorter;
import org.apache.lucene.util.PriorityQueue;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.SparseFixedBitSet;
import org.apache.lucene.util.TimSorter;
import org.apache.lucene.util.packed.PackedInts;
import org.apache.lucene.util.packed.PagedMutable;
@ -32,11 +32,11 @@ import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
/**
* Holds updates of a single DocValues field, for a set of documents within one segment.
*
*
* @lucene.experimental
*/
abstract class DocValuesFieldUpdates implements Accountable {
protected static final int PAGE_SIZE = 1024;
private static final long HAS_VALUE_MASK = 1;
private static final long HAS_NO_VALUE_MASK = 0;
@ -260,7 +260,7 @@ abstract class DocValuesFieldUpdates implements Accountable {
final boolean getFinished() {
return finished;
}
abstract void add(int doc, long value);
abstract void add(int doc, BytesRef value);
@ -285,17 +285,11 @@ abstract class DocValuesFieldUpdates implements Accountable {
throw new IllegalStateException("already finished");
}
finished = true;
// Swaps and comparisons are quite costly with all these packed ints,
// so we use TimSorter instead of InPlaceMergeSorter, which has the nice
// property of doing fewer swaps/copies at the expense of a higher memory
// usage
final int tempSlotsOffset = size;
// we grow the current structures to get temporary storage
resize(Math.addExact(size, size / 2)); // 50% extra memory for temp slots
final int numTempSlots = Math.toIntExact(docs.size() - size);
new TimSorter(numTempSlots) {
// shrink wrap
if (size < docs.size()) {
resize(size);
}
new InPlaceMergeSorter() {
@Override
protected void swap(int i, int j) {
DocValuesFieldUpdates.this.swap(i, j);
@ -308,33 +302,7 @@ abstract class DocValuesFieldUpdates implements Accountable {
// stable and preserving original order so the last update to that docID wins
return Long.compare(docs.get(i)>>>1, docs.get(j)>>>1);
}
@Override
protected void save(int i, int len) {
assert len <= numTempSlots;
for (int k = 0; k < len; ++k) {
copy(i + k, tempSlotsOffset + k);
}
}
@Override
protected void restore(int src, int dest) {
copy(tempSlotsOffset + src, dest);
}
@Override
protected void copy(int src, int dest) {
DocValuesFieldUpdates.this.copy(src, dest);
}
@Override
protected int compareSaved(int i, int j) {
return compare(tempSlotsOffset + i, j);
}
}.sort(0, size);
// shrink wrap to save memory, this will also release temporary storage
resize(size);
}
/** Returns true if this instance contains any updates. */
@ -382,10 +350,6 @@ abstract class DocValuesFieldUpdates implements Accountable {
docs.set(i, tmpDoc);
}
protected void copy(int i, int j) {
docs.set(j, docs.get(i));
}
protected void grow(int size) {
docs = docs.grow(size);
}
@ -513,7 +477,7 @@ abstract class DocValuesFieldUpdates implements Accountable {
}
protected abstract BytesRef binaryValue();
protected abstract long longValue();
@Override

View File

@ -99,12 +99,6 @@ final class NumericDocValuesFieldUpdates extends DocValuesFieldUpdates {
values.set(i, tmpVal);
}
@Override
protected void copy(int i, int j) {
super.copy(i, j);
values.set(j, values.get(i));
}
@Override
protected void grow(int size) {
super.grow(size);