diff options
author | Erik Johnston <erik@matrix.org> | 2018-05-18 13:43:01 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-05-18 13:43:01 +0100 |
commit | b725e128f8b24420329d6774863b70feb7ff8411 (patch) | |
tree | 655677152302db60dc9b62e22591f9d30c027b99 | |
parent | More comments (diff) | |
download | synapse-b725e128f8b24420329d6774863b70feb7ff8411.tar.xz |
Comments
-rw-r--r-- | synapse/storage/chunk_ordered_table.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/synapse/storage/chunk_ordered_table.py b/synapse/storage/chunk_ordered_table.py index d9e331a75d..79d0ca44ec 100644 --- a/synapse/storage/chunk_ordered_table.py +++ b/synapse/storage/chunk_ordered_table.py @@ -33,20 +33,22 @@ class ChunkDBOrderedListStore(OrderedListStore): """Used as the list store for room chunks, efficiently maintaining them in topological order on updates. - A room chunk is a connected portion of the room events DAG. As such the set - of chunks in a room inherits a DAG, i.e. if an event in one chunk references - an event in a second chunk, then we say that the first chunk references the - second, and thus forming a DAG. - - Chunks are constructed so that they have the aditional property that for all - events in the chunk, either all of their prev_events are in that chunk or - none of them are. This ensures that no event that is subsequently received - needs to be inserted into the middle of a chunk, since it cannot both - reference an event in the chunk and be referenced by an event in the chunk - (assuming no cycles). - - Multiple chunks can therefore happen when the server misses some events, - e.g. due to the server being offline for a time. + A room chunk is a connected portion of the room events DAG. Chunks are + constructed so that they have the additional property that for all events in + the chunk, either all of their prev_events are in that chunk or none of them + are. This ensures that no event that is subsequently received needs to be + inserted into the middle of a chunk, since it cannot both reference an event + in the chunk and be referenced by an event in the chunk (assuming no + cycles). + + As such the set of chunks in a room inherits a DAG, i.e. if an event in one + chunk references an event in a second chunk, then we say that the first + chunk references the second, and thus forming a DAG. (This means that chunks + start off disconnected until an event is received that connects the two + chunks.) + + We can therefore end up with multiple chunks in a room when the server + misses some events, e.g. due to the server being offline for a time. The server may only have a subset of all events in a room, in which case its possible for the server to have chunks that are unconnected from each |