Commit 3c97d24f authored by unknown's avatar unknown

MDEV-4984: Implement MASTER_GTID_WAIT() and @@LAST_GTID.

Couple of small fixes following buildbot testing.
parent 7bb022f3
...@@ -40,7 +40,8 @@ if (!$_slave_timeout) ...@@ -40,7 +40,8 @@ if (!$_slave_timeout)
if ($_result == -1) if ($_result == -1)
{ {
--let $_current_gtid_pos= `SELECT @@GLOBAL.gtid_slave_pos` --let $_current_gtid_pos= `SELECT @@GLOBAL.gtid_slave_pos`
--die Timeout in master_gtid_wait('$master_pos', $_slave_timeout), current slave GTID position is: $_current_gtid_pos. --echo Timeout in master_gtid_wait('$master_pos', $_slave_timeout), current slave GTID position is: $_current_gtid_pos.
--die Failed to sync with master
} }
--let $include_filename= sync_with_master_gtid.inc --let $include_filename= sync_with_master_gtid.inc
......
...@@ -272,7 +272,7 @@ SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); ...@@ -272,7 +272,7 @@ SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110');
SELECT master_gtid_wait('0-1-1000', 0.5); SELECT master_gtid_wait('0-1-1000', 0.5);
SELECT master_gtid_wait('0-1-2000'); SELECT master_gtid_wait('0-1-2000');
SELECT master_gtid_wait('2-1-10'); SELECT master_gtid_wait('2-1-10');
SELECT master_gtid_wait('2-1-5', 1); SELECT master_gtid_wait('2-1-6', 1);
SELECT master_gtid_wait('2-1-5'); SELECT master_gtid_wait('2-1-5');
SELECT master_gtid_wait('2-1-10'); SELECT master_gtid_wait('2-1-10');
SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110');
...@@ -284,14 +284,14 @@ SELECT master_gtid_wait('0-1-109'); ...@@ -284,14 +284,14 @@ SELECT master_gtid_wait('0-1-109');
SELECT master_gtid_wait('2-1-2', 0.5); SELECT master_gtid_wait('2-1-2', 0.5);
master_gtid_wait('2-1-2', 0.5) master_gtid_wait('2-1-2', 0.5)
-1 -1
KILL QUERY 22; KILL QUERY KILL_ID;
ERROR 70100: Query execution was interrupted ERROR 70100: Query execution was interrupted
SET gtid_domain_id=2; SET gtid_domain_id=2;
SET gtid_seq_no=2; SET gtid_seq_no=2;
INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (4);
master_gtid_wait('2-1-2') master_gtid_wait('2-1-2')
0 0
KILL CONNECTION 25; KILL CONNECTION KILL_ID;
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
SET gtid_domain_id=1; SET gtid_domain_id=1;
SET gtid_seq_no=4; SET gtid_seq_no=4;
...@@ -305,8 +305,8 @@ master_gtid_wait('2-1-1,1-1-4,0-1-110') ...@@ -305,8 +305,8 @@ master_gtid_wait('2-1-1,1-1-4,0-1-110')
0 0
master_gtid_wait('0-1-1000', 0.5) master_gtid_wait('0-1-1000', 0.5)
-1 -1
master_gtid_wait('2-1-5', 1) master_gtid_wait('2-1-6', 1)
0 -1
master_gtid_wait('0-1-109') master_gtid_wait('0-1-109')
0 0
SET gtid_domain_id=2; SET gtid_domain_id=2;
......
...@@ -287,7 +287,7 @@ send SELECT master_gtid_wait('0-1-2000'); ...@@ -287,7 +287,7 @@ send SELECT master_gtid_wait('0-1-2000');
send SELECT master_gtid_wait('2-1-10'); send SELECT master_gtid_wait('2-1-10');
--connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,) --connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
send SELECT master_gtid_wait('2-1-5', 1); send SELECT master_gtid_wait('2-1-6', 1);
# This one we will kill also. # This one we will kill also.
--connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,) --connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
...@@ -314,6 +314,7 @@ send SELECT master_gtid_wait('0-1-109'); ...@@ -314,6 +314,7 @@ send SELECT master_gtid_wait('0-1-109');
# This one should time out. # This one should time out.
SELECT master_gtid_wait('2-1-2', 0.5); SELECT master_gtid_wait('2-1-2', 0.5);
--replace_result $kill1_id KILL_ID
eval KILL QUERY $kill1_id; eval KILL QUERY $kill1_id;
--connection s3 --connection s3
--error ER_QUERY_INTERRUPTED --error ER_QUERY_INTERRUPTED
...@@ -328,6 +329,7 @@ INSERT INTO t1 VALUES (4); ...@@ -328,6 +329,7 @@ INSERT INTO t1 VALUES (4);
reap; reap;
--connection server_2 --connection server_2
--replace_result $kill2_id KILL_ID
eval KILL CONNECTION $kill2_id; eval KILL CONNECTION $kill2_id;
--connection s6 --connection s6
......
--source include/not_embedded.inc
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@global.last_gtid; SELECT @@global.last_gtid;
......
...@@ -1792,7 +1792,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, ...@@ -1792,7 +1792,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
bool timed_out= false; bool timed_out= false;
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
queue_element elem; queue_element elem;
uint32_t domain_id= wait_gtid->domain_id; uint32 domain_id= wait_gtid->domain_id;
uint64 seq_no= wait_gtid->seq_no; uint64 seq_no= wait_gtid->seq_no;
hash_element *he; hash_element *he;
rpl_slave_state::element *slave_state_elem= NULL; rpl_slave_state::element *slave_state_elem= NULL;
...@@ -1958,10 +1958,6 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, ...@@ -1958,10 +1958,6 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
thd_wait_end(thd); thd_wait_end(thd);
} }
if (elem.wakeup_reason == queue_element::DONE)
break;
takeover= true;
if (thd->killed || timed_out) if (thd->killed || timed_out)
{ {
remove_from_wait_hash(he, &elem); remove_from_wait_hash(he, &elem);
...@@ -1975,6 +1971,10 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid, ...@@ -1975,6 +1971,10 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
thd->send_kill_message(); thd->send_kill_message();
break; break;
} }
if (elem.wakeup_reason == queue_element::DONE)
break;
takeover= true;
} }
if (did_enter_cond) if (did_enter_cond)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment