Return 0 instead of -1 for unknown/non-exposed ramBytesUsed()

The accountable interface specifies that such values are illegal

Fixes #8239
This commit is contained in:
Lee Hinman 2014-10-30 14:22:45 +01:00
parent 8aff3b6273
commit a6d7742cb5
7 changed files with 9 additions and 9 deletions

View File

@ -63,7 +63,7 @@ public class BinaryDVAtomicFieldData implements AtomicFieldData {
@Override @Override
public long ramBytesUsed() { public long ramBytesUsed() {
return -1; // unknown return 0; // unknown
} }
} }

View File

@ -84,7 +84,7 @@ public class BinaryDVNumericIndexFieldData extends DocValuesIndexFieldData imple
}; };
} else { } else {
return new AtomicLongFieldData(-1) { return new AtomicLongFieldData(0) {
@Override @Override
public SortedNumericDocValues getLongValues() { public SortedNumericDocValues getLongValues() {

View File

@ -42,7 +42,7 @@ final class BytesBinaryDVAtomicFieldData implements AtomicFieldData {
@Override @Override
public long ramBytesUsed() { public long ramBytesUsed() {
return -1; // not exposed by Lucene return 0; // not exposed by Lucene
} }
@Override @Override

View File

@ -43,7 +43,7 @@ final class GeoPointBinaryDVAtomicFieldData extends AbstractAtomicGeoPointFieldD
@Override @Override
public long ramBytesUsed() { public long ramBytesUsed() {
return -1; // not exposed by Lucene return 0; // not exposed by Lucene
} }
@Override @Override

View File

@ -42,7 +42,7 @@ public class NumericDVIndexFieldData extends DocValuesIndexFieldData implements
public AtomicLongFieldData load(AtomicReaderContext context) { public AtomicLongFieldData load(AtomicReaderContext context) {
final AtomicReader reader = context.reader(); final AtomicReader reader = context.reader();
final String field = fieldNames.indexName(); final String field = fieldNames.indexName();
return new AtomicLongFieldData(-1) { return new AtomicLongFieldData(0) {
@Override @Override
public SortedNumericDocValues getLongValues() { public SortedNumericDocValues getLongValues() {
try { try {

View File

@ -103,7 +103,7 @@ public class SortedNumericDVIndexFieldData extends DocValuesIndexFieldData imple
final String field; final String field;
SortedNumericLongFieldData(AtomicReader reader, String field) { SortedNumericLongFieldData(AtomicReader reader, String field) {
super(-1L); super(0L);
this.reader = reader; this.reader = reader;
this.field = field; this.field = field;
} }
@ -140,7 +140,7 @@ public class SortedNumericDVIndexFieldData extends DocValuesIndexFieldData imple
final String field; final String field;
SortedNumericFloatFieldData(AtomicReader reader, String field) { SortedNumericFloatFieldData(AtomicReader reader, String field) {
super(-1L); super(0L);
this.reader = reader; this.reader = reader;
this.field = field; this.field = field;
} }
@ -226,7 +226,7 @@ public class SortedNumericDVIndexFieldData extends DocValuesIndexFieldData imple
final String field; final String field;
SortedNumericDoubleFieldData(AtomicReader reader, String field) { SortedNumericDoubleFieldData(AtomicReader reader, String field) {
super(-1L); super(0L);
this.reader = reader; this.reader = reader;
this.field = field; this.field = field;
} }

View File

@ -56,7 +56,7 @@ public final class SortedSetDVBytesAtomicFieldData extends AbstractAtomicOrdinal
@Override @Override
public long ramBytesUsed() { public long ramBytesUsed() {
return -1; // unknown return 0; // unknown
} }
} }