From ef2bffa6c2f6330cca7748c2900d409a5b71bde1 Mon Sep 17 00:00:00 2001 From: Peter Alfonsi Date: Tue, 30 Apr 2024 11:55:26 -0700 Subject: [PATCH] Reworded description comment Signed-off-by: Peter Alfonsi --- .../tier/TieredSpilloverCacheStatsHolder.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheStatsHolder.java b/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheStatsHolder.java index e60e143634031..d17059e8dee94 100644 --- a/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheStatsHolder.java +++ b/modules/cache-common/src/main/java/org/opensearch/cache/common/tier/TieredSpilloverCacheStatsHolder.java @@ -15,12 +15,17 @@ import java.util.function.Consumer; /** - * A tier-aware version of DefaultCacheStatsHolder. Overrides the incrementer functions, as we cannot just add the on-heap - * and disk stats to get a total for the cache as a whole. For example, if the heap tier has 5 misses and the disk tier - * has 4, the total cache has had 4 misses, not 9. The same goes for evictions. Other stats values add normally. + * A tier-aware version of DefaultCacheStatsHolder. Overrides the incrementer functions, as we can't just add the on-heap + * and disk stats to get a total for the cache as a whole. If the disk tier is present, the total hits, size, and entries + * should be the sum of both tiers' values, but the total misses and evictions should be the disk tier's values. + * When the disk tier isn't present, on-heap misses and evictions should contribute to the total. + * + * For example, if the heap tier has 5 misses and the disk tier has 4, the total cache has had 4 misses, not 9. + * The same goes for evictions. Other stats values add normally. + * * This means for misses and evictions, if we are incrementing for the on-heap tier and the disk tier is present, - * we have to increment only the leaf nodes corresponding to the on-heap tier itself, and not its ancestors. - * If the disk tier is not present, we do increment the ancestor nodes. + * we have to increment only the leaf nodes corresponding to the on-heap tier itself, and not its ancestors, + * which correspond to totals including both tiers. If the disk tier is not present, we do increment the ancestor nodes. */ public class TieredSpilloverCacheStatsHolder extends DefaultCacheStatsHolder {