Database: close() should not commit transactions
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 3 Oct 2018 17:38:19 +0000 (13:38 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 3 Oct 2018 18:55:43 +0000 (14:55 -0400)
commitbf30fcb71427d673f7c83a067b3241040d3470b6
tree15efc327a4717cbe8eb17f378445733c435e7dc0
parentb42bdd1b92e3cfc9ef81772e44b14f6fbdccbcba
Database: close() should not commit transactions

Transactional databases normally roll back when a connection is closed
with an open transaction rather than committing them, so MediaWiki
committing them is unexpected.

There are two cases being changed here: automatic transactions without
writes and manual transactions. For the former it shouldn't make a
difference if we commit or roll back since no writes were done anyway.
The latter has logged a message since MW 1.31 (I0992f9a8), and that
warning has not been logged in Wikimedia production in the past 60 days
so we should be ok there too.

Bug: T206147
Change-Id: Ieceef4deb49044db8f0622d38ee76c9d9f39704c
RELEASE-NOTES-1.32
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/IDatabase.php
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php