synapse-product/synapse/storage/data_stores/main
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
..
schema Prevent join->join membership transitions changing member count (#7977) 2020-08-03 21:54:24 +01:00
__init__.py Stop using 'device_max_stream_id' (#7882) 2020-07-17 17:03:27 +01:00
account_data.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
appservice.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
cache.py Re-implement unread counts (#7736) 2020-07-29 18:26:55 +01:00
censor_events.py
client_ips.py Replace iteritems/itervalues/iterkeys with native versions. (#7692) 2020-06-15 07:03:36 -04:00
deviceinbox.py Stop using 'device_max_stream_id' (#7882) 2020-07-17 17:03:27 +01:00
devices.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
directory.py
e2e_room_keys.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
end_to_end_keys.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
event_federation.py Replace all remaining six usage with native Python 3 equivalents (#7704) 2020-06-16 08:51:47 -04:00
event_push_actions.py Convert some of the data store to async. (#7976) 2020-07-30 07:20:41 -04:00
events_bg_updates.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
events_worker.py Re-implement unread counts (#7736) 2020-07-29 18:26:55 +01:00
events.py Re-implement unread counts (#7736) 2020-07-29 18:26:55 +01:00
filtering.py
group_server.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
keys.py
media_repository.py Allow local media to be marked as safe from being quarantined. (#7718) 2020-06-22 08:04:14 -04:00
metrics.py
monthly_active_users.py
openid.py
presence.py Refactor getting replication updates from database. (#7636) 2020-06-16 17:10:28 +01:00
profile.py
purge_events.py Remove from the event_relations table when purging historical events. (#7978) 2020-07-29 13:55:01 -04:00
push_rule.py Convert state resolution to async/await (#7942) 2020-07-24 10:59:51 -04:00
pusher.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
receipts.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
registration.py Use a postgres sequence to generate guest user IDs 2020-07-16 13:00:25 +01:00
rejections.py
relations.py
room.py Convert some of the data store to async. (#7976) 2020-07-30 07:20:41 -04:00
roommember.py Convert state resolution to async/await (#7942) 2020-07-24 10:59:51 -04:00
search.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
signatures.py
state_deltas.py
state.py Convert some of the data store to async. (#7976) 2020-07-30 07:20:41 -04:00
stats.py Prevent join->join membership transitions changing member count (#7977) 2020-08-03 21:54:24 +01:00
stream.py Update worker docs with recent enhancements (#7969) 2020-07-29 23:22:13 +01:00
tags.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
transactions.py
ui_auth.py Consistently use db_to_json to convert from database values to JSON objects. (#7849) 2020-07-16 11:32:19 -04:00
user_directory.py Convert state resolution to async/await (#7942) 2020-07-24 10:59:51 -04:00
user_erasure_store.py Follow-up to admin API to re-activate accounts (#7908) 2020-07-22 12:33:19 -04:00