synapse/changelog.d
Erik Johnston 81e0f57800
Fix perf when streams don't change often (#17767)
There is a bug with the `StreamChangeCache` where it would incorrectly
return that all entities had changed if asked for entities changed
*since* the earliest stream position.

Note that for streams we use the inequalities: `$min_stream_id <
stream_id <= $max_stream_id`, i.e. when we ask the stream change cache
for all things that have changed since `$stream_id` we don't care for
events that happened *at* `$stream_id`.

Specifically: `_earliest_known_stream_pos` is the position at which we
know that we'll have entries for all changes since that point, we can
use the cache for any stream IDs that equal
`_earliest_known_stream_pos`.

`_earliest_known_stream_pos` is set in three places:
- On startup we set it either to:
  - the current maximum stream ID, with not prefilled values; or
  - the minimum of the latest N values we pulled from the DB
- When we evict items from the bottom, we set it to the stream ID of the
evicted items.

This was changed in https://github.com/matrix-org/synapse/pull/14435,
but I think we were overly conservative there.

---------

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2024-09-30 13:52:33 +01:00
..
.gitignore Correct attrs package name in requirements (#3492) 2018-07-07 10:46:59 +10:00
17749.doc Remove spurious TODO in debian install step (#17749) 2024-09-26 13:18:28 +01:00
17751.misc Minor perf speed up for large accounts on SSS (#17751) 2024-09-30 12:58:02 +01:00
17765.misc Optimise notifier (#17765) 2024-09-30 12:58:13 +01:00
17766.misc Optimise notifier mk2 (#17766) 2024-09-30 13:32:31 +01:00
17767.misc Fix perf when streams don't change often (#17767) 2024-09-30 13:52:33 +01:00
17768.misc Add fast path for sliding sync streams that only ask for extensions (#17768) 2024-09-30 12:59:50 +01:00
17771.misc Reduce overhead of sliding sync E2EE loops (#17771) 2024-09-30 13:00:14 +01:00