diff options
author | MadLittleMods <MadLittleMods@users.noreply.github.com> | 2022-09-02 19:06:22 +0000 |
---|---|---|
committer | MadLittleMods <MadLittleMods@users.noreply.github.com> | 2022-09-02 19:06:22 +0000 |
commit | cb59d5b4d23a3e112099b7d07e24fe53aac199b3 (patch) | |
tree | 23c214fda2bc670644af1f0b3545ae68b9207fcb /develop/development | |
parent | deploy: 36b184b78257fa4455293b7d7faa7a53a4261383 (diff) | |
download | synapse-cb59d5b4d23a3e112099b7d07e24fe53aac199b3.tar.xz |
deploy: 877bdfa889fa07d09f385df297a9282d51d50dae
Diffstat (limited to 'develop/development')
-rw-r--r-- | develop/development/database_schema.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/develop/development/database_schema.html b/develop/development/database_schema.html index 8bbd1c46da..901808363e 100644 --- a/develop/development/database_schema.html +++ b/develop/development/database_schema.html @@ -308,6 +308,22 @@ default value is the <strong>string</strong> <code>"FALSE"</code> - wh in Python, evaluates to <code>True</code>.</p> </li> </ul> +<h2 id="event_id-global-uniqueness"><a class="header" href="#event_id-global-uniqueness"><code>event_id</code> global uniqueness</a></h2> +<p>In room versions <code>1</code> and <code>2</code> it's possible to end up with two events with the +same <code>event_id</code> (in the same or different rooms). After room version <code>3</code>, that +can only happen with a hash collision, which we basically hope will never +happen.</p> +<p>There are several places in Synapse and even Matrix APIs like <a href="https://spec.matrix.org/v1.1/server-server-api/#get_matrixfederationv1eventeventid"><code>GET /_matrix/federation/v1/event/{eventId}</code></a> +where we assume that event IDs are globally unique.</p> +<p>But hash collisions are still possible, and by treating event IDs as room +scoped, we can reduce the possibility of a hash collision. When scoping +<code>event_id</code> in the database schema, it should be also accompanied by <code>room_id</code> +(<code>PRIMARY KEY (room_id, event_id)</code>) and lookups should be done through the pair +<code>(room_id, event_id)</code>.</p> +<p>There has been a lot of debate on this in places like +https://github.com/matrix-org/matrix-spec-proposals/issues/2779 and +<a href="https://github.com/matrix-org/matrix-spec-proposals/pull/2848">MSC2848</a> which +has no resolution yet (as of 2022-09-01).</p> </main> |