-
Notifications
You must be signed in to change notification settings - Fork 39
Add migrator service #897
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
Add migrator service #897
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
295de6b to
0c0c7f7
Compare
3419fb0 to
bd47f2c
Compare
f2f0375 to
3d4c084
Compare
a1d2a96 to
1ed12b2
Compare
### Add comprehensive test coverage for migrator service functionality including `Migrator`, `Transformer`, and reader components - Adds comprehensive test files [migrator_test.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-e7344016aadd58a42e5066743aaa1f3c963766d2838ef917dbbd852d1a8f50b1) and [transformer_test.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-4d2f9cd6dca8594127cb38e1818e608c4fcfd4fc803ffa4402afb6a6922bc29a) with full coverage for migration processing, record transformation, and envelope generation - Makes internal structs `dbMigrator` and `transformer` public as `Migrator` and `Transformer` in [migrator.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-ccb0d31b1e7491838a2e4c7f2f6523eed971d6f18d4c04f006e14e2767671693) and [transformer.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-c76d70079716ba42e22c5b5031c1960504cccbca874aadb118385ca67341cf62) - Changes transaction isolation level from `sql.LevelRepeatableRead` to `sql.LevelReadCommitted` in [writer.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-79de0174d18bbb97eb4c62be1eeec1e2132ff3060f5beafb3b8721044791b258) - Updates originator ID constants to public visibility in [types.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-9f0a533504d524cea30380cd792a79e21a2c6a46594c9be99de7399fd288d1ba) - Removes `address_log` entry from migration tracker initialization in [00013_add-migration-tracker.up.sql](https://github.com/xmtp/xmtpd/pull/936/files#diff-72c04e16b6d52ace37aacc924f60a1f71e195a42c0cb88d4391c20434a01ded8) - Updates test database setup function to return connection string in [testdata/db.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-278351e442418d10eeff08343634456f23e59d16ac396e18147814d88b60c17f) #### 📍Where to Start Start with the `TestMigrator` function in [migrator_test.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-e7344016aadd58a42e5066743aaa1f3c963766d2838ef917dbbd852d1a8f50b1) to understand the main test flow and then examine the `Migrator` struct in [migrator.go](https://github.com/xmtp/xmtpd/pull/936/files#diff-ccb0d31b1e7491838a2e4c7f2f6523eed971d6f18d4c04f006e14e2767671693). ---- _[Macroscope](https://app.macroscope.com) summarized 5ef48b5._
e3426b3 to
29eb415
Compare
5e535ae to
5e37275
Compare
| err = db.RunInTx( | ||
| m.ctx, | ||
| m.writer, | ||
| nil, |
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.
mkysel
left a comment
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.
I dont expect our partners to run this. It might be cleaner to have a separate binary that is specific the migration.
Add migrator service to transfer MLS V1 data from source database to xmtpd database format with blockchain publishing support
Introduces a complete data migration service that reads data from a source database, transforms it into xmtpd envelope format, and writes it to either the destination database or blockchain. The implementation includes:
migration_trackertable and associated queries📍Where to Start
Start with the
NewMigrationServiceconstructor function in pkg/migrator/migrator.go to understand how the migration service is initialized, then review theStartmethod to see how the migration process begins.Macroscope summarized 5e37275.