Problem/Motivation

`LocaleConfigManager::updateConfigTranslations()` saves language config overrides
even when the computed translation data is identical to the existing override. This
causes unnecessary cache tag invalidations on every `drush locale:update` run.

On a site with German translations, running `drush locale:update` with no actual
translation changes re-saves all 177 config overrides, invalidating their cache tags.
When a CDN purge module is active, this floods the purge queue
and triggers rate limiting.

The bug is in `updateConfigTranslations()` at line 600 — the `elseif (!empty($data))`
branch calls `saveTranslationOverride()` without first checking if `$data` matches the
existing override.

The issue has been identified on Drupal version 11.3.3

Steps to reproduce

1. Install Drupal with the `locale` module and at least one non-English language with
imported translations
2. Run `drush locale:update` — observe config overrides being saved
3. Run `drush locale:update` again — the same overrides are re-saved even though
nothing changed

Proposed resolution

Add a comparison in `updateConfigTranslations()` to skip the save when the computed
data is identical to the existing override:

elseif (!empty($data) && $override->get() !== $data) {

The $override object is already loaded on line 586, so this adds no extra queries.

Remaining tasks

User interface changes

none

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

Issue fork drupal-3577001

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

petar_basic created an issue. See original summary.

petar_basic’s picture

Version: 11.3.x-dev » 11.x-dev
StatusFileSize
new1.98 KB

Added a comparison to skip saving config overrides when the data hasn't changed, plus a kernel test. The fix is a one-line change in updateConfigTranslations() — we check $override->get() !== $data before calling saveTranslationOverride().

Also, attaching a patch for use with composer patches.

petar_basic’s picture

Assigned: petar_basic » Unassigned
Status: Needs work » Needs review

failing gitlab jobs are really unrelated

quietone’s picture

Version: 11.x-dev » main

Hi, Issues for Drupal core should be targeted to the 'main' branch, our primary development branch. Changes are made on the main branch first, and are then back ported as needed according to the Core change policies. The version the problem was discovered on should be stated in the issue summary Problem/Motivation section. Thanks.

petar_basic’s picture

Issue summary: View changes

I've rebased the MR and it's target is now main.
I've also added the version the problem was discovered on in the Problem/Motivation section of the issue summary.

alexpott’s picture

This fix looks really sensible - nice work @petar_basic. I think we should also mirror this logic for the active langcode translations too.

petar_basic’s picture

Thanks @alexpott!
I agree, and I've applied the proposed change.
Also added a test to cover that path as well.

Re-rolled patch with all changes.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative, +Bug Smash Initiative

Ran the test-only and both tests fail which is good to see https://git.drupalcode.org/issue/drupal-3577001/-/jobs/8790039

Tested with breakpoints and with the MR I didn't hit the reimport. Already appeared to get a support from @alexpott and feedback which has been addressed.

alexpott’s picture

Version: main » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 2ed9cb80fae to main and be71083b676 to 11.x and 18c354876df to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 18c35487 on 11.3.x
    fix: #3577001 LocaleConfigManager::updateConfigTranslations()...

  • alexpott committed be71083b on 11.x
    fix: #3577001 LocaleConfigManager::updateConfigTranslations()...

  • alexpott committed 2ed9cb80 on main
    fix: #3577001 LocaleConfigManager::updateConfigTranslations()...

Status: Fixed » Closed (fixed)

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