HDDS-16523. Fix flaky openFileTable assertions in TestHSync - #11281
Conversation
…fterExpiry The assertions read the OM tables through an RDB iterator, which bypasses the table cache, while OM acknowledges a write as soon as the double buffer queues the response. A key created by the immediately preceding call can therefore still be invisible when the assertion runs.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues; the changes address the flaky assertions while preserving their strictness.
Review effort: Lite
Findings: None
What changed in this PR
This pull request fixes flaky TestHSync assertions by waiting for OM double-buffer persistence before reading open-file tables.
Changes:
- Added flush waits in both affected tests.
- Preserved strict table-content assertions.
| File | Description |
|---|---|
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java |
Synchronizes assertions with OM persistence. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks @rjgoyln for working on this! Could you please use the GitHub Actions flaky-test-check workflow to verify this change? |
peterxcli
left a comment
There was a problem hiding this comment.
@ivandika3 just FYI
The assertion became effective in HDDS-16084 (commit a9c9caf), which replaced the no-op
assertThat(2 == getOpenKeyInfo(...).size())with a realAssertJassertion on key
names. The race it exposes, however, predates that change.
|
@chungen0126 Thanks for the review! Done. Ran Also verified the fix deterministically: delaying the OM double buffer around |
What changes were proposed in this pull request?
TestHSync#testHSyncOpenKeyCommitAfterExpiryintermittently sees onlyhsync-keyin the open file table, even though it expects bothhsync-keyandkey2.The assertions read the OM tables through an RDB iterator, which bypasses the table cache. At the same time, OM acknowledges a write as soon as it is queued in the double buffer. As a result, the
fs.create(key2)immediately preceding the assertion may not have been persisted yet, whilehsync-keyalready has, because it went through an additional hsync round trip.testHSyncOpenKeyCommitAfterExpiry.testHSyncOpenKeyDeletionWhileDeleteDirectory, whose assertion afteros.hsync()has the same race.This file already waits for the double buffer before seven other table reads, so these changes preserve the strength of the assertions rather than weakening them.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16523
How was this patch tested?
Both test methods pass locally, with checkstyle and PMD clean for the module.
The race was also made deterministic to confirm the fix addresses it: pausing the double buffer before
fs.create(key2)and unpausing it from another thread three seconds later. Without this patch the assertion then fails exactly as reported in the JIRA.The same stalled run passes with the patch. That instrumentation is not part of the change.
Generated-by: Claude Code (Opus 5)