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

Add SYNCV3_MAX_DB_CONN: use it in e2e tests #201

Merged
merged 6 commits into from
Jul 12, 2023
Merged

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Jul 12, 2023

This is designed to catch a class of SQL transaction bugs where we BEGIN a transaction and then forget to use that txn var, and do other things on sql.DB which will use a different connection.

By testing with max conns = 1 this will deadlock. We also test with max conns = 2 to try to catch more pernicious failure modes. Using max conns = 1 effectively serialises access to the database, but some bugs may only be apparent when there is some limited amount of concurrency available e.g mid-processing this event, do X. With max conns = 1 we cannot test this, which is why we also test with max conns = 2.

This is designed to catch a class of SQL transaction bugs where
we BEGIN a transaction and then forget to use that `txn` var, and
do other things on `sql.DB` which will use a different connection.

By testing with max conns = 1 this will deadlock. We also test with
max conns = 2 to try to catch more pernicious failure modes. Using
max conns = 1 effectively serialises access to the database, but
some bugs may only be apparent when there is some limited amount
of concurrency available e.g mid-processing this event, do X. With
max conns = 1 we cannot test this, which is why we also test with
max conns = 2.
@kegsay kegsay requested a review from DMRobertson July 12, 2023 16:15
Copy link
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

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

Seems sane. Looks like the tests didn't start because Synapse was being silly---might need to kick them to rerun.

@kegsay kegsay merged commit a9ec4fe into main Jul 12, 2023
6 checks passed
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