Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
#106721: Optimize node access query building provides an order of magnitude improvement in performance when assembling complex node access queries. Since the Views content access filter copies part of Core, we should make equivalent changes.
Comments
Comment #1
ezra-g CreditAttribution: ezra-g commentedHere's one stopgap patch that implements equivalent changes in Views and a second that uses the new API function defined in #106721: Optimize node access query building.
Comment #2
msonnabaum CreditAttribution: msonnabaum commentedLooks good to me.
Comment #3
msonnabaum CreditAttribution: msonnabaum commentedTo be clear, I'm RTBC-ing 2204257-views-content-access-filter-core-1-stopgap.patch.
Comment #4
msonnabaum CreditAttribution: msonnabaum commentedOops.
Comment #5
andyg5000The first patch in #1 calls an undefined method static::buildGrantsQueryCondition (D8?). Here's a patch to apply the same update but call node_add_node_grants_to_query() instaead.
Comment #6
weri CreditAttribution: weri commentedComment #7
joelpittet@andyg5000 where is node_add_node_grants_to_query? I don't see that function in core.
Comment #8
joelpittetSorry, didn't realize it was in the IS referenced patch.
Comment #9
ohthehugemanatee CreditAttribution: ohthehugemanatee at Forum One commentedThis patch (#5) has been in production in Drupal Commons for a long time now. Marking this as RTBC.
Comment #10
dawehnerThank you! Its great to see this in the wild since a while already
Comment #12
jastraat CreditAttribution: jastraat commentedIt doesn't look like node_add_node_grants_to_query() is in core yet; the patch from #106721: Optimize node access query building doesn't appear to have been committed to core.
Another individual opened #2608652: Call to undefined function node_add_node_grants_to_query() since upgrade. This probably should not have been added to views until the core patch was accepted and released in an official version.
Comment #13
kristofferwiklund CreditAttribution: kristofferwiklund commentedThis patch is not working with latest Drupal core as stated above.
Comment #14
andyg5000The patch in this issue is dependent on #106721: Optimize node access query building as stated in the issue summary. Looks like this commit should be reverted until that issue is closed out.
Comment #15
maximpodorov CreditAttribution: maximpodorov commentedThis should be reverted immediately, and new release should be created. Please don't break our sites.
Comment #16
dawehnerI'm sorry about the misery.
This is the entire problem space with this "its RTBC just commit it" ... its never easy.
Back to normal to add a fix until #106721 is done.
Comment #17
dawehnerCreated a new release which should be there in a while.
Comment #19
colanWe need to wait for the core issue to get in.
Comment #20
bcooksley CreditAttribution: bcooksley as a volunteer commentedCan we please be more careful in future with releases? As a sysadmin, getting pelted with countless emails from numerous Drupal instances informing me that there is yet another update to a rather commonly used module is getting a little annoying - especially when I was sure I had updated that module already this week.
Comment #21
joelpittet@bcooksley You can help write tests or fix the testbot to ensure This won't happen.
They are all volunteering to maintain the module. Maybe instead of complaining you could pitch in.
Colon's got some issues up that could use help tracking down some testbot test failures which arose I think when they were moving away from pifr.
Comment #22
gifad CreditAttribution: gifad commentedJust looking at the patches, the inserted line :
$grants = node_add_node_grants_to_query(node_access_grants('view'));
should be :
$grants = node_add_node_grants_to_query(node_access_grants('view'), $table);
or am I missing something ?
Comment #23
DamienMcKennaAlso, once the core issue is committed should the dependencies b updated to require the newest version to avoid the problems that happened with the 7.x-3.12 release?
@gifad: The patch's docs say the second argument is optional, is there a specific need to include it?
Comment #24
gifad CreditAttribution: gifad commented@DamienMcKenna : I ping you back the question : was there a specific need to prefix gid and realm by table name, in the "old" code ?
Comment #25
colanFollow-up to #21: For those of you interested in getting testing up & running again (to avoid the kind of problem above), please help with #2610292: 7.x-3.x-dev failure: testStaticAccessPlugin.
@DamienMcKenna: Good catch! Yes, we should update the dependencies.
Comment #26
helmo CreditAttribution: helmo at Initfour websolutions commentedWhat about adding it with a function_exists check?
Even if #106721: Optimize node access query building gets into 7.42 and views gets a new release after that there still is a big potential for WTF experiences.
Unless it would be made impossible to use the new views with an older version of core.
Comment #28
helmo CreditAttribution: helmo at Initfour websolutions commentedtest hickup?
Comment #29
joseph.olstadPatch 26 looks safest, I agree with @helmo, because we cannot guarantee a core upgrade at the same time as a views upgrade.
Patch 26 will work either way.
we should push for the D7 core performance improvement here:
#106721: Optimize node access query building
Comment #31
fenstratReroll of #26.