element-hq / element-hq/synapse

Deleting a room can make the event stream ordering IDs go backwards

Open
#16,003 0 comments 0 reactions 0 assignees View on GitHub
T-Other
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#16003](https://github.com/matrix-org/synapse/issues/16003).

---

If you delete a room (presumably one whose events are the latest events in the stream), the event stream seems to go backwards, or at least various stream processors complain about that:

```
Event stream ordering appears to have gone backwards (33 -> 10): rewinding user directory processor
```

I do not know if this is a problem but it felt suspicious enough to warrant an issue.

Tested locally with Synapse v1.88 on SQLite3.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue on Synapse v1.88 with SQLite3: delete a room whose events are latest in the stream and observe the reported ordering change. Trace the event stream processors, including the user directory processor, and determine whether the ordering IDs should remain monotonic. Done means the behavior is understood and, if incorrect, covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.