rdbms: avoid throwing exceptions in Database::close() on reconnect
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 8 Mar 2018 21:38:10 +0000 (13:38 -0800)
committerKrinkle <krinklemail@gmail.com>
Wed, 14 Mar 2018 00:55:35 +0000 (00:55 +0000)
commit397918afcde366c4e50aeff2166d2aec0b645f41
tree9c431c39e4ec2646464e19db93995bfe862ffc7b
parent92a0deae6481f6d63b2e2b561b230b3c06b5d8c9
rdbms: avoid throwing exceptions in Database::close() on reconnect

The check caused problems in reconnect() calls from rollback()
triggered by LBFactory::rollbackMasterChanges(). Since callbacks
are suppressed at that time, handleSessionLoss() does not consume
all of them, so the the call to open() triggered a close() call
that would error out since the callbacks are still there.

Only do that check if a connection was present beforehand.
Check for callback suppression before trying commit() too.

Also make writesOrCallbacksPending() check trxEndCallbacks.

Bug: T188875
Change-Id: Ia46d30d75132358a0b4f60e847937013781c1daa
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/IDatabase.php