From 160bce9aff9ba33615bba93d73655ca6afdef3d2 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 1 May 2020 09:25:16 +0100 Subject: [PATCH] Workaround for assertion errors from db_query_to_update_function (#7378) Hopefully this is no worse than what we have on master... --- changelog.d/7378.misc | 1 + synapse/replication/tcp/streams/_base.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 changelog.d/7378.misc diff --git a/changelog.d/7378.misc b/changelog.d/7378.misc new file mode 100644 index 000000000000..676f285377f5 --- /dev/null +++ b/changelog.d/7378.misc @@ -0,0 +1 @@ +Move catchup of replication streams logic to worker. diff --git a/synapse/replication/tcp/streams/_base.py b/synapse/replication/tcp/streams/_base.py index 4ae3cffb1e14..4af1afd119ca 100644 --- a/synapse/replication/tcp/streams/_base.py +++ b/synapse/replication/tcp/streams/_base.py @@ -176,10 +176,9 @@ async def update_function(from_token, upto_token, limit): rows = await query_function(from_token, upto_token, limit) updates = [(row[0], row[1:]) for row in rows] limited = False - if len(updates) == limit: + if len(updates) >= limit: upto_token = updates[-1][0] limited = True - assert len(updates) <= limit return updates, upto_token, limited