Upgrade application: Version duplication error (Master deployment)
Closed this issue · 3 comments
Description
Upgrade application runner raise an exception when try to update the current version to run the upgrade steps.
Error
More than one version found: [EntitiesVersion{version='X.Y.Z-SNAPSHOT', status=UPGRADED, updated=null}, EntitiesVersion{version='X.Y.Z-SNAPSHOT', status=UPGRADED, updated=null}]
Investigation
The UpgradeApplication implements the spring CommandLineRunner interface.
CommandLineRunner is a simple Spring Boot interface with a run method. Spring Boot will automatically call the run method of all beans implementing this interface after the application context has been loaded.
It has not been possible replicated the issue in local.
Seems that this UpgradeApplication
is running twice creating a duplication of version entry in EntitiesVersion
From logs
metrics-services: "Version found from the property file : 4.2.5-SNAPSHOT"
jwkms: "Version found from the property file : 4.2.6-SNAPSHOT"
Solution
Implementation of a method to clean duplications on entitiesVersion when collect the versions from database before start the upgrade steps.
Test cases:
- No entry in entitiesVersion
- No duplications
- Current version duplicated
- Duplications of different versions
- Duplications of different versions with different status
- Two process running at the same time the upgrade
- Force upgrade: true
- Force upgrade: false
- One process running the upgrade
Duplication of version issue fixed.