-
Notifications
You must be signed in to change notification settings - Fork 175
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
fix(sync-service): Query Postgres server version at the start of connection setup #1784
Conversation
We were querying it after starting the replication client before, which was too late, because by that time the shape recovery process might have already reached Electric.Postgres.Configuration.configure_tables_for_replication!() where the version is used to branch the control flow. The choice of augmenting the LockConnection module with version querying and a crude state machine might seem dubious but the end result is simpler this way, compared to adding version querying to the replication client, for example.
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
442c827
to
f99ad93
Compare
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.
Nice one!
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.
Looks good! We might want to rename LockConnection
to something like PrepareDatabaseConnection
or something more generic like that, as it seems to be evolving to all steps required before any other interaction with the db
…ection setup (#1784) We were querying it after starting the replication client before, which was too late, because by that time the shape recovery process might have already reached `Electric.Postgres.Configuration.configure_tables_for_replication!()` where the version is used to branch the control flow. This was causing flake in integration tests due to the version not always being there and the unsupported query being issue against Postgres version 14. In short, this PR resolves the flakiness in integration tests, they should be consistently green from now on. The choice of augmenting the `LockConnection` module with version querying and a crude state machine might seem dubious but the end result is simpler this way, compared to adding version querying to the replication client, for example.
We were querying it after starting the replication client before, which was too late, because by that time the shape recovery process might have already reached
Electric.Postgres.Configuration.configure_tables_for_replication!()
where the version is used to branch the control flow. This was causing flake in integration tests due to the version not always being there and the unsupported query being issue against Postgres version 14.In short, this PR resolves the flakiness in integration tests, they should be consistently green from now on.
The choice of augmenting the
LockConnection
module with version querying and a crude state machine might seem dubious but the end result is simpler this way, compared to adding version querying to the replication client, for example.