From ef4ee921bddfaae197f46ff9b5ea6efed6923645 Mon Sep 17 00:00:00 2001 From: rjgoyln Date: Sun, 20 Sep 2026 14:17:59 +0800 Subject: [PATCH 1/2] HDDS-16523. Intermittent failure in TestHSync#testHSyncOpenKeyCommitAfterExpiry 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. --- .../src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java index 0abae8bfa51..72dd344a8df 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java @@ -492,6 +492,8 @@ public void testHSyncOpenKeyCommitAfterExpiry() throws Exception { // Create key2 without hsync try (FSDataOutputStream os1 = fs.create(key2, true)) { os1.write(1); + // Wait for double buffer flush to avoid flakiness because RDB iterator bypasses table cache + cluster.getOzoneManager().awaitDoubleBufferFlush(); // There should be 2 key in openFileTable assertThat(getOpenKeyInfo(BUCKET_LAYOUT)) .extracting(OmKeyInfo::getKeyName) @@ -586,6 +588,7 @@ public void testHSyncOpenKeyDeletionWhileDeleteDirectory() throws Exception { try (FSDataOutputStream os = fs.create(key1, true)) { os.write(1); os.hsync(); + cluster.getOzoneManager().awaitDoubleBufferFlush(); // There should be 1 key in openFileTable assertThat(getOpenKeyInfo(BUCKET_LAYOUT)) .extracting(OmKeyInfo::getKeyName) From 8542bb6f15f340317270f1e7252a64db677c07ba Mon Sep 17 00:00:00 2001 From: rjgoyln Date: Sun, 20 Sep 2026 14:20:34 +0800 Subject: [PATCH 2/2] Explain why the second table read waits for the double buffer flush --- .../src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java index 72dd344a8df..01087c7cfce 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java @@ -588,6 +588,7 @@ public void testHSyncOpenKeyDeletionWhileDeleteDirectory() throws Exception { try (FSDataOutputStream os = fs.create(key1, true)) { os.write(1); os.hsync(); + // Wait for double buffer flush to avoid flakiness because RDB iterator bypasses table cache cluster.getOzoneManager().awaitDoubleBufferFlush(); // There should be 1 key in openFileTable assertThat(getOpenKeyInfo(BUCKET_LAYOUT))