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.
I think it's reasonably safe to assume that the search system can handle slightly stale data, since it does already. Attached patch converts most search-related queries to use slave servers if available.
And oh yeah, fixes lots of stray whitespace. Fix your IDEs, people!
Comment | File | Size | Author |
---|---|---|---|
#9 | search_slave.patch | 7.11 KB | Crell |
#2 | search_slave.patch | 7.33 KB | Crell |
search_slave.patch | 6.73 KB | Crell | |
Comments
Comment #2
Crell CreditAttribution: Crell commentedOopsies, missed a comma in one spot.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedLooks good. A site that really wants to index immediately after content submission can alter these queries.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedActually, that would not be possible without a tag. Should we add a tag to these slave queries so they can be altered? Or automatically run these targetted queries through sql_alter()?
Comment #5
Crell CreditAttribution: Crell commentedhook_query_alter() cannot move a query from one connection object to another. That's bound at creation time. Remember, there's no requirement that two targets even be the same database driver, so it could be an entirely different class for the query object.
Remember that the slave server is disabled for the user that called a node_save() or comment_save() for a few minutes, so an instant-reindex WOULD appear to be instant for them, just not anyone else. For anyone else, they'll get it as soon as the slave catches up.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedMakes good sense.
Comment #7
Dries CreditAttribution: Dries commentedThis looks like unwanted debug code, not?
Comment #8
webchickComment #9
Crell CreditAttribution: Crell commentedUnwanted? Don't be so rude to it. I may not want it, and you may not want it, but I'm sure someone wants that debugging code. Wouldn't you feel bad if someone called you unwanted? Think of what that does to its self-esteem? *sniff*
Comment #10
webchick@Crell: You are a colossal dork. :)
My only hesitation in committing this is that the UX team really very badly wants #504012: Index content when created to get in, and it sounded like this patch would interfere with that. I talked to Crell on IRC about this though, and he pointed out that there would be two ways to address this should that other patch make it in:
The fact that there's a workaround for this works for me, and we can cross that bridge when/if we get to it. It's probably arguable that high-performance sites using M/S replication don't want their content auto-indexed anyway.
Committed to HEAD.