PortIndex2MySQL.tcl should be atomic
Ryan Schmidt
ryandesign at macports.org
Tue Dec 15 05:11:42 PST 2009
PortIndex2MySQL.tcl seems to have some odd behavior.
It seems to DROP and re-CREATE all the tables every time it runs. It has a --create-tables command line option, but it seems to recreate the tables whether or not that option is given.
Partly as a consequence of that, I think, if something causes the update to fail partway through (like a duplicate port, like we just had with box2d) then the database is left in an incomplete state (for example, right now the web site claims we have 1571 ports, when of course we really have over 6400 ports.
It seems to me that the tables should only be recreated when needed (i.e. only when the schema changes, which should be rare), and that the update should occur inside a transaction, so that if anything fails, the transaction is automatically rolled back and there will no longer be a way for the database to exist in an incomplete state.
Is there any reason you can think of why we should not make these changes?
More information about the macports-dev
mailing list