rdbms: clean up session/transaction loss logic in Database
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 20 Mar 2018 11:16:41 +0000 (04:16 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 29 Mar 2018 20:33:31 +0000 (20:33 +0000)
commitd8732ad042a2842961e3c87de96accf31f31a9f3
treea8b9664d658cfe3cdb3973bc72518c9316aa1183
parent77e3624caba072521fbc1826af2d47f9b29f4032
rdbms: clean up session/transaction loss logic in Database

* Refactor the code to be less cluttered, moving some logic
  to reconnect(), which is now named replaceLostConnection()
* Handle the case of a second connection loss on query retry
* Make canRecoverFromDisconnect() check for temporary tables
* Do not clear session-level variables on deadlock errors
  since only the transaction is lost, not the whole session
* Make sure any empty transaction is destroyed on deadlock
* Attempt reconnection *before* triggering the transaction
  callbacks since some of them  might want to use the database
* Define wasConnectionError() for postgres
* Remove unused return value from handleSessionLoss()

Change-Id: Ic1dcab03f087ce310637210e8e9bc0771e44f045
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabasePostgres.php