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

Fix check to ignore blank lines in incoming TCP replication #14449

Merged
merged 5 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14449.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix type logic in TCP replication code that prevented correctly ignoring blank commands.
2 changes: 1 addition & 1 deletion synapse/replication/tcp/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def lineReceived(self, line: bytes) -> None:
self._parse_and_dispatch_line(line)

def _parse_and_dispatch_line(self, line: bytes) -> None:
if line.strip() == "":
if line.strip() == b"":
# Ignore blank lines
return

Expand Down
6 changes: 3 additions & 3 deletions synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,15 @@ async def _check_safe_to_upsert(self) -> None:
retcols=["update_name"],
desc="check_background_updates",
)
updates = [x["update_name"] for x in updates]
background_update_names = [x["update_name"] for x in updates]

for table, update_name in UNIQUE_INDEX_BACKGROUND_UPDATES.items():
if update_name not in updates:
if update_name not in background_update_names:
logger.debug("Now safe to upsert in %s", table)
self._unsafe_to_upsert_tables.discard(table)

# If there's any updates still running, reschedule to run.
if updates:
if background_update_names:
self._clock.call_later(
15.0,
run_as_background_process,
Expand Down