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

Commit d6a6566

Browse files
committed
Prevent account_data content from being sent over TCP replication (#6333)
* commit 'a8175d0f9': lint Add changelog Remove content from being sent for account data rdata stream
2 parents ab68b70 + a8175d0 commit d6a6566

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

changelog.d/6333.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Prevent account data syncs getting lost across TCP replication.

synapse/replication/tcp/streams/_base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@
8888
"TagAccountDataStreamRow", ("user_id", "room_id", "data") # str # str # dict
8989
)
9090
AccountDataStreamRow = namedtuple(
91-
"AccountDataStream",
92-
("user_id", "room_id", "data_type", "data"), # str # str # str # dict
91+
"AccountDataStream", ("user_id", "room_id", "data_type") # str # str # str
9392
)
9493
GroupsStreamRow = namedtuple(
9594
"GroupsStreamRow",
@@ -421,8 +420,8 @@ def update_function(self, from_token, to_token, limit):
421420

422421
results = list(room_results)
423422
results.extend(
424-
(stream_id, user_id, None, account_data_type, content)
425-
for stream_id, user_id, account_data_type, content in global_results
423+
(stream_id, user_id, None, account_data_type)
424+
for stream_id, user_id, account_data_type in global_results
426425
)
427426

428427
return results

synapse/storage/data_stores/main/account_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,22 @@ def get_all_updated_account_data(
184184
current_id(int): The position to fetch up to.
185185
Returns:
186186
A deferred pair of lists of tuples of stream_id int, user_id string,
187-
room_id string, type string, and content string.
187+
room_id string, and type string.
188188
"""
189189
if last_room_id == current_id and last_global_id == current_id:
190190
return defer.succeed(([], []))
191191

192192
def get_updated_account_data_txn(txn):
193193
sql = (
194-
"SELECT stream_id, user_id, account_data_type, content"
194+
"SELECT stream_id, user_id, account_data_type"
195195
" FROM account_data WHERE ? < stream_id AND stream_id <= ?"
196196
" ORDER BY stream_id ASC LIMIT ?"
197197
)
198198
txn.execute(sql, (last_global_id, current_id, limit))
199199
global_results = txn.fetchall()
200200

201201
sql = (
202-
"SELECT stream_id, user_id, room_id, account_data_type, content"
202+
"SELECT stream_id, user_id, room_id, account_data_type"
203203
" FROM room_account_data WHERE ? < stream_id AND stream_id <= ?"
204204
" ORDER BY stream_id ASC LIMIT ?"
205205
)

0 commit comments

Comments
 (0)