Community mailing list archives

Re: Odoo Performance and concurrency locks

by Olivier Dony <> - 09/15/2015 14:04:40
On 09/14/2015 09:38 PM, Shawn Varghese wrote:
> @Olivier Dony and OpnERP Master,
> There are multiple POS machines which simultaneously validate orders or press
> validate in the gap of a few seconds. From what I have gathered from the logs,
> it seems that the lock arises when simultaneous transactions try to obtain a
> sequence number for the orders (which is a gapless sequence).

As Graeme mentioned, you should really use standard sequences. This is the 
default anyway (except for accounting journals).

Gapless sequences are much more expensive in terms of transactions and will 
only make a difference if you rollback transactions after incrementing a 
sequence. This is very rare.
In fact, quite ironically, using gapless sequences will increase the likelihood 
of such rollbacks, by causing more TransactionRollbackErrors.

> Increasing the wait time has produced visible improvements as the lock gets
> released before the retry, in most cases. But since it is not recommended, I
> will read through the suggestions mentioned here and try a different approach.

Note that upgrading to PG 9.3 will not help in this case, this is a direct 
conflict caused by updating the same record in two parallel transactions.

The best solution here is to switch your sequences to standard ones.