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

Commit 50776af

Browse files
committed
MORE HACKS
1 parent 91faaf6 commit 50776af

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

synapse/replication/tcp/streams/partial_state.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ def __init__(self, hs: "HomeServer"):
7171
super().__init__(
7272
hs.get_instance_name(),
7373
# TODO(faster_joins, multiple writers): we need to account for instance names
74-
current_token_without_instance(store.get_un_partial_stated_events_token),
74+
store.get_un_partial_stated_events_token,
7575
store.get_un_partial_stated_events_from_stream,
7676
)

synapse/storage/databases/main/events_worker.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,12 @@ def get_chain_id_txn(txn: Cursor) -> int:
314314
db_conn, "un_partial_stated_event_stream", "stream_id"
315315
)
316316

317-
def get_un_partial_stated_events_token(self) -> int:
318-
# TODO(faster_joins, multiple writers): This is inappropriate if there are multiple
319-
# writers because workers that don't write often will hold all
320-
# readers up.
321-
return self._un_partial_stated_events_stream_id_gen.get_current_token()
317+
def get_un_partial_stated_events_token(self, instance_name: str) -> int:
318+
return (
319+
self._un_partial_stated_events_stream_id_gen.get_current_token_for_writer(
320+
instance_name
321+
)
322+
)
322323

323324
async def get_un_partial_stated_events_from_stream(
324325
self, instance_name: str, last_id: int, current_id: int, limit: int
@@ -408,6 +409,11 @@ def process_replication_position(
408409
self._stream_id_gen.advance(instance_name, token)
409410
elif stream_name == BackfillStream.NAME:
410411
self._backfill_id_gen.advance(instance_name, -token)
412+
elif stream_name == UnPartialStatedEventStream.NAME:
413+
logger.info(
414+
"Advancing %s token to %s", UnPartialStatedEventStream.NAME, token
415+
)
416+
self._un_partial_stated_events_stream_id_gen.advance(instance_name, token)
411417
super().process_replication_position(stream_name, instance_name, token)
412418

413419
async def have_censored_event(self, event_id: str) -> bool:

0 commit comments

Comments
 (0)