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

Commit c0379d6

Browse files
authored
Reduce log spam when running multiple event persisters (#12610)
1 parent 2d74a8c commit c0379d6

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

changelog.d/12610.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reduce log spam when running multiple event persisters.

synapse/replication/tcp/handler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def on_POSITION(self, conn: IReplicationConnection, cmd: PositionCommand) -> Non
537537
# Ignore POSITION that are just our own echoes
538538
return
539539

540-
logger.info("Handling '%s %s'", cmd.NAME, cmd.to_line())
540+
logger.debug("Handling '%s %s'", cmd.NAME, cmd.to_line())
541541

542542
self._add_command_to_stream_queue(conn, cmd)
543543

@@ -567,6 +567,11 @@ async def _process_position(
567567
# between then and now.
568568
missing_updates = cmd.prev_token != current_token
569569
while missing_updates:
570+
# Note: There may very well not be any new updates, but we check to
571+
# make sure. This can particularly happen for the event stream where
572+
# event persisters continuously send `POSITION`. See `resource.py`
573+
# for why this can happen.
574+
570575
logger.info(
571576
"Fetching replication rows for '%s' between %i and %i",
572577
stream_name,
@@ -590,7 +595,7 @@ async def _process_position(
590595
[stream.parse_row(row) for row in rows],
591596
)
592597

593-
logger.info("Caught up with stream '%s' to %i", stream_name, cmd.new_token)
598+
logger.info("Caught up with stream '%s' to %i", stream_name, cmd.new_token)
594599

595600
# We've now caught up to position sent to us, notify handler.
596601
await self._replication_data_handler.on_position(

synapse/replication/tcp/resource.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,15 @@ async def _run_notifier_loop(self) -> None:
204204
# turns out that e.g. account data streams share
205205
# their "current token" with each other, meaning
206206
# that it is *not* safe to send a POSITION.
207+
208+
# Note: `last_token` may not *actually* be the
209+
# last token we sent out in a RDATA or POSITION.
210+
# This can happen if we sent out an RDATA for
211+
# position X when our current token was say X+1.
212+
# Other workers will see RDATA for X and then a
213+
# POSITION with last token of X+1, which will
214+
# cause them to check if there were any missing
215+
# updates between X and X+1.
207216
logger.info(
208217
"Sending position: %s -> %s",
209218
stream.NAME,

0 commit comments

Comments
 (0)