mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 19:43:50 +01:00
Use READ COMMITTED isolation level when inserting read receipts (#12957)
This commit is contained in:
parent
dd2d66b0c9
commit
04ca3a52f6
2 changed files with 6 additions and 0 deletions
1
changelog.d/12957.misc
Normal file
1
changelog.d/12957.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Use lower isolation level when inserting read receipts to avoid serialization errors. Contributed by Nick @ Beeper.
|
|
@ -36,6 +36,7 @@ from synapse.storage.database import (
|
|||
LoggingTransaction,
|
||||
)
|
||||
from synapse.storage.engines import PostgresEngine
|
||||
from synapse.storage.engines._base import IsolationLevel
|
||||
from synapse.storage.util.id_generators import (
|
||||
AbstractStreamIdTracker,
|
||||
MultiWriterIdGenerator,
|
||||
|
@ -764,6 +765,10 @@ class ReceiptsWorkerStore(SQLBaseStore):
|
|||
linearized_event_id,
|
||||
data,
|
||||
stream_id=stream_id,
|
||||
# Read committed is actually beneficial here because we check for a receipt with
|
||||
# greater stream order, and checking the very latest data at select time is better
|
||||
# than the data at transaction start time.
|
||||
isolation_level=IsolationLevel.READ_COMMITTED,
|
||||
)
|
||||
|
||||
# If the receipt was older than the currently persisted one, nothing to do.
|
||||
|
|
Loading…
Reference in a new issue