-
Notifications
You must be signed in to change notification settings - Fork 178
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
Classification of product changes as safe or unsafe seems overly strict #1617
Comments
I agree that adding a measurement alias should be "safe". There are however a number of features of the current database schema that make a full and accurate of automated assessment of whether a given change is "safe"or not a more complicated problem than it might first appear, and the historic approach has been to err on the side of caution (but give the expert user enough rope to make their own call). I'm expecting that this problem will become more manageable as we move to new database schemas and shed more legacy functionality in datacube-1.9 and 2.0. We probably won't be looking at addressing this before then - but I'm happy to look at a PR if you want to have a go. |
Thanks for your feedback Paul. Based on you too believing that it should be safe, I simply executed the command with
I'd be happy to supply one, depending on what exactly you had in mind here. Adding "adding a measurement alias" to the list of allowed operations? I had a look at updates_allowed = {
('measurements','aliases'): changes.allow_creation_or_addition, But for anything more generic, I would be way too paranoid to overlook something, so that I would leave this to people who actually know the database schema. Or wait for the new schema. Your approach to "err on the side of caution but give experts enough rope" is fully reasonable. |
The approach you suggest above sounds good - I'll look forward to your PR. |
The way to assess a change as safe or unsafe seems to be that a very limited set of changes is classified as safe, while all others default to unsafe. I did some digging and found this list of allowed changes:
datacube-core/datacube/index/postgres/_products.py
Lines 110 to 124 in ff0d0b7
To me it seems that this list was set up at some point with someone thinking "These should really be safe", without actually assessing all others, which might be perfectly safe too. At least that's how I explain to myself that the
datacube product update
command actually has an--allow-unsafe
option. In practice, there seem to be enough situations that this was actively implemented -- situations where a change would be prohibited by the checking mechanism, but is actually safe, so experienced admins want to just work around it.IMO, it would be better to expand the list of allowed changes instead of routinely circumnavigating the checks against that list. Because I'm not an experienced admin who understands the system enough to assess whether he can use
--allow-unsafe
for the case at hand. And even if I was, structured checking by code is still better than error-prone checking by humans. I'd like to be able to just rely on the checks -- of course without being restricted unnecessarily.For my specific case: Why should adding a new alias to a measurement be unsafe? Why is this operation not in the list of allowed changes? I filled out the rest of this template with this case.
Expected behaviour
Adding a new alias to a product's measurement is a safe change (because it seems like a rather easy thing to me).
Actual behaviour
Running
datacube product update
with a YAML that adds a new alias is reported as an unsafe change.Case where no alias was configured before and the first is to be added:
Case where one alias was configured before and a second is to be added:
Note that I'm only adding aliases, not changing or removing any (which of course might be unsafe).
Steps to reproduce the behaviour
Run
datacube product update --dry-run foobar.yml
with a YAML that is identical to the one before, except for an additional alias.Environment information
datacube --version
are you using? ->Open Data Cube core, version 1.8.18
The text was updated successfully, but these errors were encountered: