Fix a flaky test that forces materialization to hit cache#19759
Fix a flaky test that forces materialization to hit cache#19759andrross merged 1 commit intoopensearch-project:mainfrom
Conversation
|
❌ Gradle check result for e931bbc: null 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? |
e931bbc to
5e91d97
Compare
|
❌ Gradle check result for 5e91d97: 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? |
|
❌ Gradle check result for 5e91d97: 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? |
5e91d97 to
86b2ece
Compare
|
❕ Gradle check result for 86b2ece: 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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19759 +/- ##
============================================
- Coverage 73.20% 73.18% -0.03%
+ Complexity 71745 71728 -17
============================================
Files 5795 5795
Lines 328304 328298 -6
Branches 47283 47279 -4
============================================
- Hits 240334 240261 -73
- Misses 68663 68800 +137
+ Partials 19307 19237 -70 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR is stalled because it has been open for 30 days with no activity. |
|
Can someone review this please... |
Signed-off-by: Joe Liu <guoqing4@illinois.edu>
86b2ece to
0275362
Compare
WalkthroughA test fix that adds explicit materialization of LeafFieldData instances by calling Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
server/src/test/java/org/opensearch/index/fielddata/IndexFieldDataServiceTests.java (1)
243-248: Consider applying the same fix to other tests with similar patterns.The test method
testClosingSegmentInvalidatesEntriesfollows a similar pattern: loading field data (lines 244-246) and immediately asserting cache state (line 248) without forcing materialization. While this test hasn't been reported as flaky, it may be susceptible to the same issue.Consider adding materialization calls here as well:
List<LeafFieldData> loadFields = new ArrayList<>(); for (LeafReaderContext lrContext : reader.getContext().leaves()) { - loadFields.add(ifd.load(lrContext)); + LeafFieldData leafFieldData = ifd.load(lrContext); + leafFieldData.getBytesValues(); // Force materialization + loadFields.add(leafFieldData); }Similar patterns exist in:
testClearField(lines 335-336)testFieldDataCacheListener(line 413)testExceptionWhileRemovingKey(lines 589-590)
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
server/src/test/java/org/opensearch/index/fielddata/IndexFieldDataServiceTests.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: gradle-check
- GitHub Check: assemble (21, windows-latest)
- GitHub Check: assemble (21, ubuntu-24.04-arm)
- GitHub Check: assemble (25, ubuntu-latest)
- GitHub Check: assemble (21, ubuntu-latest)
- GitHub Check: assemble (25, ubuntu-24.04-arm)
- GitHub Check: assemble (25, windows-latest)
- GitHub Check: Analyze (java)
- GitHub Check: precommit (21, ubuntu-24.04-arm)
- GitHub Check: precommit (25, windows-latest)
- GitHub Check: precommit (21, windows-2025, true)
- GitHub Check: precommit (25, macos-15)
- GitHub Check: precommit (21, windows-latest)
- GitHub Check: detect-breaking-change
- GitHub Check: precommit (25, macos-15-intel)
- GitHub Check: precommit (21, macos-15-intel)
- GitHub Check: precommit (25, ubuntu-24.04-arm)
- GitHub Check: precommit (25, ubuntu-latest)
- GitHub Check: precommit (21, ubuntu-latest)
- GitHub Check: precommit (21, macos-15)
🔇 Additional comments (1)
server/src/test/java/org/opensearch/index/fielddata/IndexFieldDataServiceTests.java (1)
188-190: LGTM! The fix correctly addresses the flaky test.The explicit materialization via
getBytesValues()ensures that both field data instances populate the shared cache before the assertion at line 192. This eliminates the race condition whereload()might return lightweight wrappers that defer cache population.
Description
IndexFieldData#load(LeafReaderContext)does not always build and insert the heavy field-data into the shared cache immediately. For some field types/implementations it returns a lightweight wrapper that defers the expensive build until you actually access the values, or until a global/agg path forces construction.Related Issues
Resolves #19730
Check List
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.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.