Problem/Motivation
We discovered in #2975334-19: Prevent changes that would leak into the Live workspace that a very complex entity query which joins the base entity table multiple times also has to join the workspace_association table for each of them.
Proposed resolution
Figure out a solution to only join the workspace_association table once per entity type.
Remaining tasks
TBD.
User interface changes
Nope.
API changes
Nope.
Data model changes
Nope.
Issue fork drupal-2983639
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:
- 2983639-re-enable-a-bit
changes, plain diff MR !15961
Comments
Comment #2
amateescu commentedJust for future debugging reference, this is the query generated by
\Drupal\Tests\workspace\Kernel\WorkspaceIntegrationTest::testEntityQueryRelationship()before #2975334: Prevent changes that would leak into the Live workspace:And this is the query generated after #2975334: Prevent changes that would leak into the Live workspace, where we switched the referenced entity type from
entity_test_mulrevtoentity_test_mulrevpub:Comment #3
MixologicSo I noticed that testEntityQueryRelationship was taking a long time to run on drupalci.
Turns out that the behemoth of a query that gets generated is hitting a bug in mysql where it cant hardly parse the query, and it takes it 4-5 minutes to run.
When I try on mysql 5.7, everything is fine, and the test is almost instant, so its only a bug with mysql 5.5.
So we should also be concerned about triggering the same sorts of bugs for people with mysql 5.5. in production.
Comment #4
effulgentsia commentedWhat's the behavior on mysql 5.6? I ask because security support of mysql 5.5 ends at the end of 2018 (see page 19 of http://www.oracle.com/us/support/library/lifetime-support-technology-069...), which is before workspace.module will be released as a non-experimental module.
Comment #5
Mixologichavent had anybody ask for a 5.6 mysql container.
I've mentioned in other threads that Im loathe to add every possible db container version + php version because we end up with gigantic, expensive matrix'es of tests. But If we really want a mysql container for 5.6 we could do that too.
I'll see about adding it and see what happens.
Comment #7
amateescu commentedFix component following module rename.
Comment #8
amateescu commentedA possible solution for this problem is to change the way we track the workspace association of a revision, and use a "workspace target" revision metadata field on the tracked entity type rather than the current standalone `workspace_association` entity type.
Comment #18
amateescu commentedThe suggestion from #8 was implemented in #3062434: Track the workspace of a revision in a base field and convert the workspace_association entity type to a custom index, but it didn't help with the problem described in this issue.
I think #2875033: Optimize joins and table selection in SQL entity query implementation has a very big potential to help with workspace's query alters, so postponing on that issue.
Comment #20
amateescu commented#2875033: Optimize joins and table selection in SQL entity query implementation is in, let's check if we can re-enable those query conditions now.
Comment #22
amateescu commentedSeems to work fine locally. It helps that we don't have to deal with mysql 5.5 as well :)
Comment #23
smustgrave commentedBased on all 3 database types running green and change seems minimal see no objections
Comment #27
catchCommitted/pushed to main and cherry-picked to 11.x and 11.4.x, thanks!