On 26.09.2012 02:49, Aaron Schulz wrote:
> Perhaps some code could be restructured
> in some cases so that the calls at least match, meaning the splitting of
> transactions would at least be more deliberate rather than accidental.

I think this is the most important bit here: it should be obvious to the
programmer what is going on, and it should be easy to debug when stuff gets
committed and why. The behavior of the respective functions should be documented
in detail for all the possible situations.

My impression is that I'm not the only developer who had the wrong mental model
of what begin/commit does, or how it is intended to use. Fixing that is the most
important thing. Coming up with ways to actually allow for unbroken nested
transactions would be good I think, but that comes second.

For the "being obvious" bit, better documentation is the first step. Another
possibility would be to provide additional functions (even if they just act as
aliases) that allow the programmer to make explicit the desired behavior.

The "debug" bit is mostly about when debug messages and warnings should be
issued. I see three factors that could influence that:
* the DBO_TRX flag
* whether write queries have been executed on the connection (since the last
commit).
* whether wgDebugTransactions is enabled.

What do you think, which of these factors should be considered, and how?

-- daniel

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to