Warn about all nested transactions when testing.
authordaniel <daniel.kinzler@wikimedia.de>
Wed, 26 Sep 2012 10:38:44 +0000 (12:38 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Wed, 26 Sep 2012 10:38:44 +0000 (12:38 +0200)
commit5bfd85cf2694abb2a98a05d6c436a7a8aa692ec9
treea0c51c6b92110b10a499a31d2269ff773bab6f27
parentf85255bd3b1255b642f529cb90882898176b4cf7
Warn about all nested transactions when testing.

This change causes implicit commits caused by consecutive calls to
Database::begin() without intermediate calls to Database::commit() to
be more easily tracable. The changes introduced are:

* $this->doCommit( $fname ) is now called unconcitionally if there is
  an open transaction. Previously, it was not called if there were no
  write operations performed in that transaction.

* A warning about implicite commits (nested transactions) is now issued
  if write operations were performed OR ther DBO_TRX flag is NOT set. This
  causes any unmatched calls to begin() to trigger an error in CLI mode,
  notably also within unit tests.

* Implicit commits of non-write transactions in DBO_TRX mode can now be
  logged by enabling $wgDebugDBTRansactions.

Besides this, this change improves the documentation of the transaction
control functions.

The rationale is that implicite commits should be more easily tracable
in production and development.

Change-Id: I1e746322c36a7c53b545bfe78e252a13cce44ea1
includes/db/Database.php