Talk shop and learn about MySQL and occasionally some other stores!
Topics and RecordingsLearn From Previous Discussions!
How to JoinSome simple setup help!
Hello everybody!
Join in #DBHangOps this Thursday, April, 30, 2015 at 11:00am pacific (19:00 GMT), to participate in the discussion about:
You can check out the event page at https://plus.google.com/events/csdu8k7bmdmvinojhrm4dbvdgck on Thursday to participate.
As always, you can still watch the #DBHangOps twitter search, the @DBHangOps twitter feed, or this blog post to get a link for the google hangout on Thursday!
See all of you on Thursday!
You can catch a livestream at:
Shlomi is curating an "awesome list" for MySQL software. Check it out at http://shlomi-noach.github.io/awesome-mysql/!
Example heartbeat injection
DROP EVENT IF EXISTS update_heartbeat_event
DELIMITER $$
CREATE EVENT
update_hearbeat_event
ON SCHEDULE EVERY 1 SECOND STARTS CURRENT_TIMESTAMP
ON COMPLETION PRESERVE
ENABLE
DO
INSERT INTO heartbeat
(id, master_ts, update_by)
VALUES (1, NOW(), 'init')
ON DUPLICATE KEY UPDATE master_ts=NOW(), update_by=VALUES(update_by);
$$
Some gotchas:
GET_LOCK
!drop event if exists update_heartbeat_event;
delimiter $$
create event
update_heartbeat_event
on schedule every 1 second starts current_timestamp
on completion preserve
enable
do
begin
DECLARE lock_result INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
/*!50600
SET innodb_lock_wait_timeout = 1;
*/
SET lock_result = GET_LOCK('meta_heartbeat', 0);
IF lock_result = 1 THEN
insert into heartbeat (id, master_ts, update_by) values (1, NOW(), 'event_scheduler') on duplicate key update master_ts=NOW(), update_by=VALUES(update_by);
SET lock_result = RELEASE_LOCK('meta_heartbeat');
END IF;
end
$$
delimiter ;
Seconds_Behind_Master
is a little sucky?
Seconds_Behind_Master
is NULL
, you don't know how genuninely far behind a replica isGET_LOCK()
bug -- https://bugs.mysql.com/bug.php?id=1118Seconds_Behind_Master
vs. Absoluate Lag -- http://code.openark.org/blog/mysql/seconds_behind_master-vs-absolute-slave-lag