matrix-org / matrix-org/matrix-spec

How to delete "state". (SPEC-8)

Open
#43 7 comments 0 reactions 0 assignees View on GitHub
A-S2S feature p4 room-vNext
Dominant language
HTML
Stars
330
Forks
150
Avg merge
2h 21m
Merged PRs (30d)
3

Description

#### Motivation

Currently, when a user leaves a room they keep an entry in the current state table which is never deleted. For large, old, busy rooms this could easily lead to the current state table being huge as it would contain an event for every use that has ever been in the room.

Since these entries are not used for anything, it would be much more convenient if the act of leaving simply involved removing the corresponding membership entry from the current state.
#### Problems

The main problem with removing entries from current state is making it work with the state conflict resolution algorithm. The algorithm **must** have these properties:

* Not depend on server state.
* Not depend on order events were received in.

Currently, the algorithm works by comparing the current state with the newly proposed state. If they are on separate branches of the tree then the two separate branches are compared.

However, if we have removed the entry from the current state we have nothing to compare any new state events with, and so it is treated as if it is completely new state. Thus by property 2, a deletion can only take effect if there are no other undeleted branches of the state tree, which doesn't really work very well.

(Imported from https://matrix.org/jira/browse/SPEC-8)

(Reported by @erikjohnston)

Contributor guide

Open the contributing guide

Research direction

The issue describes removing room-membership entries from current state and preserving state conflict resolution without server-state or event-order dependence. Start by studying the current-state and conflict-resolution algorithm in the Matrix specification; done means a decided protocol design that handles deletion against undeleted branches and avoids retaining obsolete membership entries.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.