-
Notifications
You must be signed in to change notification settings - Fork 531
Database Settings: idempotent mass operations, necessary cleanup and script using it for real use case #11654
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
shellcheck
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 56 in d0bb952
| curl -s -X POST -d'[":guest","@anAuthUser"]' -H "Content-type:application/json" $ENDPOINT/dataverses/permissionsTestDv/groups/PTG/roleAssignees?key=$ROOT_KEY |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 62 in d0bb952
| curl -s -X POST -d"$ASSIGNMENT" -H "Content-type:application/json" $ENDPOINT/dataverses/permissionsTestDv/assignments/?key=$ROOT_KEY |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 80 in d0bb952
| echo @anAuthUser $AN_AUTH_USER_KEY |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 81 in d0bb952
| echo @anotherAuthUser $ANOTHER_AUTH_USER_KEY |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 90 in d0bb952
| curl -si $ENDPOINT/dataverses/permissionsTestDv?key=$AN_AUTH_USER_KEY | head -n 1 |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 94 in d0bb952
| curl -si $ENDPOINT/dataverses/permissionsTestDv?key=$ANOTHER_AUTH_USER_KEY | head -n 1 |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 103 in d0bb952
| curl -si -X POST -d@assignment.json -H "Content-type:application/json" $ENDPOINT/dataverses/permissionsTestDv/assignments/?key=$ANOTHER_AUTH_USER_KEY | head -n 1 |
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
dataverse/scripts/issues/2454/run-test.sh
Line 107 in d0bb952
| curl -si -X POST -d@assignment.json -H "Content-type:application/json" $ENDPOINT/dataverses/permissionsTestDv/assignments/?key=$AN_AUTH_USER_KEY | head -n 1 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
@poikilotherm the AdminIT$SettingsAPI#testSettingsRoundTrip fails if you have a bad setting name in your table. In my case I had put in a manual update for ":publicInstall" instead of ":PublicInstall". When I deleted the offending setting name from my local table the test passed. |
|
@poikilotherm deployment in Jenkins is failing. Here is one of the errors I'm seeing: TASK [dataverse : set user management quesadilla] ****************************** |
|
@sekmiller thanks for looking into this!
Is there anything you'd like me to do? Some migration, a startup check or similar to make things fail early?
Are we talking about this pipeline or that one? The later is expected to fail, as an update to dataverse-ansible is necessary. Don setup a distinct job that already has the patch applied for this PR, see the first link. |
|
@poikilotherm Yes, that's my concern that a real installation running an upgrade will fail because of a rogue setting name. Is there anything we can do about that? (and that the failure of the test didn't give me anything in the response to help me fix it - I had to find it for myself) |
|
It's the continuous integrations PR merge that is failing the Jenkins build - https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-11654/41/display/redirect |
|
@sekmiller this is the one to look at for this PR: https://jenkins.dataverse.org/job/IQSS-Dataverse-11639/ @donsizemore set it up special for @poikilotherm All tests are passing: https://jenkins.dataverse.org/job/IQSS-Dataverse-11639/30/testReport/ You can safely ignore https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-11654/41/display/redirect and https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-11654/ more generally, which will always fail. We should definitely keep an eye on https://jenkins.dataverse.org/job/IQSS-dataverse-develop/ after merging but it should "just work" (famous last words). |
…ter migrations #11654 Introduced a Flyway callback to clean up entries in the `setting` table with unknown keys post-migration. Updated `StartupFlywayMigrator` to register this callback.
|
@sekmiller I added a Java based Flyway Callback in 886a9cf This will take all the settings defined in the SettingsServiceBean.Key enum and check the settings in the database against it. Any invalid settings will be automatically purged from the database on every deployment. This means for the future that we can drop settings from the enum and they will be cleaned up. I went this way because you can't delete an invalid setting using the API... Let me know if you think this'll work. Good catch finding this edge case - didn't think about it upfront! |
|
FWIW: There are settings like Lines 38 to 39 in b78060a
|
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
For now, we added these settings to the enum. People should be safe. If we extend the mechanism to discoverable settings, we can extend the Java based Flyway Callback, too. (Make it more selective in cleaning up or make them all available during cleanup etc) |
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
|
Thanks y'all @sekmiller @donsizemore @pdurbin @ofahimIQSS for bearing with me and your thorough work on this one! Glad it got merged! 😎🤗🤓🍻 |
|
Unfortunately, the flyway script V6.8.0.1.sql from this PR failed on my personal instance. I had both |
|
@poikilotherm @sekmiller
|
…ration` Introduced comprehensive tests for `V6_8_0_1__SettingsDataMigration` using Testcontainers and DBUnit. Includes scenarios for migrating settings to new formats, handling null and invalid values, and verifying JSON transformations. This is a reproducer for an issue discovered after merging PR #11654 by @landreev. See also #11654 (comment)
|
@poikilotherm
|
… simplify access methods #11996 Replaced hard-coded workflow keys with structured enum-based keys in `TriggerType`. Updated `WorkflowServiceBean` and `SettingsServiceBean` to use consistent key resolution methods, improving readability and maintainability. Updated related database migration script to align with new key naming schema. This adds the missing keys after introduction of naming restrictions in #11654. The config keys for the default workflows will no longer be cleansed from the database during deployment.
What this PR does / why we need it:
Enable setting all the database settings in one go, using an atomic database operation.
Which issue(s) this PR closes:
Special notes for your reviewer:
Aside from the bulk operation itself, it required a lot more work to actually implement this properly. Unfortunately, this makes this PR a lot larger than anticipated, but hopefully it's worth it. (I suppose DB opts are not going to go away anytime soon...)
Settingclass was setup it impeded performance and did not enforce any constraints to avoid duplicated settings. (There was a Flyway script to take care of that, but it wasn't at all in the code, not even mentioned as comment.)Suggestions on how to test this:
Please note: the Jenkins build / test run will always fail until gdcc/dataverse-ansible#399 is merged! You'll need to execute the tests locally, e.g. using a containerized approach, which also helps with trying the apply-db-settings.sh script.@donsizemore hooked us up with a dedicated Jenkins job for this PR. Check the status of this job rather than the normal one: https://jenkins.dataverse.org/job/IQSS-Dataverse-11639/Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Nope
Is there a release notes update needed for this change?:
To Be DoneIncludedAdditional documentation:
Preview docs here: