engine/schema: fix missing 4.20.1.0 node in DB upgrade hierarchy#12875
engine/schema: fix missing 4.20.1.0 node in DB upgrade hierarchy#12875RosiKyu wants to merge 1 commit intoapache:4.20from
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the DB upgrade version graph so direct upgrades from CloudStack 4.20.1.0 correctly traverse to 4.20.3.0, instead of falling back to 4.20.0.0 and re-running earlier migrations.
Changes:
- Adds a no-op upgrader for 4.20.1.0 → 4.20.2.0 and registers 4.20.1.0 in
DatabaseUpgradeChecker’s version hierarchy. - Makes
schema-42000to42010.sqlresilient to re-execution by changing theconfiguration_groupinsert toINSERT IGNORE. - Adds unit tests covering the 4.20.1.0 → 4.20.3.0 and 4.20.2.0 → 4.20.3.0 upgrade paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java | Adds regression tests validating the computed upgrade path for 4.20.x direct upgrades. |
| engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql | Prevents duplicate-key failure on re-run by using INSERT IGNORE for the “Usage Server” config group. |
| engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42010to42020.java | Introduces a no-op upgrader to represent the missing 4.20.1.0 node in the upgrade chain. |
| engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java | Registers the missing 4.20.1.0 node so upgrade path calculation no longer “rounds down” to 4.20.0.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #12875 +/- ##
=========================================
Coverage 16.25% 16.25%
- Complexity 13415 13416 +1
=========================================
Files 5664 5665 +1
Lines 500465 500484 +19
Branches 60780 60780
=========================================
+ Hits 81338 81344 +6
- Misses 410031 410045 +14
+ Partials 9096 9095 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bff31e5 to
5db8751
Compare
|
@blueorangutan package |
|
@nvazquez a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
| -- under the License. | ||
|
|
||
| --; | ||
| -- Schema upgrade from 4.20.1.0 to 4.20.2.0 |
There was a problem hiding this comment.
@RosiKyu I think, these files are not needed when there is nothing to update in the DB.
| throw new CloudRuntimeException("Unable to find " + scriptFile); | ||
| } | ||
| return new InputStream[]{script}; | ||
| } |
There was a problem hiding this comment.
no need to override all these methods, default implementations would handle them.
There was a problem hiding this comment.
@sureshanaparti - DbUpgradeAbstractImpl currently provides no default implementations, and DbUpgrade is a plain interface with no defaults either, so all methods need to be explicitly implemented. To avoid touching the interface or the abstract base class in this fix PR (which is scoped to the upgrade path bug), I've kept the full implementation in Upgrade42010to42020.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17223 |
52ba5a6 to
1736fe6
Compare
Direct upgrade from 4.20.1.0 to 4.20.3.0 failed because the upgrade hierarchy skipped the 4.20.1.0 node, causing DatabaseVersionHierarchy to fall back to 4.20.0.0 and re-run Upgrade42000to42010. This triggered a duplicate key violation on configuration_group.name='Usage Server' which already existed from the original 4.20.1.0 install. - Add Upgrade42010to42020 no-op upgrader to register 4.20.1.0 in the upgrade hierarchy - Register it in DatabaseUpgradeChecker between 4.20.0.0 and 4.20.2.0 - Harden schema-42000to42010.sql with INSERT IGNORE as a safety net - Add unit tests for direct 4.20.1.0->4.20.3.0 and 4.20.2.0->4.20.3.0 upgrade paths
1736fe6 to
ac74c37
Compare
Direct upgrade from 4.20.1.0 to 4.20.3.0 failed because the upgrade hierarchy skipped the 4.20.1.0 node, causing DatabaseVersionHierarchy to fall back to 4.20.0.0 and re-run Upgrade42000to42010. This triggered a duplicate key violation on configuration_group.name='Usage Server' which already existed from the original 4.20.1.0 install.
Description
This PR...
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?