HomePhabricator

rdbms: Database::selectDB() update the domain and handle failure better

Authored by aaron on Aug 14 2018, 11:44 PM.

Description

rdbms: Database::selectDB() update the domain and handle failure better

LoadBalancer uses Database::getDomainId() for deciding which keys to use
in the foreign connection handle arrays. This method should reflect any
changes made to the DB selection.

If the query fails, then do not change domain field. This is the sort of
approach that LoadBalancer is expects in openForeignConnection(). Also,
throw an exception when selectDB() fails.

The db/schema/prefix fields of Database no longer exist in favor of just
using the newer currentDomain field.

Also:

  • Add IDatabase::selectDomain() method and made selectDB() wrap it.
  • Extract the DB name from sqlite files if not explicitly provided.
  • Fix inconsistent open() return values from Database subclasses.
  • Make a relationSchemaQualifier() method to handle the concern of omitting schema names in queries. The means that getDomainId() can still return the right value, rather than confusingly omitt the schema.
  • Make RevisionStore::checkDatabaseWikiId() account for the domain schema. Unlike d2a4d614fce09c, this does not incorrectly assume the storage is always for the current wiki domain. Also, LBFactorySingle sets the local domain so it is defined even in install.php.
  • Make RevisionStoreDbTestBase actually set the LoadBalancer local domain.
  • Make RevisionTest::testLoadFromTitle() account for the domain schema.

Bug: T193565
Change-Id: I6e51cd54c6da78830b38906b8c46789c79498ab5

Details

Committed
aaronOct 10 2018, 7:03 PM
Parents
rMW20845db7dd25: Add pear/Net_SMTP 1.8.0 to composer dependencies
Branches
Unknown
Tags
Unknown
References
refs/changes/78/452878/23
ChangeId
I6e51cd54c6da78830b38906b8c46789c79498ab5