mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 14:26:27 +00:00
Invalidate cache stats when clearing the cache, closes #1220.
This commit is contained in:
parent
794a284093
commit
7af84869fc
@ -135,6 +135,7 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||||||
if (!clearedAtLeastOne) {
|
if (!clearedAtLeastOne) {
|
||||||
service.cache().clear();
|
service.cache().clear();
|
||||||
}
|
}
|
||||||
|
service.cache().invalidateCache();
|
||||||
}
|
}
|
||||||
return new ShardClearIndicesCacheResponse(request.index(), request.shardId());
|
return new ShardClearIndicesCacheResponse(request.index(), request.shardId());
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,12 @@ public class IndexCache extends AbstractIndexComponent implements CloseableCompo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void invalidateCache() {
|
||||||
|
FilterCache.EntriesStats filterEntriesStats = filterCache.entriesStats();
|
||||||
|
latestCacheStats = new CacheStats(fieldDataCache.evictions(), filterCache.evictions(), fieldDataCache.sizeInBytes(), filterEntriesStats.sizeInBytes, filterEntriesStats.count, bloomCache.sizeInBytes());
|
||||||
|
latestCacheStatsTimestamp = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized CacheStats stats() {
|
public synchronized CacheStats stats() {
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
if ((timestamp - latestCacheStatsTimestamp) > refreshInterval.millis()) {
|
if ((timestamp - latestCacheStatsTimestamp) > refreshInterval.millis()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user