.. -*- restructuredtext -*-
The `sequence_postgres` module of Open ERP.
Open ERP uses `serialised transactions
<http://www.postgresql.org/docs/8.1/static/transaction-iso.html>`_ which has
the highest level of isolation between transactions. As the word `serialised`
itself indicates, transactions seem to work as though they were executed one
after the other and this is completely true in the case of writes to the
The problem with such an architecture is when there are concurrent transactions
which wait for a specific transaction to complete before it can modify a
record. For example Transaction A starts and calls `get_id` of the sequence (
which updates the sequence next number) and goes on for the next operation
while the transaction remains uncommitted. In the meantime somebody else does
an operation which starts a different transaction B, but the transaction will
have to wait until transaction A completes because of the serialised nature.
This causes `OperationalError: could not obtain lock on row in relation
"ir_sequence"`. Since version 6.0 of openerp it uses `NOWAIT` which means do
not wait for the transaction which has a lock to complete, but just fail. This
is not the ideal behaviour for a concurrent software.
This module does not solve the problem, but allows you to define a new type of
sequence which work outside a transaction, thereby ensuring that sequence
increments dont block concurrent transactions as there is no editing of
records (but of a postgres sequence which is outside the transaction).
- Implemented at postgres levels and works much faster
- Allows prefix and suffix just like normal sequences
- There could be holes in the sequence. If this is important for you dont
change sequences to use the new type of sequences
- An alternate approach to the problem could be by the use of transactions which
allow `dirty read` (Read uncommitted transaction data) exclusively for the
`get_id` method of the sequence. This would however have the same disadvantage
and a higher cost.
- An even better approach would be to ensure that there are no long running
transactions in the programs you write.
Commercial support for the module is available from
`Openlabs Technologies & consulting (P) Limited <http://www.openlabs.co.in/>`_
The prerequisites modules are:
- Base (Bundled with OpenERP)
Once you have downloaded the module, place the folder of the mdoule into the
modules path of OpenERP.
© Copyright 2011 Openlabs Technologies & Consulting (P) Limited.
© Copyright 2011 Multibase WebAustralis Pty Ltd.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see `here <http://www.gnu.org/licenses/>`_.