Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_load_file_empty_transaction.test

raw
1 # ==== Purpose ====
2 #
3 # Replicated LOAD DATA log event require FILE privilege to apply. This test
4 # checks that lack of privilege does not cause error when the transaction is
5 # skipped due to GTID auto-skip.
6 #
7 # ==== Requirements ====
8 #
9 # FR1. When a LOAD DATA INFILE is replicated in statement format, and the
10 # applier lacks FILE privilege, and the transaction is skipped due to GTID
11 # auto-skip, the statement shall not fail.
12 #
13 # ==== Implementation ====
14 #
15 # 1. Applier user does not have FILE privileges
16 # 2. Issue a LOAD DATA GTID on the source
17 # 3. Commit the same GTID, but empty, on the replica
18 # 4. Watch replication NOT fail because the transaction was filtered.
19 #
20 # ==== References =====
21 #
22 # WL#15032: Validate row format and check privileges after applying replication filters
23 #
24
25 --source include/have_binlog_format_row.inc
26 --source include/master-slave.inc
27
28 #
29 # This test checks that a transaction that a transaction is successfully
30 # skipped on the applier before erroring out due to lack of FILE privileges
31 #
32
33 CREATE TABLE t1 (word CHAR(20) NOT NULL);
34 --let $server_uuid=`SELECT @@GLOBAL.SERVER_UUID`
35 --source include/sync_slave_sql_with_master.inc
36
37 --source include/stop_slave.inc
38 CREATE USER u1;
39 GRANT replication_applier ON *.* TO u1;
40 GRANT session_variables_admin ON *.* TO u1;
41 CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER='u1';
42 --source include/start_slave.inc
43
44 # empty transaction, so the applier skips the load data transaction later on
45 --replace_result $server_uuid SERVER_UUID
46 --eval SET @@SESSION.GTID_NEXT='$server_uuid:2'
47 COMMIT;
48 SET @@SESSION.GTID_NEXT='AUTOMATIC';
49
50 --source include/rpl_connection_master.inc
51 --let $saved_binlog_format=`SELECT @@session.binlog_format`
52 SET @@SESSION.binlog_format='statement';
53
54 --replace_result $server_uuid SERVER_UUID
55 --eval SET @@SESSION.GTID_NEXT='$server_uuid:2'
56 LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
57 SET @@SESSION.GTID_NEXT='AUTOMATIC';
58
59 --replace_result $saved_binlog_format SAVED_BINLOG_FORMAT
60 --eval SET @@SESSION.binlog_format='$saved_binlog_format'
61
62 --source include/sync_slave_sql_with_master.inc
63
64 # if this did not work, the test would fail here
65
66 # clean up
67 --source include/rpl_connection_slave.inc
68 --source include/stop_slave.inc
69 CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER=NULL;
70 DROP USER 'u1';
71 --source include/start_slave.inc
72 --source include/rpl_connection_master.inc
73 DROP TABLE t1;
74 --source include/sync_slave_sql_with_master.inc
75 --source include/rpl_connection_master.inc
76 --source include/rpl_reset.inc
77
78 --source include/rpl_end.inc