-
Notifications
You must be signed in to change notification settings - Fork 192
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
Dropping of unknown configuration keys can lead to inconsistent config state #4523
Comments
I encountered this bug in the context of AiiDAlab. |
Tagging @sphuber for comment. |
I think we first need to decide whether we want to support bidirectional migrations of the config. Because if we decide to do so, that will come with significant development costs and complications. I am also not sure that we can always provide fully compatible backwards migrations. Take for example the migration that added a profile UUID. This was generated randomly. If the user uses the profile at that stage, the RabbitMQ queues would be based on this and their active processes associated to it. If they then migrate backwards, the profile UUID is dropped and when they migrate forwards again, a different UUID is generated, and they will have lost all their active processes. There might be an ad-hoc solution to this, but it is just an example that providing this functionality in a bullet-proof way is far from trivial. The alternative, of not guaranteeing backwards migration, seems like the more reasonable option to me. Especially, given that we also don't provide this on the database level. Once you migrate to a specific version of the database schema, there is no going back. Of course config and database do not change their versions in sync, so there would be scenarios possible where you can change versions of That being said, maybe we can make the life of the developer a bit easier. We could think to remove the logic that drops unknown keys from the config once it is parsed, and instead simply ignore them, optionally printing a warning. I will leave it up to you to decide which of these three scenarios are most developer-friendly. |
I don't really understand why the unknown configuration keys need to be dropped here in the first place. The "CONFIG_VERSION": {
"CURRENT": 4,
"OLDEST_COMPATIBLE": 3
} means (or is supposed to mean) that the latest AiiDA version that created this config has config version 4, but AiiDA versions with config version 3 should also be able to run under this config (without needing to change it back). By dropping the keys, the assumption behind this system is broken. If we want to keep the I agree that bi-directional migrations are probably not the right solution. |
Another option: Only allow config changes to be made when |
In my case it is possible that I accidentally ran an older version of AiiDA or so on my instance and it reverted the config (dropped the keys), but did not change the config version number. Then I ran a newer version and I started to observe this error with no idea what was going on. As a user I would have much preferred that AiiDA had transparently explained to me that I'm running an old version of AiiDA against a newer config and this just can't work instead of silently corrupting my configuration. |
Yeah, it's clear the status quo is a bug - it's less clear what the "right" way to fix it would be. |
A few things to note here:
I would also be in favour of ditching |
This is fixed for |
Describe the bug
When an unknown key is encountered in the configuration, it is simply dropped instead of going through the config migrations. This can lead to an inconsistent configuration that is not recoverable without manually editing it.
Steps to reproduce
Steps to reproduce the behavior:
pip install aiida-core==1.4.1
pip install aiida-core==1.3.1
verdi
. The config will still containpip install aiida-core==1.4.1
Expected behavior
The unknown keys should either remain in place, or the
CURRENT_VERSION
of the config needs to be changed to match its content.Some thoughts
The original intent of the
CURRENT_VERSION
andOLDEST_COMPATIBLE
in the config is that an older version of AiiDA can happily run on a newer config version, as long as all the keys it expects are still there and unchanged. As such, the config doesn't need migrating, and once we go back to the newer AiiDA version no migration is necessary.Since there were quite some changes to all that since way-back-when, I'm not sure this is still the case. Thinking of it, adding a new profile while on the old AiiDA version (or doing any other kind of change) is also bound to confuse the newer AiiDA version. Maybe then the "compatible versions" concepts needs to be dropped, but we should always make sure to go through migrations (in both directions)?
The text was updated successfully, but these errors were encountered: