Here's a patch for adminmail. The problem is when it checks reader
db's, and the site's either low traffic, or hasn't had any early morning hits.
When this happens, the comparison the accesslog makes adminmail
think the slave db's are too far behind.
Note that you'll also have to append a var insert
INSERT INTO vars (name, value, description) VALUES
('db_replication_lowtraffic', '', 'If your site is low traffic, do not compare
early-morning accesslog data to decide if db-readers are behind, but
instead use SHOW SLAVE STATUS::Seconds_Behind_Master');
The patch keys off that var. if it's set, it loops through the defined alive
readers, and checks SHOW SLAVE STATUS.
If that's behind N seconds (I chose 5, but that's probably way, way too
high) then it'll errorlog and exit.
Note that I stole the sub get_readers from the balance_readers task, and
like the comments in it say, that probably should really be in Static/
MySQL.pm
I tested this on lottadot, and it seems to be doing the job intended.
Shane
dbpatch.txt
Logged In: YES
user_id=3889
Seconds_Behind_Master only became available somewhere in MySQL
4.1.
If you want a horrendously complicated way to check how far a slave is
behind the master, that also works in 4.0, there's more nasty code in
balance_readers.
Logged In: YES
user_id=52587
so are you saying i should add code that checks the mysql version # and
resubmit the patch?
or that because it's only in 4.1 you guys wouldn't accept the patch at all?
i saw the balance_readers this morning while looking around when i was
writing the patch. i was infact wondering why you went through all that
trouble in there. now i realize why.