-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
daa49fa
to
956263c
Compare
which, for linking, was #7673. |
62e529d
to
c1b148c
Compare
7ee5086
to
4ca08f2
Compare
Also run the linters
4ca08f2
to
00fd951
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.
shaping up, thanks.
Remember that the new table will need clearing out whenever events are purged.
synapse/storage/data_stores/main/schema/delta/58/09unread_messages.sql
Outdated
Show resolved
Hide resolved
synapse/storage/data_stores/main/schema/delta/58/09unread_messages.sql
Outdated
Show resolved
Hide resolved
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.
actually:
I'm generally concerned about the size of the new data, and the fact that we can never clear it out.
What if we instead added a new column to the events
table which indicated if it should count towards unread count. Then calculating unread count for a given user is simply SELECT count(*) from events where room_id = ? and stream_ordering > ? and sender != ? and count_as_unread
.
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, but one remaining problem.
According to https://www.postgresql.org/docs/10/sql-altertable.html:
Adding a column with a DEFAULT clause or changing the type of an existing column will require the entire table and its indexes to be rewritten.
Postgres has improved this in v11, but we're still on v10 on matrix.org, and we do not want to be rewriting the events table. In any case, we need to consider other HS owners. We claim to support postgres 9.5 or later.
In short, we'll need to make the new column nullable and remove the default - and then behave sensibly when we get a NULL value back.
Unusually, sqlite is better in this area :)
Oooh good call, I didn't think of that, thanks! Looks like both PostgreSQL and SQLite consider |
So we don't end up rewriting the whole events table when running postgres < 11.
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.
lgtm!
…bership_join_count * 'develop' of github.com:matrix-org/synapse: Update workers docs (#7990) Fix invite rejection when we have no forward-extremeties (#7980) Fix typo in docs/workers.md (#7992) Convert federation client to async/await. (#7975) Convert appservice to async. (#7973) Convert some of the data store to async. (#7976) Fix formatting of changelog and upgrade notes Ensure that remove_pusher is always async (#7981) Add deprecation warnings 1.18.0 Update worker docs with recent enhancements (#7969) Ensure the msg property of HttpResponseException is a string. (#7979) Remove from the event_relations table when purging historical events. (#7978) Add additional logging for SAML sessions. (#7971) Add MSC reference to changelog for #7736 Re-implement unread counts (#7736) Various improvements to the docs (#7899)
This reverts commit f23c773.
This reverts commit 8dff4a1.
The test that's being added here is the exact same one as the one introduced in #7736
* commit '3950ae51e': Ensure that remove_pusher is always async (#7981) Ensure the msg property of HttpResponseException is a string. (#7979) Remove from the event_relations table when purging historical events. (#7978) Add additional logging for SAML sessions. (#7971) Add MSC reference to changelog for #7736 Re-implement unread counts (#7736) Various improvements to the docs (#7899) Convert storage layer to async/await. (#7963) Add an option to disable purge in delete room admin API (#7964) Move some log lines from default logger to sql/transaction loggers (#7952) Use the JSON module from the std library instead of simplejson. (#7936) Fix exit code for `check_line_terminators.sh` (#7970) Option to allow server admins to join complex rooms (#7902) Fix typo in metrics docs (#7966) Add script for finding files with unix line terminators (#7965) Convert the remaining media repo code to async / await. (#7947) Convert a synapse.events to async/await. (#7949) Convert groups and visibility code to async / await. (#7951) Convert push to async/await. (#7948)
Second attempt at implementing unread counts, this time without relying on push rules.
This is also backing out the MSC2625 implementation, which we likely won't end up usingreverting the MSC2625 implem has been moved to #7761.Best reviewed commit by commit.Fixes #7741