On Thu, 2003-10-16 at 11:03, Magnus Sundberg wrote: > Chris Mason wrote: > > On Thu, 2003-10-16 at 10:15, Matthew T. O'Connor wrote: > > > >>On Thu, 2003-10-16 at 09:57, Chris Mason wrote: > >> > >>>Ok, here's a patch for dbmail 1.2 cvs that implements the transaction > >>>begin/commit for mysql during pipe.c:insert_messages, and the imap > >>>copy/append message commands. > >> > >>Great, dbmail should be using transactions, why use a database if you > >>don't use transactions. > >> > > > > I beleive this is a non issue, suppose the following function > > start_transaction(){ > if ( transactions_supported) { > /* Issue SQL start transaction code */ > > }; > };
There's a lot more to using transactions than BEGIN/COMMIT. The current code orders operations such that transactions are not purely required. When inserting messages it sets the unique_id last (as a kind of informal commit), does rollback manually when some part of the insert fails, etc. A real transactional system would let the database do all of that. My patch only addresses a performance aspect with mysql transactional tables...every write triggers a commit. Enclosing them in a transaction does one commit for the whole group instead. Inserting a huge message as an atomic unit might not be the best idea, I'm not sure how well mysql will cope with it. -chris