HDDS-14741. Fix flaky testLinearizableReadConsistency follower read test.#10748
HDDS-14741. Fix flaky testLinearizableReadConsistency follower read test.#10748jojochuang wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces test flakiness in OM HA follower-read consistency checks and also hardens OM follower bootstrap snapshot downloads by adding an SST-size estimate signal from leader to follower and enforcing pre-download disk-space checks.
Changes:
- Stabilize
testLinearizableReadConsistencyby replacing a flakylistKeyssize assertion with aheadObjectread-after-write check and flushing OMs after bulk writes. - Add checkpoint SST-size estimation (
total bytes+file count) and plumb it through OM checkpoint servlet responses viaX-Ozone-Om-Checkpoint-Estimated-Sst-Bytes. - Add follower-side disk space prechecks and improved “disk full/quota” diagnostics during snapshot download, plus new OM bootstrap configuration keys and coverage tests.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis_snapshot/TestOmRatisSnapshotProvider.java | Adds unit tests for disk-full/quota detection and bootstrap disk-space check behavior. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/OMDBCheckpointUtils.java | Introduces SST size estimation helper and logging helper overload. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis_snapshot/OmRatisSnapshotProvider.java | Adds disk-space prechecks for follower bootstrap download and disk-full/quota detection/logging. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java | Improves bootstrap failure logging when disk-full/quota is detected. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServletInodeBasedXfer.java | Computes/returns SST estimate for full checkpoints and sets the response header. |
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMDBCheckpointServlet.java | Sets SST estimate header for full checkpoints and updates streaming signature to accept HttpServletResponse. |
| hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAFollowerReadWithAllRunning.java | Reworks flaky follower-read test to use flush + headObject instead of listKeys count. |
| hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServletInodeBasedXfer.java | Adds test ensuring follower aborts when leader’s SST estimate implies insufficient disk space. |
| hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServlet.java | Updates tests to pass HttpServletResponse and adds a response output-stream mock helper. |
| hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOMDBCheckpointUtils.java | Adds test coverage for the new SST estimation helper. |
| hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java | Adds new OM bootstrap disk-space configuration keys and defaults. |
| hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/DBCheckpointServlet.java | Updates writeDbDataToStream signature to take HttpServletResponse. |
| hadoop-hdds/common/src/main/resources/ozone-default.xml | Documents new OM bootstrap disk-space config properties. |
| hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java | Adds the new checkpoint estimate response header constant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private static boolean containsDiskFullOrQuotaText(String text) { | ||
| String m = text.toLowerCase(Locale.ROOT); | ||
| return m.contains("no space left on device") | ||
| || m.contains("no space") | ||
| || m.contains("space left") | ||
| || m.contains("enospc") | ||
| || m.contains("disk quota exceeded") | ||
| || m.contains("quota exceeded") | ||
| || m.contains("quota"); | ||
| } |
| public static final String OZONE_OM_BOOTSTRAP_MIN_SPACE_KEY = | ||
| "ozone.om.bootstrap.min.space"; | ||
| public static final String OZONE_OM_BOOTSTRAP_MIN_SPACE_DEFAULT = "5GB"; | ||
|
|
|
Thanks @jojochuang for the patch.
Why do we need to flush the writes to DB in an integration test? The OM should be linearizable even if the cache is not flushed yet, if it's not then something is wrong with linearizability and we should fix it. IMO flushing in test is just hiding the linearizable issue, I would rather have the test flaky or even disabled rather than falsely claim the OM is linearizable when it's not. Also the PR is mixed with some unrelated snapshots patches. |
…est. Remove the proxy stickiness assertion that fails when follower read retries rotate the proxy, flush all OMs after bulk writes, and verify bulk write visibility with headObject on the last key instead of a flaky listKeys count. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: Ide2d4d389aa92ca0d412a1353d3376847ba33715
| String lastBulkKey = null; | ||
| for (int i = 0; i < 100; i++) { | ||
| createKey(ozoneBucket); | ||
| lastBulkKey = createKey(ozoneBucket); | ||
| } |
|
close for now. need a further look. |
Summary
@Flaky("HDDS-14741")and the proxy stickiness assertion that fails when follower read retries rotate the proxy provider index.listKeyscount assertion (intermittently returned 100 of 101 keys on follower read) with aheadObjectcheck on the last bulk-written key, which matches the test's linearizable read-after-write goal.Jira
https://issues.apache.org/jira/browse/HDDS-14741
Test plan
Generated-by: Cursor (Composer)
Made with Cursor