fapifta commented on a change in pull request #2160:
URL: https://github.com/apache/ozone/pull/2160#discussion_r618052035



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/upgrade/SCMUpgradeFinalizer.java
##########
@@ -74,33 +70,107 @@ public boolean preFinalizeUpgrade() throws IOException {
     msg += "\n  New pipelines creation will remain frozen until Upgrade " +
         "is finalized.";
 
-    storageContainerManager.preFinalizeUpgrade();
+    PipelineManager pipelineManager = scm.getPipelineManager();
+    /**
+     * Ask pipeline manager to not create any new pipelines. Pipeline
+     * creation will remain frozen until postFinalizeUpgrade().
+     */
+    pipelineManager.freezePipelineCreation();
+
+    /**
+     * Ask all the existing data nodes to close any open containers and
+     * destroy existing pipelines
+     */
+    waitForAllPipelinesToDestroy(pipelineManager);
+
+    /**
+     * We can not yet move all the existing data nodes to HEALTHY-READONLY
+     * state since the next heartbeat will move them back to HEALTHY state.
+     * This has to wait till postFinalizeUpgrade, when SCM MLV version is
+     * already upgraded as part of finalize processing.
+     * While in this state, it should be safe to do finalize processing for
+     * all new features. This will also update ondisk mlv version. Any
+     * disrupting upgrade can add a hook here to make sure that SCM is in a
+     * consistent state while finalizing the upgrade.
+     */
+
     logAndEmit(msg);
-    return true;
   }
 
   @Override
-  protected void finalizeUpgrade(Storage storageConfig)
+  public void finalizeUpgrade(StorageContainerManager scm)
       throws UpgradeException {
-    for (HDDSLayoutFeature f : versionManager.unfinalizedFeatures()) {
-      Optional<? extends UpgradeAction> action = f.scmAction(ON_FINALIZE);
-      finalizeFeature(f, storageConfig, action);
-      updateLayoutVersionInVersionFile(f, storageConfig);
-      versionManager.finalized(f);
-    }
-    versionManager.completeFinalization();
+    super.finalizeUpgrade(scm::getScmStorageConfig);
   }
 
-  public void postFinalizeUpgrade() throws IOException {
-    storageContainerManager.postFinalizeUpgrade();
+  public void postFinalizeUpgrade(StorageContainerManager scm)
+      throws IOException {
+    /**
+     * Don't wait for next heartbeat from datanodes in order to move them to
+     * Healthy-Readonly state. Force them to Healthy-ReadOnly state so that
+     * we can resume pipeline creation right away.
+     */
+    scm.getScmNodeManager().forceNodesToHealthyReadOnly();
+
+    /**

Review comment:
       Can we move this to be the apidoc of the called resumePipelineCreation 
method instead?




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

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