On Thu, Aug 23, 2012 at 1:37 PM, Daniel Kinzler <dan...@brightbyte.de>wrote:

> I think it would be extremely useful to allow nested database transactions
> - or
> simulate them using a counter that would only to the actual commit after
> commit() has been called as many times as begin() was called before.
>
> This actually used to be the case, according to the comment on
> Database::trxLevel:
>
>          * Historically, transactions were allowed to be "nested". This is
> no
>          * longer supported, so this function really only returns a
> boolean.
>
> This means that currently, if you call begin() while a transaction is
> already in
> progress, the previous transaction is inadvertently committed, possibly
> causing
> inconsistencies (at least on MySQL).
>
> Why was this feature removed? Not counting transaction levels is causing a
> world
> of pain for us on the Wikidata project, and I'm sure the same problem
> arises
> elsewhere.


Well, the main reason is probably that MySQL doesn't support nested
transactions... trying to simulate them with a counter sounds fragile, as a
single rollback would roll back the entire transaction "tree", not just the
last nested one you started (or else do nothing if you just decrement the
counter, also possibly dangerous if you expected the rollback to work).

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

Reply via email to