Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

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 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
Copy link
Member

Can one of the admins verify this patch?

4 similar comments
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@pik pik force-pushed the unique-filter-user-index branch from f990e08 to c293aeb Compare October 15, 2016 00:43
@erikjohnston
Copy link
Member

@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
Copy link
Member

@matrixbot retest this please

@erikjohnston
Copy link
Member

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

@pik
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
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 unique-filter-user-index branch 5 times, most recently from 4b8079b to 877f82b Compare December 24, 2016 02:14
@pik pik changed the base branch from master to develop December 25, 2016 20:50
@pik pik force-pushed the unique-filter-user-index branch from 877f82b to 1805e49 Compare December 25, 2016 20:51
 * especially relevant since the current increment code is not atomic
@pik pik force-pushed the unique-filter-user-index branch from 1805e49 to c1cfd6c Compare March 16, 2017 17:32
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

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

@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants