Use database rather than database.replica

Created on 6 February 2024, 11 months ago
Updated 22 April 2024, 8 months ago

Problem/Motivation

Often a database replica is a read-only database connection, so i was suprised to see this service selected in watchdog_prune_cron. On my setup this is causing an error which is to be expected on a read-only database connection:

Steps to reproduce

$ ../vendor/bin/drush php
> watchdog_prune_cron();

   Drupal\Core\Database\DatabaseExceptionWrapper  SQLSTATE[HY000]: General error: 1290 The MySQL server is running with the --read-only option so it cannot execute this statement: DELETE FROM "watchdog"
WHERE ("type" = :db_condition_placeholder_0) AND ("timestamp" < :db_condition_placeholder_1); Array
(
    [:db_condition_placeholder_0] => tfa
    [:db_condition_placeholder_1] => -1448562284
).

Proposed resolution

Use 'database' service instead of 'database.replica'.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇦🇺Australia sime Melbourne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024