You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new concurrency model has been introduced in the postgre implementation of the parsec v3 server.
More specifically, requests that depends on a topic (for performing checks) but that do not update said topic should lock it for reading by using a FOR SHARE select query on the topic timestamp. On the other hand, the requests that plan to update a given topic should lock it using a FOR UPDATE select query on the topic timestamp.
This way, many read requests can run concurrently for a given topic but write requests have to run sequentially while no read request is performed.
This mechanism is already implemented here for the common topic:
However, this is does not take the last vlob update for a given realm into account.
More generally, this approach should be carefully analyzed and implemented systematically since race conditions could potentially cause non-compliant write operations to be accepted.
The text was updated successfully, but these errors were encountered:
vxgmichel
changed the title
[Sever v3] Check concurrency model for postgre implementation
[Server v3] Check concurrency model for postgre implementation
Apr 19, 2024
A new concurrency model has been introduced in the postgre implementation of the parsec v3 server.
More specifically, requests that depends on a topic (for performing checks) but that do not update said topic should lock it for reading by using a
FOR SHARE
select query on the topic timestamp. On the other hand, the requests that plan to update a given topic should lock it using aFOR UPDATE
select query on the topic timestamp.This way, many read requests can run concurrently for a given topic but write requests have to run sequentially while no read request is performed.
This mechanism is already implemented here for the common topic:
parsec-cloud/server/parsec/components/postgresql/user.py
Lines 163 to 176 in f1ccaa5
parsec-cloud/server/parsec/components/postgresql/user.py
Lines 589 to 615 in f1ccaa5
And here for the
realm
topic:parsec-cloud/server/parsec/components/postgresql/realm.py
Lines 85 to 108 in f1ccaa5
parsec-cloud/server/parsec/components/postgresql/realm.py
Lines 392 to 432 in f1ccaa5
However, this is does not take the last vlob update for a given realm into account.
More generally, this approach should be carefully analyzed and implemented systematically since race conditions could potentially cause non-compliant write operations to be accepted.
The text was updated successfully, but these errors were encountered: