PDA

View Full Version : Master / Slave Database Improvements?


eoc_Jason
Wed 16th Aug '06, 12:57pm
Can someone tell me what the improvements are for vB 3.6.0 in relation to the listed "Improved master / slave database support"?

My main question is this... Is there logic in the code so that when a person makes a new post / thread, do they stay sticky to the master server so their reply will show up if the page has to be refreshed or does it just blindly go to the slave server for all read requests?

The issue I have is that searching can take a couple minutes (4.3 million posts) and if the slave server has a read lock on the post table obviously new posts won't be updated on it right away. So when a person creates a new thread if the slave db hasn't updated, wouldn't that cause an error?

eoc_Jason
Thu 17th Aug '06, 11:11am
Not going to get an answer to this am I?

Steve Machol
Thu 17th Aug '06, 2:38pm
I don't know but I'll see if I can get someone to answer.

eoc_Jason
Fri 18th Aug '06, 11:39am
Thanks Steve, I would really appreciate it.

Scott MacVicar
Fri 18th Aug '06, 12:03pm
Only certain queries that wont cause inconsistentices are sent to the slave. This means that most of the post and thread stuff are on the master apart from those where a long wait or slightly incorrect data doesn't matter.

At the moment reads for posts on showthread always go to the master, I've yet to devise a nice way to look at the lag time between the master and slave and use the appropriate table.

eoc_Jason
Sat 19th Aug '06, 1:45pm
Does searching use the slave db? If not is there an easy way to have it do so?

wildweasel
Mon 28th Aug '06, 6:38am
Does searching use the slave db? If not is there an easy way to have it do so?


up

WW

Dontom
Tue 5th Sep '06, 2:41am
Does searching use the slave db? If not is there an easy way to have it do so?
same question here - we want to send all earches to the slave, what is the easiest way to do this?
thanks

Zachery
Tue 5th Sep '06, 2:42am
Under the slave config wrap it in

if (THIS_SCRIPT == search.php)
{



}

Dontom
Thu 7th Sep '06, 3:31am
Under the slave config wrap it in

if (THIS_SCRIPT == search.php)
{



}

it must be search, not search.php.

Zachery
Thu 7th Sep '06, 3:46am
My bad, I was writing it quickly

Dontom
Fri 8th Sep '06, 12:04pm
My bad, I was writing it quickly

ok, we tried it - the suggested approach has one disadvantage / causes one problem:
the searchid is inserted into the slave, so the databases are out of sync. When you execute only one search on the master-db you will get a duplicate key error and the slave stops replicating itself.

I will try to hack search.php, so it runs against the master and only the fulltext-search itself is executed on the slave.

Thomas

Scott MacVicar
Fri 8th Sep '06, 12:14pm
Searches are sent against the slave database in 3.6, you dont need to make any changes in config.php etc.

You do however need to change dbtype in config.php to either mysql_slave or mysqli_slave

Dontom
Fri 8th Sep '06, 8:17pm
thanks for the clarification - will upgrade to 3.6 then
Thomas