Prevent account_data content from being sent over TCP replication (#6333)

This commit is contained in:
Andrew Morgan 2019-11-26 13:58:39 +00:00 committed by GitHub
commit a8175d0f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

1
changelog.d/6333.bugfix Normal file
View File

@ -0,0 +1 @@
Prevent account data syncs getting lost across TCP replication.

View File

@ -88,8 +88,7 @@ TagAccountDataStreamRow = namedtuple(
"TagAccountDataStreamRow", ("user_id", "room_id", "data") # str # str # dict "TagAccountDataStreamRow", ("user_id", "room_id", "data") # str # str # dict
) )
AccountDataStreamRow = namedtuple( AccountDataStreamRow = namedtuple(
"AccountDataStream", "AccountDataStream", ("user_id", "room_id", "data_type") # str # str # str
("user_id", "room_id", "data_type", "data"), # str # str # str # dict
) )
GroupsStreamRow = namedtuple( GroupsStreamRow = namedtuple(
"GroupsStreamRow", "GroupsStreamRow",
@ -421,8 +420,8 @@ class AccountDataStream(Stream):
results = list(room_results) results = list(room_results)
results.extend( results.extend(
(stream_id, user_id, None, account_data_type, content) (stream_id, user_id, None, account_data_type)
for stream_id, user_id, account_data_type, content in global_results for stream_id, user_id, account_data_type in global_results
) )
return results return results

View File

@ -184,14 +184,14 @@ class AccountDataWorkerStore(SQLBaseStore):
current_id(int): The position to fetch up to. current_id(int): The position to fetch up to.
Returns: Returns:
A deferred pair of lists of tuples of stream_id int, user_id string, A deferred pair of lists of tuples of stream_id int, user_id string,
room_id string, type string, and content string. room_id string, and type string.
""" """
if last_room_id == current_id and last_global_id == current_id: if last_room_id == current_id and last_global_id == current_id:
return defer.succeed(([], [])) return defer.succeed(([], []))
def get_updated_account_data_txn(txn): def get_updated_account_data_txn(txn):
sql = ( sql = (
"SELECT stream_id, user_id, account_data_type, content" "SELECT stream_id, user_id, account_data_type"
" FROM account_data WHERE ? < stream_id AND stream_id <= ?" " FROM account_data WHERE ? < stream_id AND stream_id <= ?"
" ORDER BY stream_id ASC LIMIT ?" " ORDER BY stream_id ASC LIMIT ?"
) )
@ -199,7 +199,7 @@ class AccountDataWorkerStore(SQLBaseStore):
global_results = txn.fetchall() global_results = txn.fetchall()
sql = ( sql = (
"SELECT stream_id, user_id, room_id, account_data_type, content" "SELECT stream_id, user_id, room_id, account_data_type"
" FROM room_account_data WHERE ? < stream_id AND stream_id <= ?" " FROM room_account_data WHERE ? < stream_id AND stream_id <= ?"
" ORDER BY stream_id ASC LIMIT ?" " ORDER BY stream_id ASC LIMIT ?"
) )