Problem/Motivation

For database drivers that override an other database driver, such as https://www.drupal.org/project/pgsql_fallback, have to create their own implementation for backend overridden services. The PostgreSQL fallback driver has to create its own service for the pgsql.views.date_sql service. This is problematic because the PostgreSQL fallback driver lives in a module and it is not enabled by default and therefor the backend overridden service does not exist until it is enabled.
Core now only uses the driver name to check for a backend overridden service. The PostgreSQL fallback driver has the driver name "PgsqlFallback", not "pgsql".

Proposed resolution

Make the backend overridable service discovery also check with for the Connection->databaseType() service override when there is no override for Connection->driver() service.

Remaining tasks

TBD

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

TBD

CommentFileSizeAuthor
#2 3130973-2.patch4.54 KBdaffie
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
FileSize
4.54 KB
plach’s picture

daffie’s picture

Title: Make the backend overridable discovery also check the database type for an overridden service » Make the backend overridable service discovery also check the database type for an overridden service
Issue summary: View changes
Ghost of Drupal Past’s picture

Status: Needs review » Reviewed & tested by the community

Yeah this looks good. Although the variable names have been changed, as far as I can see the first attempt will be for the service prefixed by the return value of the driver() method and then we are adding a new attempt for the return value of databaseType method. Core returns the same for both but there's no reason contrib should be similarly married -- but as we will see, the "large" drivers are. Makes sense.

For the sake of completeness, there's a chance of BC break here but that chance is just astronomically, astronomically low.

  1. The database driver should return different values from driver and databaseType. mysql, pgsql, sqlite oracle, sqlsrv all return the same value here so all of these won't break. The highest chance here is something extending the FakeConnection which the MongodbDriver did but that driver hasn't been updated for five years. So I will use fake as the example. Observe the zero results at http://grep.xnddx.ru/search?text=fakeconnection&filename= as well.
  2. You need a service called foo and fake.foo but fake.foo was not intended as the override of foo.

This will break. Do we care? I think not.

catch’s picture

Title: Make the backend overridable service discovery also check the database type for an overridden service » [backport] Make the backend overridable service discovery also check the database type for an overridden service

Committed 0e6ed37 and pushed to 9.1.x. Thanks!

I think this is probably OK to backport, but 9.0.x is frozen, and while there's very little chance for the conflict that chx describes, it is a behaviour change/API widening as opposed to a strict bug fix. So leaving RTBC against 9.0.x for now.

  • catch committed 0e6ed37 on 9.1.x
    Issue #3130973 by daffie, plach, Charlie ChX Negyesi: Make the backend...

  • catch committed 904189e on 9.0.x
    Issue #3130973 by daffie, plach, Charlie ChX Negyesi: Make the backend...
catch’s picture

Title: [backport] Make the backend overridable service discovery also check the database type for an overridden service » Make the backend overridable service discovery also check the database type for an overridden service
Status: Reviewed & tested by the community » Fixed

Backported to 9.0.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

quietone’s picture

Published the CR