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
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:
- 3605262-database-write-optimizations
changes, plain diff MR !16113
Comments
Comment #3
berdirCreated 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.
Comment #4
catchI 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?
Comment #9
godotislateCommitted 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.
Comment #11
brice_gato commented@berdir could this issue be related to one of the issues in the entity_reference_revisions module ?