Copilot commented on code in PR #11925:
URL: https://github.com/apache/ozone/pull/11925#discussion_r4457671743


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/upgrade/FinalizationStateManagerImpl.java:
##########
@@ -52,6 +53,36 @@ public void finalizeUpgrade() throws IOException {
         OzoneConsts.APPARENT_VERSION_KEY, 
String.valueOf(versionManager.getApparentVersion().serialize()));
   }
 
+  @Deprecated
+  @Override
+  public void addFinalizingMark() {
+    // The pre-ZDU finalizing mark is no longer used, see 
ClearFinalizingStateScmUpgradeAction.
+  }
+
+  /**
+   * Finalizes up to the given pre-ZDU layout version, but not beyond it, as 
the SCM that wrote the entry did.
+   */
+  @Deprecated
+  @Override
+  public void finalizeLayoutFeature(Integer layoutVersion) throws IOException {
+    if (layoutVersion == null) {
+      throw new IOException("finalizeLayoutFeature requires a layout version 
argument");
+    }
+    HDDSLayoutFeature feature = HDDSLayoutFeature.deserialize(layoutVersion);
+    if (feature == null) {
+      throw new IOException("Unknown pre-ZDU layout version " + layoutVersion);
+    }
+    versionManager.finalizeUpgrade(feature);
+    transactionBuffer.addToBuffer(finalizationStore,
+        OzoneConsts.APPARENT_VERSION_KEY, 
String.valueOf(versionManager.getApparentVersion().serialize()));

Review Comment:
   If a lagging SCM installs a checkpoint containing a higher pre-ZDU version 
written here, `RatisBasedVersionManager.finalizeFromSnapshotIfRequired()` still 
calls the no-argument `finalizeUpgrade()`. This advances the receiver to the 
software version rather than the checkpoint's version, potentially finalizing 
ZDU without a corresponding Raft command. Change that snapshot path to call 
`finalizeUpgrade(apparentVersionInNewDB)` and add a regression test for 
installing a checkpoint containing a pre-ZDU version.



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