synapse-product/synapse/storage
Andrew Morgan 5d92a1428c
Prevent join->join membership transitions changing member count (#7977)
`StatsHandler` handles updates to the `current_state_delta_stream`, and updates room stats such as the amount of state events, joined users, etc.

However, it counts every new join membership as a new user entering a room (and that user being in another room), whereas it's possible for a user's membership status to go from join -> join, for instance when they change their per-room profile information.

This PR adds a check for join->join membership transitions, and bails out early, as none of the further checks are necessary at that point.

Due to this bug, membership stats in many rooms have ended up being wildly larger than their true values. I am not sure if we also want to include a migration step which recalculates these statistics (possibly using the `_populate_stats_process_rooms` bg update).

Bug introduced in the initial implementation https://github.com/matrix-org/synapse/pull/4338.
2020-08-03 21:54:24 +01:00
..
data_stores Prevent join->join membership transitions changing member count (#7977) 2020-08-03 21:54:24 +01:00
engines Use SequenceGenerator for state group ID allocation 2020-07-16 11:25:08 +01:00
schema Only run one background update at a time 2020-03-31 17:43:58 +01:00
util Use PostgresSequenceGenerator from MultiWriterIdGenerator 2020-07-16 11:25:08 +01:00
__init__.py Move are_all_users_on_domain checks to main data store. 2019-12-06 13:43:40 +00:00
_base.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
background_updates.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
database.py Move some log lines from default logger to sql/transaction loggers (#7952) 2020-07-28 18:52:13 +01:00
keys.py Move storage classes into a main "data store". 2019-10-21 16:05:06 +01:00
persist_events.py Convert storage layer to async/await. (#7963) 2020-07-28 16:09:53 -04:00
prepare_database.py Don't update the schema version 2020-06-12 15:03:26 +01:00
presence.py Move storage classes into a main "data store". 2019-10-21 16:05:06 +01:00
purge_events.py Convert storage layer to async/await. (#7963) 2020-07-28 16:09:53 -04:00
push_rule.py Move storage classes into a main "data store". 2019-10-21 16:05:06 +01:00
relations.py Move storage classes into a main "data store". 2019-10-21 16:05:06 +01:00
roommember.py Move storage classes into a main "data store". 2019-10-21 16:05:06 +01:00
state.py Convert some of the data store to async. (#7976) 2020-07-30 07:20:41 -04:00
types.py isort 5 compatibility (#7786) 2020-07-05 16:32:02 +01:00