← Back to team overview

openerp-expert-framework team mailing list archive

Re: database commits everywhere in orm's _auto_init, what purpose ?

 

The api looks ok, even if i think we should discourage the use of savepoints. @chs what do you think?

On 03/13/2014 08:05 PM, Valentin LAB wrote:
Here's a MP to propose a simple way to add transaction where it could be
needed without breaking legacy code:

https://code.launchpad.net/~0k.io/openobject-server/trunk-new-prevent-cr-commit-to-allow-super-transaction/+merge/210884


If this is okay, it's trivial to encompass openerp's initialize / update
sequence in one go.

Any comments ?


On 13/03/14 15:16, Valentin LAB wrote:
Hi,

I've noticed with great pleasure the introduction of a small savepoint
facility in the "sql_db.py" quite recently, and I looked how transaction
where used in the initialisation / update process.

I don't understand why ``_auto_init`` uses ``cr.commit()`` every now and
them. What is the exact purpose of these ?

Wouldn't it be much better NOT to use them at all ?
And if there are some hidden benefits, what about replacing them with
savepoints ?

My main concern is about having a clean initialisation / update process:
we have issues quite often with modules that are not correctly updated,
and they are marked (and commited) wrongly in unsatisfactory states.
This leaves the whole database often in a intermediary state of which I
can't find any justification. We then face unique issues depending on
which modules failed and from which path we perform multi-update, and
often have to enter the weird multiple-updates process.

I was changing the code to use savepoints to support sort of
"nested-commit", allowing to leave the database untouched if something
went wrong before the full initialisation occured.

But why are these commits there in the first place ? What am I missing ?

Thanks for your enlightenments,





Follow ups

References