Make transaction enforcement stricter
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 14 Aug 2016 04:26:12 +0000 (21:26 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 17 Aug 2016 01:07:56 +0000 (18:07 -0700)
commita26fbb67054a09e80ac7e59c1a9f351474649a1e
tree6485cd3d5e556adfe77413784b35b0ffdef4c1d9
parent06045fd914a2472f6615fb79b0244c1103099a6d
Make transaction enforcement stricter

* Nested begin()/commit() will no-op when inside active
  DBO_TRX transactions, even if no writes happened yet.
  This avoids snapshot loss from REPEATABLE-READ or SSI
  SERIALABLE (postgres). An error will be logged.
* Also no-op when begin() happens, no transaction started,
  but DBO_TRX is set. That should not happen as it can make
  multi-DB commits less robust and can clear snapshots early.
  An error will be logged.
* Throw an error when explicit rollback() is used and DBO_TRX
  is set. This will cause peer DBs to rollback too via the
  logic in MWExceptionHander.
* Callers should use LBFactory methods for doing commit/rollback
  instead.

Change-Id: I31b8b1b112cf9110b805a023732bce4dcff0604c
includes/db/DBConnRef.php
includes/db/Database.php
includes/db/DatabasePostgres.php
includes/db/IDatabase.php