ChenSammi commented on code in PR #7013:
URL: https://github.com/apache/ozone/pull/7013#discussion_r1699959172


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java:
##########
@@ -226,6 +241,72 @@ public static void teardown() {
     }
   }
 
+  private static void preFinalizationChecks() throws IOException {
+    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 + bucket.getVolumeName()
+        + OZONE_URI_DELIMITER + bucket.getName();
+
+    final Path file = new Path(dir, "pre-finalization");
+    try (RootedOzoneFileSystem fs = 
(RootedOzoneFileSystem)FileSystem.get(CONF)) {
+      try (FSDataOutputStream outputStream = fs.create(file, true)) {
+        OMException omException  = assertThrows(OMException.class, 
outputStream::hsync);
+        assertFinalizationExceptionForHsyncLeaseRecovery(omException);
+      }
+      final OzoneManagerProtocol omClient = client.getObjectStore()
+          .getClientProxy().getOzoneManagerClient();
+      OMException omException  = assertThrows(OMException.class,
+          () -> omClient.listOpenFiles("", 100, ""));
+      assertFinalizationException(omException);
+
+      omException = assertThrows(OMException.class,
+          () -> fs.recoverLease(file));
+      assertFinalizationException(omException);
+
+      fs.delete(file, false);
+    }
+  }
+
+  private static void 
assertFinalizationExceptionForHsyncLeaseRecovery(OMException omException) {
+    assertEquals(NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION,
+        omException.getResult());
+    assertThat(omException.getMessage())
+        .contains("Cluster does not have the HBase support feature finalized 
yet");
+  }
+
+  private static void assertFinalizationException(OMException omException) {
+    assertEquals(NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION,
+        omException.getResult());
+    assertThat(omException.getMessage())
+        .contains("cannot be invoked before finalization.");

Review Comment:
   Do these checks need be changed if " HDDS-11260. [hsync] Add Ozone Manager 
protocol version " got merged first? 



-- 
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]

Reply via email to