From 16322fdfa5c92794b565e83300c30adda3c9f042 Mon Sep 17 00:00:00 2001 From: Chia-Chuan Yu Date: Sun, 22 Dec 2024 04:41:23 +0800 Subject: [PATCH] Add flush to buffer (#7609) --- .../test/java/org/apache/hadoop/fs/ozone/TestHSync.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 f185addf6b8..d00b86d937a 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 @@ -181,7 +181,7 @@ public class TestHSync { public static void init() throws Exception { final BucketLayout layout = BUCKET_LAYOUT; - CONF.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, false); + CONF.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, true); CONF.set(OZONE_DEFAULT_BUCKET_LAYOUT, layout.name()); CONF.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); CONF.setBoolean("ozone.client.hbase.enhancements.allowed", true); @@ -1426,9 +1426,12 @@ public void testHSyncKeyOverwriteNormalKey() throws Exception { outputStream2.hsync(); outputStream2.close(); assertEquals(data1.length() + data2.length(), metrics.getDataCommittedBytes()); + // wait until double buffer flush + cluster.getOzoneManager().awaitDoubleBufferFlush(); Map openKeys = getAllOpenKeys(openKeyTable); Map deletedKeys = getAllDeletedKeys(deletedTable); + // There should be no key in openKeyTable assertEquals(0, openKeys.size()); // There should be one key in delete table @@ -1503,6 +1506,8 @@ public void testHSyncKeyOverwriteHSyncKey() throws Exception { // hsync/close second hsync key should success outputStream2.hsync(); outputStream2.close(); + // wait until double buffer flush + cluster.getOzoneManager().awaitDoubleBufferFlush(); Map openKeys = getAllOpenKeys(openKeyTable); Map deletedKeys = getAllDeletedKeys(deletedTable);