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

This commit is contained in:
Andrew Morgan 2022-11-17 16:09:56 +00:00 committed by GitHub
parent 75888c2b1f
commit e7132c3f81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

1
changelog.d/14449.misc Normal file
View file

@ -0,0 +1 @@
Fix type logic in TCP replication code that prevented correctly ignoring blank commands.

View file

@ -245,7 +245,7 @@ class BaseReplicationStreamProtocol(LineOnlyReceiver):
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

View file

@ -569,15 +569,15 @@ class DatabasePool:
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,