mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
replicated get_lock() properly
This commit is contained in:
parent
b78f8380d5
commit
65a484a10b
3 changed files with 37 additions and 0 deletions
4
mysql-test/r/rpl_get_lock.result
Normal file
4
mysql-test/r/rpl_get_lock.result
Normal file
|
@ -0,0 +1,4 @@
|
|||
get_lock("lock",3)
|
||||
1
|
||||
n
|
||||
1
|
16
mysql-test/t/rpl_get_lock.test
Normal file
16
mysql-test/t/rpl_get_lock.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
source include/master-slave.inc;
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
insert into t1 values(get_lock("lock",2));
|
||||
dirty_close master;
|
||||
connection master1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
select get_lock("lock",3);
|
||||
select * from t1;
|
||||
connection master1;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
|
@ -1399,6 +1399,23 @@ void item_user_lock_free(void)
|
|||
void item_user_lock_release(ULL *ull)
|
||||
{
|
||||
ull->locked=0;
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
THD *thd = current_thd;
|
||||
int save_errno;
|
||||
char buf[256];
|
||||
String tmp(buf,sizeof(buf));
|
||||
tmp.length(0);
|
||||
tmp.append("SELECT release_lock(\"");
|
||||
tmp.append(ull->key,ull->key_length);
|
||||
tmp.append("\")");
|
||||
save_errno=thd->net.last_errno;
|
||||
thd->net.last_errno=0;
|
||||
thd->query_length=tmp.length();
|
||||
Query_log_event qev(thd,tmp.ptr());
|
||||
mysql_bin_log.write(&qev);
|
||||
thd->net.last_errno=save_errno;
|
||||
}
|
||||
if (--ull->count)
|
||||
pthread_cond_signal(&ull->cond);
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue