[TEST] fix issue clearing fielddata breaker introduced in 6950c38a04

This commit is contained in:
Lee Hinman 2014-08-25 16:25:02 +02:00
parent ce0b2ade9c
commit 1f7be7931b
1 changed files with 4 additions and 2 deletions

View File

@ -113,7 +113,10 @@ public class IndicesFieldDataCache extends AbstractComponent implements RemovalL
IndexFieldCache indexCache = key.indexCache;
long sizeInBytes = key.sizeInBytes;
final Accountable value = notification.getValue();
assert value == null || sizeInBytes > 0 && sizeInBytes == value.ramBytesUsed() : "Expected size [" + sizeInBytes + "] to be positive or value [" + value + "] to be non-null";
assert sizeInBytes >= 0 || value != null : "Expected size [" + sizeInBytes + "] to be positive or value [" + value + "] to be non-null";
if (sizeInBytes == -1 && value != null) {
sizeInBytes = value.ramBytesUsed();
}
for (IndexFieldDataCache.Listener listener : key.listeners) {
try {
listener.onUnload(indexCache.fieldNames, indexCache.fieldDataType, notification.wasEvicted(), sizeInBytes);
@ -220,7 +223,6 @@ public class IndicesFieldDataCache extends AbstractComponent implements RemovalL
logger.error("Failed to call listener on global ordinals loading", e);
}
}
key.sizeInBytes = ifd.ramBytesUsed();
return ifd;
}
});