Bug #13604 MASTER_POS_WAIT and lock at pos
Submitted: 29 Sep 2005 12:47 Modified: 29 Sep 2005 13:43
Reporter: Martin Friebe (Gold Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:4.1 OS:Any (*)
Assigned to: CPU Architecture:Any

[29 Sep 2005 12:47] Martin Friebe
Description:
It would be nice, if the MASTER_POS_WAIT() could automatically take a lock , *before* the slave can go and execute any sql behind the specified location.

If I do :
select MASTER_POS_WAIT('file', pos, 999); lock table Name_of_table;

the slave can (and likely will) execute further statements before I get the lock.

What I would like to do, in order to check replication is syncronized:

#master
lock table t1;
show master pos;
#slave
LOCK table t1 AFTER MASTER_POS_WAIT(<values from above>);
#master
checksum table t1;
unlock tables;
#slave
checksum table t1;
unlock tables;

checksum should be the same on both,

How to repeat:
-

Suggested fix:
-
[29 Sep 2005 13:37] Guilhem Bichot
Hello,
what you ask for has also been suggested by another user not long ago, so we have it on our long-term TODO. I think that for now you could use the START SLAVE UNTIL command to do the synchronization:
#slave
stop slave sql_thread;
#master
lock table t1;
show master pos;
#slave
start slave sql_thread until (<values from above>);
lock table t1;
#master
checksum table t1;
unlock tables;
#slave
checksum table t1;
unlock tables;
start slave sql_thread;

How does this sound?
[29 Sep 2005 13:43] Martin Friebe
Does exactly what I am looking for,

sorry, didnt research good enough, thanks anyway