ArafatKhan2198 commented on code in PR #7452:
URL: https://github.com/apache/ozone/pull/7452#discussion_r1856371223
##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/upgrade/TestReconLayoutVersionManager.java:
##########
@@ -112,8 +112,8 @@ public void testFinalizeLayoutFeaturesWithMockedValues()
throws SQLException {
ReconStorageContainerManagerFacade.class));
// Verify that schema versions are updated for our custom features
- verify(schemaVersionTableManager, times(1)).updateSchemaVersion(1);
- verify(schemaVersionTableManager, times(1)).updateSchemaVersion(2);
+ verify(schemaVersionTableManager, times(1)).updateSchemaVersion(1, null);
Review Comment:
Thanks for the comment, Devesh!
I’ve added two tests in `TestReconLayoutVersionManager`
(`testUpdateSchemaFailure` and `testUpgradeActionFailure`) to confirm the code
changes. Additionally, I manually tested the rollback mechanism on a cluster by
simulating an error in `InitialConstraintUpgradeAction`.
The manual testing showed that if an upgrade action or schema update fails,
the database transaction is rolled back, and the Metadata Layout Version (MLV)
reverts to its previous state. This ensures system consistency and prevents
partial updates, as shown in the following logs:
```
2024-11-25 15:46:34 2024-11-25 10:16:34,768 [main] INFO
upgrade.ReconLayoutVersionManager: Current MLV: -1. SLV: 0. Checking features
for registration...
2024-11-25 15:46:34 2024-11-25 10:16:34,787 [main] INFO
recon.ReconSchemaVersionTableManager: Inserted new schema version '0'.
2024-11-25 15:46:34 2024-11-25 10:16:34,788 [main] INFO
upgrade.ReconLayoutVersionManager: MLV updated to: 0
2024-11-25 15:46:34 2024-11-25 10:16:34,794 [main] INFO codegen.SqlDbUtils:
UNHEALTHY_CONTAINERS table already exists, skipping creation.
2024-11-25 15:46:34 2024-11-25 10:16:34,810 [main] INFO
upgrade.InitialConstraintUpgradeAction: Added the updated constraint to the
UNHEALTHY_CONTAINERS table for enum state values: [MISSING, EMPTY_MISSING,
UNDER_REPLICATED, OVER_REPLICATED, MIS_REPLICATED, ALL_REPLICAS_BAD,
NEGATIVE_SIZE]
2024-11-25 15:46:34 2024-11-25 10:16:34,815 [main] ERROR
upgrade.ReconLayoutVersionManager: Failed to finalize feature 0. Rolling back
changes.
2024-11-25 15:46:34 java.sql.SQLException: Failed to execute
InitialConstraintUpgradeAction
2024-11-25 15:46:34 at
org.apache.hadoop.ozone.recon.upgrade.InitialConstraintUpgradeAction.execute(InitialConstraintUpgradeAction.java:67)
2024-11-25 15:46:34 at
org.apache.hadoop.ozone.recon.upgrade.ReconLayoutVersionManager.finalizeLayoutFeatures(ReconLayoutVersionManager.java:99)
2024-11-25 15:46:34 at
org.apache.hadoop.ozone.recon.ReconServer.call(ReconServer.java:170)
2024-11-25 15:46:34 at
org.apache.hadoop.ozone.recon.ReconServer.call(ReconServer.java:73)
```
--
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]