-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDDS-11465. Introducing Schema Versioning for Recon to Handle Fresh Installs and Upgrades. #7213
Conversation
…ndle Fresh Installs and Upgrades.
Thanks for working on this @ArafatKhan2198. Can we use the existing concept of "layout features" for Recon the same as they are used on other components instead of introducing a new concept unique to Recon? Recon will need to support downgrades the same as other components, and once we start versioning things it will be easier to let the existing upgrade framework handle that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ArafatKhan2198 for working on this patch. Few comments. Pls check.
...one/recon-codegen/src/main/java/org/hadoop/ozone/recon/schema/ContainerSchemaDefinition.java
Outdated
Show resolved
Hide resolved
...one/recon-codegen/src/main/java/org/hadoop/ozone/recon/schema/ContainerSchemaDefinition.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaManager.java
Outdated
Show resolved
Hide resolved
...one/recon-codegen/src/main/java/org/hadoop/ozone/recon/schema/ContainerSchemaDefinition.java
Outdated
Show resolved
Hide resolved
...p-ozone/recon-codegen/src/main/java/org/hadoop/ozone/recon/schema/StatsSchemaDefinition.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaManager.java
Outdated
Show resolved
Hide resolved
...-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaVersionTableManager.java
Outdated
Show resolved
Hide resolved
...ne/recon/src/test/java/org/apache/hadoop/ozone/recon/persistence/AbstractReconSqlDBTest.java
Outdated
Show resolved
Hide resolved
@errose28 @sumitagrawl |
@ArafatKhan2198 , In Recon context, what all MLV will incorporate only Derby tables schema update ? or will it take care recon rocks DB schema changes as well like container DB ? |
Hi @devmadhuu, In the context of Recon, the MLV (Metadata Layout Version) is not limited to just the Derby DB tables. It encompasses all Recon-specific components, including both Derby tables and RocksDB tables like the container DB. Essentially, MLV manages and tracks any schema changes or modifications in the Recon data structures, ensuring they are all updated consistently. The SLV (Software Layout Version), on the other hand, represents the software-defined feature set. It covers all new features that may or may not involve schema changes. When a new feature is added that modifies or affects the Recon DB schemas, whether it's RocksDB or Derby DB, the SLV version will get bumped, prompting an MLV increment. This is managed with the help of upgrade scripts during the finalization process. In summary:
Let me know if this clarifies your concerns! |
Pls fix checkstyle issues. |
Pls correct the terms here, looks like you are using both terms for schema layout versioning.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ArafatKhan2198 for explaining the patch and motive behind this patch. Overall looks good, just few comments and also pls update the comments in all code to. reflect the SLV meaning as Software Layout Version rather as Schema Layout Version.
As discussed, later once code freezed, you will also remove the dummy created features. Thanks.
...one/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutVersionManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls correct all comments in whole PR and replace the meaning of SLV (Schema layout version) to (Software Layout version)
.../recon-codegen/src/main/java/org/hadoop/ozone/recon/schema/SchemaVersionTableDefinition.java
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutFeature.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutFeature.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutFeature.java
Outdated
Show resolved
Hide resolved
…on-based dynamic upgrade actions
Testing out the Dynamic Upgrade action handling for Recon Schema VersioningFor testing purposes, I introduced another upgrade action type called When I started up Recon, I observed the following log outputs:
Currently, for Recon, we've decided that upgrade actions will be autofinalized. This means that only actions marked with the type This confirms that annotation-based upgrade action execution is working as expected, as only the appropriate actions (in this case, @sumitagrawl @devmadhuu please go through this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArafatKhan2198 Plz check few minor comments
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconUpgradeAction.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconUpgradeAction.java
Outdated
Show resolved
Hide resolved
...-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaVersionTableManager.java
Outdated
Show resolved
Hide resolved
...one/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutVersionManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArafatKhan2198 , thanks for improving the patch. Few comments. Pls check.
...one/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutVersionManager.java
Outdated
Show resolved
Hide resolved
...one/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutVersionManager.java
Show resolved
Hide resolved
…o handle INITIAL_VERSION in ReconLayoutVersionManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give few more comments
...-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaVersionTableManager.java
Outdated
Show resolved
Hide resolved
...-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaVersionTableManager.java
Show resolved
Hide resolved
...one/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutVersionManager.java
Outdated
Show resolved
Hide resolved
...one/recon/src/main/java/org/apache/hadoop/ozone/recon/upgrade/ReconLayoutVersionManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ArafatKhan2198 . PR changes LGTM now. +1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What changes were proposed in this pull request?
This PR introduces an upgrade framework in Recon that mirrors the pattern used in OMLayoutFeature with some key differences tailored for Recon's needs. The primary purpose of this PR is to manage and handle schema upgrades automatically during Recon startup, storing layout version information on disk and executing necessary upgrade actions.
Summary of Changes:
OMLayoutFeature
Pattern: Recon now follows a similar schema upgrade pattern as used in the OM layer, but withauto-finalization
. Unlike in OM, Recon will automatically finalize on restart without requiring manual intervention.MLV
) is stored in theRECON_SCHEMA_VERSION
table on disk. This table tracks the schema version to identify which features have been applied.SLV
) is computed dynamically based on the latest version defined inReconLayoutFeature
at runtime.ReconLayoutVersionManager
fetches the current MLV from theRECON_SCHEMA_VERSION
table.ReconLayoutFeature
.ReconLayoutVersionManager
: Handles the determination of the current MLV and SLV and performs the finalization of pending layout features.ReconSchemaVersionTableManager
: Manages interactions with the RECON_SCHEMA_VERSION table, including fetching and updating the current MLV.ReconLayoutFeature
: Enum defining the layout features with their version, description, and direct integration of upgrade actions.OMLayoutFeature
:What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11465
Developer Design Document
https://docs.google.com/document/d/1GfN-xBvvpAKOMgzoEmf_GOFt-nlyCMu9ZHqj5ug5l3w/edit?addon_store&tab=t.0#heading=h.tfszc17ucbxl
How was this patch tested?
For testing this PR, three example features were introduced into ReconLayoutFeature along with their respective upgrade scripts. These scripts were designed to simply log their execution, allowing us to verify that the upgrade framework works as intended. During Recon startup, the current Metadata Layout Version (
MLV
) was set lower than the Software Layout Version (SLV
). The logs confirmed that each feature's upgrade action executed sequentially, updating the MLV and recording the changes in theRECON_SCHEMA_VERSION
table. This successful test demonstrates that the framework correctly finalizes registered features whenMLV < SLV
.I'll remove them once the PR is approved by everyone.
Logs showcasing upgrade :-