Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
9 Sep 2006 at 10:52 UTC
Updated:
20 Oct 2006 at 09:03 UTC
Jump to comment: Most recent file
The SELECT src FROM path lookup queries weren't getting statically cached leading to 8 extra (duplicated) queries on a typical page. This applies to 4.7.* as well (and maybe 4.6... don't know).
To test this, turn on the devel module, path module, and make sure you have at least one aliased URL. Look in your query log for a section like this:
0.17 0 drupal_lookup_path SELECT src FROM url_alias WHERE dst = 'node'
0.21 0 drupal_lookup_path SELECT src FROM url_alias WHERE dst = 'node'
0.19 0 drupal_lookup_path SELECT src FROM url_alias WHERE dst = 'node'
0.17 0 drupal_lookup_path SELECT src FROM url_alias WHERE dst = 'node'
0.23 0 drupal_lookup_path SELECT src FROM url_alias WHERE dst = 'node'
Apply the patch and that query should only get executed once. Next issue.... why doesn't the devel module report dupe queries anymore?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | path_5.patch | 496 bytes | robertdouglass |
| #3 | path_4.patch | 1.57 KB | robertdouglass |
| path_3.patch | 500 bytes | robertdouglass |
Comments
Comment #1
dries commentedGood catch. Might be worth a code comment.
Comment #2
dries commentedCommitted to CVS HEAD. Thanks.
Comment #3
robertdouglass commentedAdded comments to all the lookup logic and removed an if block from the second part. This is a bigger change, closer review needed.
Comment #4
robertdouglass commentedComment #5
robertdouglass commentedchanging version so that this can get backported.
Comment #6
killes@www.drop.org commentedbackported the original patch, moving back to HEAD
Comment #7
robertdouglass commentedWe introduced a bug. The thing that should be cached is not the $path, but rather FALSE. If you're looking for the source for an alias and you don't find one, then FALSE is the correct return value. So yes, there is an optimization that can be made in the caching of results, but the first solution wasn't the right way.
This will need to be backported again.
Comment #8
drummCommitted to HEAD.
Comment #9
killes@www.drop.org commentedbackported
Comment #10
(not verified) commentedComment #11
RayZ commentedI believe this fix caused another bug http://drupal.org/node/89947.
Comment #12
nicholasthompsonRob - I'm not sure I follow your logic on the FALSE thing... Surely if you find yout path in that array you'd return true or the path... Maybe I'm mis-understanding it...