Open DMRobertson opened 1 year ago
this (user, device) pair already exists in the DB.
Although you'd expect that to be ensured by https://github.com/matrix-org/synapse/blob/69048f7b4848ab6a4ae6cb233f8cbf36d73c0ba1/synapse/storage/databases/main/devices.py#L1907-L1909 if we're using REPEATABLE READ isolation
I also spotted SerializationFailure
s for this table:
This is probably happening when we call that function twice at the same time, while having no existing entries in the DB. That way the DELETE
is a no-op that doesn't lock any rows, so both transactions try to insert
e.g.
From looking at the source, the only insert that isn't an upsert I can see is
https://github.com/matrix-org/synapse/blob/69048f7b4848ab6a4ae6cb233f8cbf36d73c0ba1/synapse/storage/databases/main/devices.py#L1911-L1919
which might emit this error if
Tracebacks in Sentry seems to corroborate my suspicions --- they have the quoted function in their stack.