| 1 |
# |
| 2 |
# WL#3549 |
| 3 |
# |
| 4 |
# Extra tests for binlog compression |
| 5 |
# |
| 6 |
--source include/master-slave.inc |
| 7 |
--source include/have_binlog_format_row.inc |
| 8 |
|
| 9 |
# |
| 10 |
# Test 1: Make sure that SOURCE_POS_WAIT return with success |
| 11 |
# only when the full compressed transaction is applied, otherwise |
| 12 |
# returns an error |
| 13 |
# |
| 14 |
|
| 15 |
--source include/rpl_reset.inc |
| 16 |
|
| 17 |
--source include/rpl_connection_master.inc |
| 18 |
CREATE TABLE t1 (c1 INT); |
| 19 |
CREATE TABLE t2 (c1 INT); |
| 20 |
|
| 21 |
--source include/sync_slave_sql_with_master.inc |
| 22 |
# now lock the table on the slave, so that the slave applier |
| 23 |
# cannot apply the transaction |
| 24 |
LOCK TABLE t2 READ, performance_schema.threads READ; |
| 25 |
|
| 26 |
--source include/rpl_connection_master.inc |
| 27 |
BEGIN; |
| 28 |
INSERT INTO t1 VALUES (1); |
| 29 |
INSERT INTO t2 VALUES (1); |
| 30 |
COMMIT; |
| 31 |
|
| 32 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 33 |
--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 34 |
|
| 35 |
--source include/rpl_connection_slave.inc |
| 36 |
|
| 37 |
# wait for the applier to block on the lock |
| 38 |
--let $wait_condition = SELECT count(*) = 1 FROM performance_schema.threads WHERE processlist_state = "Waiting for table metadata lock" AND name IN ('thread/sql/replica_sql', "thread/sql/replica_worker") |
| 39 |
--source include/wait_condition.inc |
| 40 |
|
| 41 |
# assert that SOURCE_POS_WAIT exits with error |
| 42 |
--let $res= `SELECT SOURCE_POS_WAIT("$binlog_file", $binlog_pos, 1)` |
| 43 |
--let $assert_text= SOURCE_POS_WAIT returns -1 if the timeout has been exceeded. |
| 44 |
--let $assert_cond= $res = -1 |
| 45 |
--source include/assert.inc |
| 46 |
|
| 47 |
# assert that table t2 on the slave have no values in it |
| 48 |
# we do not check t1, since it is in the same transaction |
| 49 |
# and we have not locked it. |
| 50 |
--let $t2_count= `SELECT count(*) FROM t2` |
| 51 |
--let $assert_text= Table t2 on the slave has no records |
| 52 |
--let $assert_cond= $t2_count = 0 |
| 53 |
--source include/assert.inc |
| 54 |
|
| 55 |
# unlock and assert that now tables have the same values |
| 56 |
UNLOCK TABLE; |
| 57 |
|
| 58 |
--let $res= `SELECT SOURCE_POS_WAIT("$binlog_file", $binlog_pos, 5)` |
| 59 |
--let $assert_text= SOURCE_POS_WAIT succeeds. |
| 60 |
--let $assert_cond= $res <> -1 |
| 61 |
--source include/assert.inc |
| 62 |
|
| 63 |
--let $diff_tables=master:test.t1,slave:test.t1 |
| 64 |
--source include/diff_tables.inc |
| 65 |
|
| 66 |
--let $diff_tables=master:test.t2,slave:test.t2 |
| 67 |
--source include/diff_tables.inc |
| 68 |
|
| 69 |
# clean up |
| 70 |
--source include/rpl_connection_master.inc |
| 71 |
DROP TABLE t1, t2; |
| 72 |
--source include/sync_slave_sql_with_master.inc |
| 73 |
--source include/rpl_reset.inc |
| 74 |
|
| 75 |
# end Test 1 |
| 76 |
|
| 77 |
--source include/rpl_end.inc |