Problem/Motivation

Ive noticed thanks to failing tests in entity_reference_revisions that the optimizations we did in #3554579: Optimize database writes when re-saving a pending revision as the default one have a problem and do not update revision tables when changing the default revision flag of an existing revision and also changing values at the same time.

This is relatively uncommon, content moderation forces new revisions and I think workspaces generally only publishes a revision and doesn't change it at the same time. I think? Still, if it happens, it causes data loss/inconsistency and is IMHO a critical regression.

Steps to reproduce

Proposed resolution

Add a test and revert the original change.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3605262

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

berdir created an issue. See original summary.

berdir’s picture

Status: Active » Needs review

Created a MR with the revert and a test, we already have some existing test coverage, but it only asserts field values when saving a new non-default revision and only loading the default revision and not loading by revision, I extended that test a bit.

catch’s picture

Status: Needs review » Reviewed & tested by the community

I think we should revert this and then open a new issue (or re-open the original issue) to try to add the optimisation back.

Only two ideas I have are:

1. Deprecate "changing the default revision flag of an existing revision and also changing values at the same time." but can we even detect that?

2. If we can detect it, we could probably account for it in the optimisation anyway?

  • godotislate committed e582ecb8 on main
    revert: #3605262 Database write optimizations result in inconsistent...

  • godotislate committed a0d19ec6 on 11.x
    revert: #3605262 Database write optimizations result in inconsistent...

  • godotislate committed a3e92473 on 11.4.x
    revert: #3605262 Database write optimizations result in inconsistent...
godotislate’s picture

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

Committed and pushed e582ecb to main, a0d19ec to 11.x, and a3e9247 to 11.4.x. Thanks!

Re-opening #3554579: Optimize database writes when re-saving a pending revision as the default one.

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.

brice_gato’s picture

@berdir could this issue be related to one of the issues in the entity_reference_revisions module ?

Status: Fixed » Closed (fixed)

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