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


##########
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:
   I'm inclined to merge this one first. And will rebase HDDS-11260 afterwards.



-- 
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: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to