Skip to content

Fix flaky PruneFileCacheIT.testPruneCacheWithRealData#20617

Merged
cwperks merged 1 commit intoopensearch-project:mainfrom
andrross:flaky-prune
Feb 13, 2026
Merged

Fix flaky PruneFileCacheIT.testPruneCacheWithRealData#20617
cwperks merged 1 commit intoopensearch-project:mainfrom
andrross:flaky-prune

Conversation

@andrross
Copy link
Copy Markdown
Member

I found a deterministic repro with seed B289DF27E8BA9F8. The issue is that all data for the index was still being referenced by the cache so nothing was prunable and the test failed. The behavior of the cache is that cloned IndexInputs can remained referenced until they are GC'd. The fix is to attempt to trigger GC in the polling loop until data is prunable.

Related Issues

Resolves #19724

Check List

  • Functionality includes testing.

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.

@andrross andrross requested a review from a team as a code owner February 12, 2026 21:34
@github-actions github-actions bot added >test-failure Test failure from CI, local build, etc. autocut flaky-test Random test failure that succeeds on second run labels Feb 12, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 12, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

A test file was refactored to stabilize flakiness by introducing a CacheUsage data carrier to separately track total used and active (prunable) cache bytes. All cache usage assertions and validations were updated to use the new composite structure, with added GC-aware checks to verify used and active state relationships.

Changes

Cohort / File(s) Summary
File Cache Pruning Test Refactor
server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/filecache/PruneFileCacheIT.java
Replaced single-value cache usage tracking with composite CacheUsage object (used, active fields). Updated assertions and validations to distinguish between total used bytes and prunable active bytes. Added GC-aware busy-wait checks verifying used > 0 and active < used. Switched to Hamcrest matchers (lessThan, greaterThan) and adjusted test logging terminology.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

flaky-test, >test-failure, autocut

🚥 Pre-merge checks | ✅ 4 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (13 files):

⚔️ client/rest/build.gradle (content)
⚔️ plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/bootstrap/ServerConfig.java (content)
⚔️ plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/transport/FlightStreamPlugin.java (content)
⚔️ plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/transport/FlightTransport.java (content)
⚔️ plugins/arrow-flight-rpc/src/test/java/org/opensearch/arrow/flight/bootstrap/ServerConfigTests.java (content)
⚔️ plugins/repository-hdfs/build.gradle (content)
⚔️ plugins/repository-s3/build.gradle (content)
⚔️ qa/wildfly/build.gradle (content)
⚔️ server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/filecache/PruneFileCacheIT.java (content)
⚔️ server/src/main/java/org/opensearch/common/settings/FeatureFlagSettings.java (content)
⚔️ server/src/main/java/org/opensearch/common/util/FeatureFlags.java (content)
⚔️ server/src/main/java/org/opensearch/index/shard/IndexShard.java (content)
⚔️ server/src/main/java/org/opensearch/node/Node.java (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the test being fixed (PruneFileCacheIT.testPruneCacheWithRealData) and indicates the nature of the change (fixing flakiness).
Description check ✅ Passed The description includes root cause analysis, the specific seed that reproduced the issue, the fix approach, and the linked issue number, though some template sections could be more detailed.
Linked Issues check ✅ Passed The PR addresses issue #19724 by implementing a stabilization fix: introducing GC triggering in the polling loop to ensure data becomes prunable, directly resolving the root cause of the test flakiness.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the flaky test through cache usage tracking refactoring and GC triggering logic, with no unrelated alterations present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 701a87f: 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?

Signed-off-by: Andrew Ross <andrross@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

❕ Gradle check result for 986543b: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.29%. Comparing base (d7eb5e7) to head (986543b).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20617      +/-   ##
============================================
+ Coverage     73.22%   73.29%   +0.06%     
- Complexity    72129    72172      +43     
============================================
  Files          5798     5798              
  Lines        329832   329832              
  Branches      47545    47545              
============================================
+ Hits         241522   241750     +228     
+ Misses        68998    68750     -248     
- Partials      19312    19332      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cwperks cwperks merged commit d0f1ab8 into opensearch-project:main Feb 13, 2026
35 checks passed
@andrross andrross deleted the flaky-prune branch February 13, 2026 19:31
@divyaruhil divyaruhil mentioned this pull request Feb 19, 2026
3 tasks
tanyabti pushed a commit to tanyabti/OpenSearch that referenced this pull request Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autocut flaky-test Random test failure that succeeds on second run skip-changelog >test-failure Test failure from CI, local build, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AUTOCUT] Gradle Check Flaky Test Report for PruneFileCacheIT

2 participants