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

Update all stream IDs after processing replication rows (#14723) #52

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

Fizzadar
Copy link
Member

@Fizzadar Fizzadar commented Jan 16, 2023

Cherry-picking matrix-org#14723 from upstream. matrix-org#14723.

This creates a new store method, process_replication_position that is called after process_replication_rows. By moving stream ID advances here this guarantees any relevant cache invalidations will have been applied before the stream is advanced.

This avoids race conditions where Python switches between threads mid way through processing the process_replication_rows method where stream IDs may be advanced before caches are invalidated due to class resolution ordering.

See this comment/issue for further discussion:
matrix-org#14158 (comment)

Conflicts:

synapse/storage/databases/main/devices.py

synapse/storage/databases/main/events_worker.py

…4723)

This creates a new store method, `process_replication_position` that
is called after `process_replication_rows`. By moving stream ID advances
here this guarantees any relevant cache invalidations will have been
applied before the stream is advanced.

This avoids race conditions where Python switches between threads mid
way through processing the `process_replication_rows` method where stream
IDs may be advanced before caches are invalidated due to class resolution
ordering.

See this comment/issue for further discussion:
	matrix-org#14158 (comment)
# Conflicts:
#	synapse/storage/databases/main/devices.py
#	synapse/storage/databases/main/events_worker.py
@Fizzadar Fizzadar merged commit c71199e into beeper Jan 17, 2023
@Fizzadar Fizzadar deleted the cherry-pick-stream-replication-position-after-rows branch January 17, 2023 11:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant