-
Notifications
You must be signed in to change notification settings - Fork 8
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
Updating a secret with --asm
will return an error, but appears to work
#2084
Comments
Putting this back into the |
Looks like |
If setting the secret appears to work despite the error, then I'm guessing that postgres reports an error when the uniqueness constraint is violated, but it doesn't actually kill or revert the operation. So if the postgresql engine executes lookups by scanning starting from the most recent rows instead of scanning from the oldest, then it would pick up the most recently set value. |
Notes on the ASM issue: The premise behind That said:
|
Another thought - if we've been inserting duplicate key pairs into the |
… on conflict (#2105) Addresses part of #2084 Postgresql way to handle upserts: https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-upsert/ This PR fixes the issue for secrets since that's causing issues for the client team, but not for config, which has the same issue. I confirmed the test fails before this change but passes with it.
…erting on conflict (#2107) Fixes #2084 This PR addresses the config side, whereas #2105 fixed it for secrets. I confirmed the test fails before this change but passes with it: ``` $ go test ./common/configuration/dal/... -run TestModuleConfiguration debug:migrate: Applying: 20231103205514_init.sql debug:migrate: Applied: 20231103205514_init.sql in 134.088875ms debug:migrate: Applying: 20240704103403_create_module_secrets.sql debug:migrate: Applied: 20240704103403_create_module_secrets.sql in 5.793958ms --- FAIL: TestModuleConfiguration (0.30s) --- FAIL: TestModuleConfiguration/HandlesConflicts (0.00s) dal_test.go:108: Did not expect an error but got: duplicate key value violates unique constraint "module_configuration_module_name_key": conflict FAIL FAIL github.com/TBD54566975/ftl/common/configuration/dal 0.760s FAIL $ go test ./common/configuration/dal/... -run TestModuleConfiguration ok github.com/TBD54566975/ftl/common/configuration/dal 0.775s ```
When attempting to update an ASM secret, we get the following errors.
Likely coming from here when a secret already exists:
https://github.com/TBD54566975/ftl/blob/main/common/configuration/asm_leader.go#L139-L164
The text was updated successfully, but these errors were encountered: