← Back to team overview

openerp-expert-framework team mailing list archive

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

 

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,

--
Valentin LAB
Ingénieur Développement

tel:  +33 6 71 39 62 13
mail: valentin.lab@xxxxxxxxxxx


Follow ups