← Back to team overview

openerp-expert-framework team mailing list archive

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

 

Yes we would love that too, but refactoring module/*.py is hard and it's not broken so we dont plan to fix it now. Any MP to cleanup this would be welcome. Savepoints are not needed at all I would avoid all commits and do everything in one transaction.

On 03/13/2014 03:16 PM, 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,



References