Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Most contrib modules have no reason to talk to the database directly instead a combination of configuration management, key value storage and the entity system should be used. This change notice is for modules integrating Drupal with a database not supported by core and the users of these.

Before

In order to swap out the storage of some specific service you could always change the container on compile() time.

class Example implements CompilerPassInterface {
  public function process(ContainerBuilder $container) {
    $container->set('lock', new Definition('Drupal\mongodb\lock\Lock'));
  }
}

After

The service you want to replace has to be tagged with 'backend_overridable':

 lock:
    class: Drupal\Core\Lock\DatabaseLockBackend
    arguments: ['@database']
    tags:
      - { name: backend_overridable }

The default backend is the database driver: mysql, pgsql etc.

Aliases are

config.storage:
  alias: mongodb.config.storage

Will use MySQL (or whatever the relevant driver is) for everything except the configuration which will be stored in MongoDB.

For developers of such modules, pick first a backend value (for example, mongodb). Then it is possible to specify overrides for services tagged with backend_overridable and they will automatically be picked up if the user (or an install profile) sets the default_backend accordingly. So the service mongodb.config.storage is called so because a) the module uses mongodb as the default_backend b) config.storage is tagged as backend_overridable.

Impacts: 
Site builders, administrators, editors
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done