Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 57b0045

Browse files
committed
Merge pull request #5857 from matrix-org/uhoreg/fix_e2e_room_keys_index
2 parents cdf7508 + 8a5f6ed commit 57b0045

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

changelog.d/5857.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix database index so that different backup versions can have the same sessions.

synapse/storage/e2e_room_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ def set_e2e_room_key(self, user_id, version, room_id, session_id, room_key):
8282
table="e2e_room_keys",
8383
keyvalues={
8484
"user_id": user_id,
85+
"version": version,
8586
"room_id": room_id,
8687
"session_id": session_id,
8788
},
8889
values={
89-
"version": version,
9090
"first_message_index": room_key["first_message_index"],
9191
"forwarded_count": room_key["forwarded_count"],
9292
"is_verified": room_key["is_verified"],
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Copyright 2019 Matrix.org Foundation CIC
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
-- version is supposed to be part of the room keys index
17+
CREATE UNIQUE INDEX e2e_room_keys_with_version_idx ON e2e_room_keys(user_id, version, room_id, session_id);
18+
DROP INDEX IF EXISTS e2e_room_keys_idx;

0 commit comments

Comments
 (0)