🐞 Fix db config persistence initialization #6220
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
ConfigSeedProvider
will always return the file system persistence as the seed provider and load into the database config persistence, which will roll back unused connector definitions, as reported in Connector versions are rolled back after Airbyte server is upgraded #5954.ConfigSeedProvider
.ConfigPersistence#loadData
method is only purposed to initialize the persistence. However, later on it is patched to update the connector definitions as well. The method itself is tested, however, the seed persistence fed into this method is not because of the first bullet point, resulting in this bug.updateConnectorDefinitions
. This is ok if the seed is always the latest. However, because old configs can be fed into theloadData
method, without the version check, the connector will always get rolled back if it is not used. Should there be a version check, we can have a second layer of defense.How
initialize
method. This method is tested and can guard against stale seed being used to initialize the persistence.updateConnectorDefinitions
that only updates a connector if there is a new version.Recommended reading order
DatabaseConfigPersistence.java