element-hq / element-hq/matrix-authentication-service
syn2mas: reconstruction of indices and constraints is not atomic
Open
A-Migration
- Dominant language
- Rust
- Stars
- 280
- Forks
- 111
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 25
Description
If syn2mas is interrupted whilst rebuilding indices and constraints, you end up with some of them left on the database.
When you next run syn2mas, it truncates all the tables but does not remove those indices/constraints.
I also suspect if you left it run through to the end at that point, that it will try to double-create them.
Solution suggestion:
- when recreating an index, delete the row from the restore table (in the same transaction!)
- when restarting a migration, it should drop indices again and append the definitions to the restore table, so that it works as it did before.
Contributor guide
Assessment
This issue has not been assessed yet.