File: rpl_load_file_empty_transaction.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (78 lines) | stat: -rw-r--r-- 2,560 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# ==== Purpose ====
#
# Replicated LOAD DATA log event require FILE privilege to apply. This test
# checks that lack of privilege does not cause error when the transaction is
# skipped due to GTID auto-skip.
#
# ==== Requirements ====
#
# FR1. When a LOAD DATA INFILE is replicated in statement format, and the
#      applier lacks FILE privilege, and the transaction is skipped due to GTID
#      auto-skip, the statement shall not fail.
#
# ==== Implementation ====
#
# 1. Applier user does not have FILE privileges
# 2. Issue a LOAD DATA GTID on the source
# 3. Commit the same GTID, but empty, on the replica
# 4. Watch replication NOT fail because the transaction was filtered.
#
# ==== References =====
#
# WL#15032: Validate row format and check privileges after applying replication filters
#

--source include/have_binlog_format_row.inc
--source include/master-slave.inc

#
# This test checks that a transaction that a transaction is successfully
# skipped on the applier before erroring out due to lack of FILE privileges
#

CREATE TABLE t1 (word CHAR(20) NOT NULL);
--let $server_uuid=`SELECT @@GLOBAL.SERVER_UUID`
--source include/sync_slave_sql_with_master.inc

--source include/stop_slave.inc
CREATE USER u1;
GRANT replication_applier ON *.* TO u1;
GRANT session_variables_admin ON *.* TO u1;
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER='u1';
--source include/start_slave.inc

# empty transaction, so the applier skips the load data transaction later on
--replace_result $server_uuid SERVER_UUID
--eval SET @@SESSION.GTID_NEXT='$server_uuid:2'
COMMIT;
SET @@SESSION.GTID_NEXT='AUTOMATIC';

--source include/rpl_connection_master.inc
--let $saved_binlog_format=`SELECT @@session.binlog_format`
SET @@SESSION.binlog_format='statement';

--replace_result $server_uuid SERVER_UUID
--eval SET @@SESSION.GTID_NEXT='$server_uuid:2'
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SET @@SESSION.GTID_NEXT='AUTOMATIC';

--replace_result $saved_binlog_format SAVED_BINLOG_FORMAT
--eval SET @@SESSION.binlog_format='$saved_binlog_format'

--source include/sync_slave_sql_with_master.inc

# if this did not work, the test would fail here

# clean up
--source include/rpl_connection_slave.inc
--source include/stop_slave.inc
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER=NULL;
DROP USER 'u1';
--source include/start_slave.inc
--source include/rpl_connection_master.inc
DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc
--source include/rpl_connection_master.inc
--source include/rpl_reset.inc

--source include/rpl_end.inc