[TEST] fix issue clearing fielddata breaker introduced in 6950c38a04
This commit is contained in:
parent
ce0b2ade9c
commit
1f7be7931b
|
@ -113,7 +113,10 @@ public class IndicesFieldDataCache extends AbstractComponent implements RemovalL
|
||||||
IndexFieldCache indexCache = key.indexCache;
|
IndexFieldCache indexCache = key.indexCache;
|
||||||
long sizeInBytes = key.sizeInBytes;
|
long sizeInBytes = key.sizeInBytes;
|
||||||
final Accountable value = notification.getValue();
|
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) {
|
for (IndexFieldDataCache.Listener listener : key.listeners) {
|
||||||
try {
|
try {
|
||||||
listener.onUnload(indexCache.fieldNames, indexCache.fieldDataType, notification.wasEvicted(), sizeInBytes);
|
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);
|
logger.error("Failed to call listener on global ordinals loading", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
key.sizeInBytes = ifd.ramBytesUsed();
|
|
||||||
return ifd;
|
return ifd;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue