DaveTeng0 commented on code in PR #4634:
URL: https://github.com/apache/ozone/pull/4634#discussion_r1183074761
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshot.java:
##########
@@ -193,6 +198,67 @@ private void init() throws Exception {
// stop the deletion services so that keys can still be read
keyManager.stop();
+ preFinalizationChecks();
+ finalizeOMUpgrade();
+ }
+
+ private static void expectFailurePreFinalization
+ (LambdaTestUtils.VoidCallable eval)
+ throws Exception {
+ LambdaTestUtils.intercept(OMException.class,
+ "cannot be invoked before finalization.", eval);
+ }
+
+ private static void preFinalizationChecks()
+ throws Exception {
+ // None of the snapshot APIs is usable before the upgrade finalization step
+ expectFailurePreFinalization(() ->
+ store.createSnapshot(volumeName, bucketName,
+ UUID.randomUUID().toString()));
+
+ expectFailurePreFinalization(() ->
+ store.listSnapshot(volumeName, bucketName));
+ expectFailurePreFinalization(() ->
+ store.snapshotDiff(volumeName, bucketName,
+ UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(),
+ "", 1000, false));
+ expectFailurePreFinalization(() ->
+ store.deleteSnapshot(volumeName, bucketName,
+ UUID.randomUUID().toString()));
+ }
+
+ /**
+ * Trigger OM upgrade finalization from the client and block until completion
+ * (status FINALIZATION_DONE).
+ */
+ private static void finalizeOMUpgrade()
+ throws IOException, InterruptedException, TimeoutException {
+
+ // Trigger OM upgrade finalization. Ref: FinalizeUpgradeSubCommand#call
+ final OzoneManagerProtocol omclient =
+ client.getObjectStore()
+ .getClientProxy().getOzoneManagerClient();
+ final String upgradeClientID = "Test-Upgrade-Client-" + UUID.randomUUID();
+ UpgradeFinalizer.StatusAndMessages finalizationResponse =
+ omclient.finalizeUpgrade(upgradeClientID);
+
+ // The status should transition as soon as the client call above returns
+ Assert.assertTrue(isStarting(finalizationResponse.status()));
+ // Wait for the finalization to be marked as done.
+ // 10s timeout should be plenty.
+ GenericTestUtils.waitFor(() -> {
Review Comment:
Sure!
--
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]