Skip to content
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

Migrate existing data to new schema on startup #98

Merged
merged 24 commits into from
May 12, 2023
Merged

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented May 3, 2023

Tested sucessfully against an isolated backup of the m.org proxy deployment. (Circa 5 minutes to run and commit.)

I would like to write a few test cases (see #89 (comment)) before closing #89 and #51.

sync2/migration.go Outdated Show resolved Hide resolved
sync2/migration.go Outdated Show resolved Hide resolved
sync2/migration.go Show resolved Hide resolved

_, err = txn.Exec(`
ALTER TABLE syncv3_to_device_ack_pos
ALTER COLUMN user_id SET NOT NULL,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup for syncv3_to_device_ack_pos above ensures that this ALTER COLUMN succeeds.

@DMRobertson DMRobertson changed the title Migrate existing data to new schema Migrate existing data to new schema on startup May 10, 2023
@DMRobertson DMRobertson marked this pull request as ready for review May 10, 2023 11:13
(Though idk if we want to keep this around)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be useful to keep this around---this gives us a way to run the migration manually without having to startup the proxy proper.

@DMRobertson
Copy link
Contributor Author

I'm going to merge this as it is. I would like to spend a little more time seeing if there are any easy speedups, to minimise downtime. ATM the slowest parts are updating the to_device table. There are occasionally slow /whoami responses too.

@DMRobertson DMRobertson merged commit 18ed4c8 into dmr/oidc May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants