0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-13 08:08:57 +02:00
synapse/synapse
Eric Eastwood b93bd95e8a
When loading current ids, sort by stream_id to avoid incorrect overwrite and avoid errors caused by sorting alphabetical instance name which can be null (#13585)
When loading current ids, sort by stream ID so that we don't want to overwrite the `current_position` of an instance to a lower stream ID than we're actually at ([discussion](https://github.com/matrix-org/synapse/pull/13585#discussion_r951795379)). Previously, it sorted alphabetically by instance name which can be `null` and throw errors but more importantly, accomplishes nothing.

Fixes the following startup error which is why I started looking into this area:

```
$ poetry run synapse_homeserver --config-path homeserver.yaml
****************************************************************
 Error during initialisation:
    '<' not supported between instances of 'NoneType' and 'str'
 There may be more information in the logs.
****************************************************************
```

Somehow my database ended up looking like the following, notice the `instance_name` is `null` in the db, and we can't sort `NoneType` things. Another question is why do we see the `instance_name` as `null` sometimes instead of `master` in monolith mode?
```
$ psql synapse
synapse=# SELECT * FROM stream_positions;
   stream_name   | instance_name | stream_id
-----------------+---------------+-----------
 account_data    | master        |      1242
 events          | master        |      1787
 to_device       | master        |        58
 presence_stream | master        |    485638
 receipts        | master        |       341
 backfill        | master        |   -139106
(6 rows)
synapse=# SELECT instance_name, stream_id FROM receipts_linearized;
 instance_name | stream_id
---------------+-----------
               |       211
               |         3
               |         4
               |       212
               |       213
               |       224
               |       228
               |       164
               |       313
               |       253
               |        38
               |       321
               |       324
               |       189
               |       192
               |       193
               |       194
               |       195
               |       197
               |       198
               |       275
               |        79
               |       339
               |       340
               |        82
               |       341
               |        84
               |        85
               |        91
               |       119
```
2022-08-24 12:53:46 -05:00
..
_scripts Merge branch 'master' into develop 2022-07-19 16:14:02 +02:00
api synapse.api.auth.Auth cleanup: make permission-related methods use Requester instead of the UserID (#13024) 2022-08-22 14:17:59 +01:00
app Add experimental configuration option to allow disabling legacy Prometheus metric names. (#13540) 2022-08-24 11:35:54 +00:00
appservice Add prometheus counters for content types other than events (#13175) 2022-07-13 15:18:20 +01:00
config Add experimental configuration option to allow disabling legacy Prometheus metric names. (#13540) 2022-08-24 11:35:54 +00:00
crypto Instrument _check_sigs_and_hash_and_fetch to trace time spent in child concurrent calls (#13588) 2022-08-23 21:53:37 -05:00
events Instrument _check_sigs_and_hash_and_fetch to trace time spent in child concurrent calls (#13588) 2022-08-23 21:53:37 -05:00
federation Faster Room Joins: fix /make_knock blocking indefinitely when the room in question is a partial-stated room. (#13583) 2022-08-24 09:09:59 +00:00
handlers Use dedicated get_local_users_in_room to find local users when calculating join_authorised_via_users_server of a /make_join request (#13606) 2022-08-24 11:14:28 -05:00
http synapse.api.auth.Auth cleanup: make permission-related methods use Requester instead of the UserID (#13024) 2022-08-22 14:17:59 +01:00
logging Instrument the federation/backfill part of /messages (#13489) 2022-08-16 12:39:40 -05:00
metrics Add experimental configuration option to allow disabling legacy Prometheus metric names. (#13540) 2022-08-24 11:35:54 +00:00
module_api Update module API "update room membership" method to allow for remote joins (#13441) 2022-08-05 09:37:58 +00:00
push Fix breaking event sending due to bad push rule (#13547) 2022-08-17 11:02:38 +00:00
replication Speed up fetching large numbers of push rules (#13592) 2022-08-23 13:15:43 +01:00
res Add viewport directive to HTML templates to optimise for mobile (#13493) 2022-08-11 14:04:20 +01:00
rest Drop support for delegating email validation, round 2 (#13596) 2022-08-23 11:40:00 +00:00
server_notices synapse.api.auth.Auth cleanup: make permission-related methods use Requester instead of the UserID (#13024) 2022-08-22 14:17:59 +01:00
spam_checker_api Fix import in module_api module and docs on the new check_event_for_spam signature (#12918) 2022-05-31 12:04:53 +02:00
state Cache user IDs instead of profile objects (#13573) 2022-08-23 09:49:59 +00:00
static Add viewport directive to HTML templates to optimise for mobile (#13493) 2022-08-11 14:04:20 +01:00
storage When loading current ids, sort by stream_id to avoid incorrect overwrite and avoid errors caused by sorting alphabetical instance name which can be null (#13585) 2022-08-24 12:53:46 -05:00
streams Instrument /messages for understandable traces in Jaeger (#13368) 2022-08-03 10:57:38 -05:00
util Add experimental configuration option to allow disabling legacy Prometheus metric names. (#13540) 2022-08-24 11:35:54 +00:00
__init__.py Fix Synapse git info missing in version strings (#12973) 2022-06-07 15:24:11 +01:00
event_auth.py Implement MSC3848: Introduce errcodes for specific event sending failures (#13343) 2022-07-27 13:44:40 +01:00
notifier.py Notifier: accept callbacks to fire on room joins (#13254) 2022-07-13 19:48:24 +01:00
py.typed Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) 2021-10-13 08:42:41 +01:00
server.py Move the "email unsubscribe" resource, refactor the macaroon generator & simplify the access token verification logic. (#12986) 2022-06-14 09:12:08 -04:00
types.py Fix destination_is errors seen in sentry. (#13041) 2022-06-14 18:28:26 +01:00
visibility.py Add some miscellaneous comments around sync (#13474) 2022-08-10 12:58:20 +01:00