Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix TieredSpilloverCache stats not adding correctly when shards are closed #16560

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

peteralfonsi
Copy link
Contributor

@peteralfonsi peteralfonsi commented Nov 4, 2024

Description

Fixes a bug where the total stats for the TieredSpilloverCache are decremented incorrectly when shards were closed. Misses and evictions from both the heap and disk tier were subtracted from the total, but this is incorrect. When the disk tier is enabled, only disk-tier misses and evictions should count towards the cache total, so only they should be subtracted. Adds UTs and ITs around this.

Also adds UT coverage for TieredSpilloverCacheStatsHolder, which was missing before.

Related Issues

Resolves #16559

Check List

  • Functionality includes testing.
  • [N/A] API changes companion pull request created, if applicable.
  • [N/A] Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Peter Alfonsi added 7 commits October 24, 2024 16:19
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
@github-actions github-actions bot added the Search Search query, autocomplete ...etc label Nov 4, 2024
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Copy link
Contributor

github-actions bot commented Nov 4, 2024

❌ Gradle check result for c2a05d4: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

this.diskCacheEnabled = diskCacheEnabled;
}

@Override
public void removeDimensions(List<String> dimensionValues) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just reuse removeDimensions method from DefaultCacheStatsHolder? Both look exactly same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the TSC we check for assert dimensionValues.size() == dimensionNames.size() - 1 rather than dimensionNames.size(), so that the base case is the node whose children are the individual tier nodes, but besides the check they're otherwise the same.

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.cache.common.tier;
package org.opensearch.common.cache.tier;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid renaming these packages? This has introduced a lot of changes.
Plus for cache-common module, it makes sense to keep package name prefix as org.opensearch.cache

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this if we make a couple methods in DefaultCacheStatsHolder public. Otherwise I'm not sure the tests can work out. Will make these changes.

This reverts commit 3b15a7a.

Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Copy link
Contributor

github-actions bot commented Nov 5, 2024

❌ Gradle check result for f85b719: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Search Search query, autocomplete ...etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Stats for tiered spillover cache are wrong in some situations
2 participants