Fixes to LocalFile::lock()
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 4 Jul 2016 18:02:42 +0000 (11:02 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 5 Jul 2016 01:11:55 +0000 (18:11 -0700)
commitd70b081011b8d3df55e5b0f114c7f8f526522a0b
treed75bee10debe7ea517564442ccd93ea85839bce0
parent7e57732470fb3553b1d66a02cab9381b6c5068e9
Fixes to LocalFile::lock()

* Added onTransactionResolution() DB method.
* Use this method so that file unlocks fire on unlockAndRollback()
  as well as on DB errors (via MWExceptionHandler::handleException).
  This prevents locks from getting stuck for minutes when deadlocks
  happen, since the LockManager::destruct() method is not reliable.
* Fix broken reference counting which always released locks on the
  first unlock() call, even if there were 2+ lock() calls.
* Added some type hints to IDatabase methods.
* Fixed DatabaseBase::__destruct() logging to include all callbacks.

Bug: T132921
Change-Id: I684706957f4d794cb6fe61505b0d26b7893de706
includes/db/DBConnRef.php
includes/db/Database.php
includes/db/IDatabase.php
includes/filerepo/file/LocalFile.php
tests/phpunit/includes/db/DatabaseTest.php