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

Update `user_filters` table to have a unique index, and non-null columns #1172

Merged
merged 8 commits into from Oct 4, 2019

Conversation

@pik
Copy link
Contributor

pik commented Oct 14, 2016

Swaps the user_filter Table index to Unique, the current code does not use a single transaction or optimistic locking.

https://github.com/matrix-org/synapse/blob/master/synapse/storage/filtering.py#L43

Not sure on the procedure for PRing schema changes, so let me know if I'm missing something.

@matrixbot

This comment has been minimized.

Copy link
Member

matrixbot commented Oct 14, 2016

Can one of the admins verify this patch?

4 similar comments
@matrixbot

This comment has been minimized.

Copy link
Member

matrixbot commented Oct 14, 2016

Can one of the admins verify this patch?

@matrixbot

This comment has been minimized.

Copy link
Member

matrixbot commented Oct 14, 2016

Can one of the admins verify this patch?

@matrixbot

This comment has been minimized.

Copy link
Member

matrixbot commented Oct 14, 2016

Can one of the admins verify this patch?

@matrixbot

This comment has been minimized.

Copy link
Member

matrixbot commented Oct 14, 2016

Can one of the admins verify this patch?

@pik pik force-pushed the pik:unique-filter-user-index branch from f990e08 to c293aeb Oct 15, 2016
@erikjohnston

This comment has been minimized.

Copy link
Member

erikjohnston commented Oct 17, 2016

@pik The way the schema upgrade stuff works is that we create a new "version" after every release, so creating a new 37 is the correct thing to do here since 36 is the latest in the release. You will need to bump the SCHEMA_VERSION in synapse/storage/prepare_database.py when bumping the version.

@matrixbot ok to test

@erikjohnston

This comment has been minimized.

Copy link
Member

erikjohnston commented Dec 5, 2016

@matrixbot retest this please

@erikjohnston

This comment has been minimized.

Copy link
Member

erikjohnston commented Dec 5, 2016

Hmm, this might require some more thought given its going to break starting synapse if it has duplicate filter ids.

@pik

This comment has been minimized.

Copy link
Contributor Author

pik commented Dec 5, 2016

Yeah probably needs to come with a pre-migration 'clean-up-task'. I will update.

@pik

This comment has been minimized.

Copy link
Contributor Author

pik commented Dec 23, 2016

Ah, apologies, it seems what I am asking about already exists (still navigating my way around the code-base). Updated.

@pik pik force-pushed the pik:unique-filter-user-index branch 5 times, most recently from 4b8079b to 877f82b Dec 23, 2016
@pik pik changed the base branch from master to develop Dec 25, 2016
@pik pik force-pushed the pik:unique-filter-user-index branch from 877f82b to 1805e49 Dec 25, 2016
 * especially relevant since the current increment code is not atomic
@pik pik force-pushed the pik:unique-filter-user-index branch from 1805e49 to c1cfd6c Mar 16, 2017
@erikjohnston erikjohnston force-pushed the matrix-org:develop branch from 2af75da to 47574c9 Jul 4, 2017
@richvdh
richvdh approved these changes Oct 4, 2019
Copy link
Member

richvdh left a comment

I have no idea why this has been ignored for 3 years.

@richvdh richvdh added this to In progress in Homeserver Task Board via automation Oct 4, 2019
@richvdh richvdh moved this from In progress to Community PRs in Homeserver Task Board Oct 4, 2019
@richvdh richvdh self-assigned this Oct 4, 2019
@richvdh richvdh changed the title Change Index on user + filters to Unique Update `user_filters` table to have a unique index, and non-null columns Oct 4, 2019
@richvdh richvdh merged commit 13c4345 into matrix-org:develop Oct 4, 2019
18 checks passed
18 checks passed
buildkite/synapse Build #4786 passed (19 minutes, 43 seconds)
Details
buildkite/synapse/check-sample-config Passed (1 minute, 33 seconds)
Details
buildkite/synapse/check-style Passed (1 minute, 35 seconds)
Details
buildkite/synapse/isort Passed (17 seconds)
Details
buildkite/synapse/mypy Passed (47 seconds)
Details
buildkite/synapse/newspaper-newsfile Passed (16 seconds)
Details
buildkite/synapse/packaging Passed (19 seconds)
Details
buildkite/synapse/pipeline Passed (3 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-postgres-9-dot-5 Passed (16 minutes, 32 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-sqlite Passed (5 minutes, 55 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-sqlite-slash-old-deps Passed (8 minutes, 10 seconds)
Details
buildkite/synapse/python-3-dot-6-slash-sqlite Passed (5 minutes, 38 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-11 Passed (18 minutes, 1 second)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-9-dot-5 Passed (17 minutes, 5 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-sqlite Passed (5 minutes, 39 seconds)
Details
buildkite/synapse/sytest-python-3-dot-5-slash-postgres-9-dot-6-slash-monolith Passed (11 minutes, 46 seconds)
Details
buildkite/synapse/sytest-python-3-dot-5-slash-postgres-9-dot-6-slash-workers Passed (11 minutes, 29 seconds)
Details
buildkite/synapse/sytest-python-3-dot-5-slash-sqlite-slash-monolith Passed (10 minutes, 16 seconds)
Details
Homeserver Task Board automation moved this from Community PRs to Done Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4 participants
You can’t perform that action at this time.