Problem/Motivation
The current workspace association implementation relies on complex queries against entity storage tables to determine which revisions belong to which workspace. This approach:
- Requires SqlContentEntityStorage, limiting support for custom entity storage handlers
- Uses complex queries on entity base and revision tables
- Has performance implications for large datasets
- Makes the code harder to maintain and understand
Proposed resolution
Introduce a new workspace_association_revision table to explicitly track all entity revisions associated with a workspace.
Additionally, this clears the path towards deprecating/removing the workspace revision metadata field, which is needed in order to implement moving revisions between workspaces in a performant way as required for #3486378: [Plan] Allow for / implement simplified content workflow with workspaces.
Remaining tasks
Review.
User interface changes
Nope.
Introduced terminology
N/A.
API changes
Nope.
Data model changes
Added a new workspace_association_revision table to track all workspace-associated revisions.
Release notes snippet
The Workspaces module now uses a dedicated database table to track all workspace-associated entity revisions, improving performance and removing limitations on custom entity storage implementations.
| Comment | File | Size | Author |
|---|
Issue fork drupal-3540271
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:
- 3540271-refactor-workspace-association
changes, plain diff MR !12937
Comments
Comment #3
amateescu commentedComment #4
amateescu commentedAdded the upgrade path with test coverage, this should be fully ready for review now :)
Comment #5
fabianx commentedI am providing an AI review (made by Gemini) for discussion later:
My own verdict (so far):
Claude brought up some other points, which I however need to review first as it also hallucinated a missing upgrade path ...
Overall from my own review so far: Looks good, but need to look more detailed still.
Comment #6
amateescu commentedThat's a surprisingly insightful review :)
node_revisiontable with 150k revisions, and it runs in 8 seconds :)workspaces_update_11302()Comment #7
catchI don't think that it is helpful to post known incorrect points from an LLM onto a complex core issue even with the rebuttals included. I have just had to read hundreds of words and think about them (and haven't re-reviewed the MR yet) whereas the actual review points boil down to:
- The update should use an alias for a table name. (and this could have been found in linting with a phpstan rule, we'd need to add one but we have similar things).
- We should decide whether the update should batch by workspace or not based on real world testing (which Andrei had apparently already done).
Comment #8
catchI have an issue open about the fixtures but that issue is irrelevant to any upgrade path testing we add now. I'm only linking it so that no one opens a 'new' followup for the LLM point. #3403649: Rework database update tests so we don't have to ship database dumps in git.
Comment #9
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #10
amateescu commentedMerged latest 11.x, and it was a clean merge, not sure what the bot doesn't like.
Comment #11
plachBtw, I tested the upgrade path on a site with 20K workspace associations and a
node_revisiontable with 207k revisions, and it run in 11 seconds, so I agree we probably don't need a batch here.Comment #12
amateescu commentedFixed all review points :)
Comment #13
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #14
amateescu commentedTests are passing again.
Comment #15
plachLooks good to me now, thanks!
Comment #17
catchGiven #6 and #11 I think that's plenty of real-world testing of the performance of the database update, and it allows us to keep it in a single transaction.
Committed/pushed to 11.x, thanks!