Remove the commit after the update of each module
We currently have a commit in load_module_graph
when loading all the module of the graph. This has the effect of making the update of the databases not rollbackable when an error happen.
I'm wondering if we can not remove it safely with some modifications.
From the postgresql wiki it seems that DDL are rollbackable in pg
Regarding update while in prodcution in the postgresql documentation they state that only some DDL are problematic namely TRUNCATE
and some ALTER TABLE
(those changing the type of a column and those adding a default that is using a VOLATILE
function). I've made some test and I could indeed ROLLBACK
all the DDL changes I've done.
Even better some of the type altering calls we make do not trigger a table rewrite because the types need to be not binary-coercible (eg: int
So I am wondering if we couldn't remove this commit at the cost of either:
- stop the update when we're making an
ALTER TYPE
that is an issue, - commit only when we've done such an
ALTER TYPE
(with a warning but I don't like this as the commit would look random)
I've also made some tests with SQLite but I wasn't able to find DDL that were not rollbackable. I haven't tested concurrent access as I don't think anybody would use SQLite for that.