jojochuang commented on code in PR #7792:
URL: https://github.com/apache/ozone/pull/7792#discussion_r1943447811
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java:
##########
@@ -583,6 +583,49 @@ public void testHSyncDeletedKey() throws Exception {
}
}
+ static Stream<BucketLayout> bucketLayouts() {
+ return Stream.of(BucketLayout.FILE_SYSTEM_OPTIMIZED, BucketLayout.LEGACY);
+ }
+
+ @ParameterizedTest
+ @MethodSource("bucketLayouts")
+ public void testBatchKeyDeletionWithHSync(BucketLayout bucketLayout) throws
Exception {
+ // Create a bucket with the specified layout
+ OzoneBucket testBucket = TestDataUtil.createVolumeAndBucket(client,
bucketLayout);
+
+ final String rootPath = String.format("%s://%s/",
+ OZONE_OFS_URI_SCHEME, CONF.get(OZONE_OM_ADDRESS_KEY));
+ CONF.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, rootPath);
+
+ final String dir = OZONE_ROOT + testBucket.getVolumeName()
+ + OZONE_URI_DELIMITER + testBucket.getName();
+
+ // Create multiple files, some with hsync
+ final int numFiles = 5;
+ List<String> openKeys = new ArrayList<>();
+
+ try (FileSystem fs = FileSystem.get(CONF)) {
+ for (int i = 0; i < numFiles; i++) {
+ String keyName = "batch-key-" + i;
+ Path file = new Path(dir, keyName);
+ try (FSDataOutputStream os = fs.create(file, true)) {
+ os.write(1);
+ os.hsync();
+ openKeys.add(keyName);
+ }
Review Comment:
Ok sorry now I recall what we wanted to cover in this test case.
We want to open the files, write, hsync; while it's still open, delete the
keys.
The try with resources pattern closes the file after exiting this block, so
that's not what we want.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]