-
Notifications
You must be signed in to change notification settings - Fork 600
HDDS-14570. SCM should finalize all versions with one Ratis request #9715
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
Changes from all commits
44c9358
c501d9e
25991d7
b1a344e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,22 +70,33 @@ public void preFinalizeUpgrade(SCMUpgradeFinalizationContext context) | |
|
|
||
| @Override | ||
| public void finalizeLayoutFeature(LayoutFeature lf, | ||
| SCMUpgradeFinalizationContext context) throws UpgradeException { | ||
| // Run upgrade actions, update VERSION file, and update layout version in | ||
| // DB. | ||
| SCMUpgradeFinalizationContext context) throws UpgradeException { | ||
| throw new UnsupportedOperationException("FinalizeLayoutFeature is not supported in this implemementation. " + | ||
| "Please use finalizeLayoutFeatures instead."); | ||
| } | ||
|
|
||
| @Override | ||
| public void finalizeLayoutFeatures(Iterable<LayoutFeature> features, SCMUpgradeFinalizationContext context) | ||
| throws UpgradeException { | ||
| int lastLv = -1; | ||
| for (LayoutFeature lf : features) { | ||
| lastLv = lf.layoutVersion(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be inside if (-1 != lf.layoutVersion()) check?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was intentionally like this, as we want to store the first and last value in the iterator. However I have refactored this a bit in the latest version as we don't actually need the firstLv to be passed through. |
||
| } | ||
| try { | ||
| context.getFinalizationStateManager() | ||
| .finalizeLayoutFeature(lf.layoutVersion()); | ||
| if (lastLv > -1) { | ||
| // If there are no feature to finalize we just skip this and the finalize operation is a noop. | ||
| context.getFinalizationStateManager().finalizeLayoutFeatures(lastLv); | ||
| } else { | ||
| LOG.info("No layout features to finalize."); | ||
| } | ||
| } catch (IOException ex) { | ||
| throw new UpgradeException(ex, | ||
| UpgradeException.ResultCodes.LAYOUT_FEATURE_FINALIZATION_FAILED); | ||
| throw new UpgradeException(ex, UpgradeException.ResultCodes.LAYOUT_FEATURE_FINALIZATION_FAILED); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Run on each SCM (leader and follower) when a layout feature is being | ||
| * finalized to run its finalization actions, update the VERSION file, and | ||
| * move the state of its in memory datanodes to healthy readonly. | ||
| * finalized to run its finalization actions, update the VERSION file. | ||
| * | ||
| * @param lf The layout feature that is being finalized. | ||
| * @param context Supplier of objects needed to run the steps. | ||
|
|
||
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.
Overall the changes make sense to me, only this line is a little hard to track back. Where does this come from?
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.
The current metaLayoutVersion reported by the versionManager is the last version that was finalized. So when we get a
finalizeLayoutFeaturesrequest we have to finalize all features from "current + 1" to thetoVersionpassed. That is why we get MetaLayoutVersion + 1.In a future change, we have some logic to apply to the toVersion - eg if the toVersion is greater than our
softwareLayoutVersionit means this software is an unexpected version and it should abort. But as the current implementation doesn't do that, we are keeping it as it was for now, and will add that when its all simplified.Otherwise we could just drop the toVersion parameter and just finalize everything that isn't already finalized.
Does that answer your question?
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.
The
toVersionparameter will be used checked against our software version in a future change to make sure all machines are running the same software version before proceeding with finalization. We can just useversionManager.unfinalizedFeaturesto actually iterate the features and send them in for finalization though.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.
I'll tidy this up in the next PR. Probably if I take away the use of toVersion, I will get checkstyle or PMD warnings about unused parameters ...