opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.84k stars 1.83k forks source link

[BUG] Stats for tiered spillover cache are wrong in some situations #16559

Open peteralfonsi opened 2 weeks ago

peteralfonsi commented 2 weeks ago

Describe the bug

When getting the tier-level stats from the new TieredSpilloverCache with GET /_nodes/stats/caches/request_cache?level=tier, the number of misses and evictions reported in the total is sometimes lower than the value you would compute based on the numbers in the individual tiers. For example if the disk tier is enabled, disk tier misses should equal total misses. The correct value is the one in the tiers, as it matches the old API. The discrepancy happens when shards are closed.

Related component

Search

To Reproduce

Set up a cluster using TieredSpilloverCache as its request cache. Make some requests to add misses to the cache. Close some shards. Afterwards, the tier-level and total values reported in the API will not match.

Expected behavior

The stats for tier and total should match.

Additional Details

No response