Debian Codegraph @

mysql-test/suite/query_rewrite_plugins/r/rpl_skip_rewrite.result

raw
1 include/master-slave.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection master]
6 #
7 # Install plugin and add rewrite rule on replica
8 #
9 include/sync_slave_sql_with_master.inc
10 # Query rewrite plugin was installed.
11 SELECT PLUGIN_NAME, PLUGIN_TYPE, PLUGIN_VERSION, PLUGIN_TYPE_VERSION
12 FROM information_schema.plugins
13 WHERE plugin_name LIKE 'Rewriter';
14 PLUGIN_NAME PLUGIN_TYPE PLUGIN_VERSION PLUGIN_TYPE_VERSION
15 Rewriter AUDIT 0.2 4.1
16 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement)
17 VALUES ('INSERT INTO test.t1 (a,b) VALUES (?, ?)',
18 'INSERT INTO test.t1 (b,a) VALUES (?, ?)');
19 CALL query_rewrite.flush_rewrite_rules();
20 #
21 # Replicated INSERTs not rewritten when PRIVILEGE_CHECKS_USER has
22 # SKIP_QUERY_REWRITE privilege
23 #
24 SET @saved_binlog_format=@@global.binlog_format;
25 Warnings:
26 Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release.
27 SET SESSION binlog_format = 'STATEMENT';
28 Warnings:
29 Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release.
30 include/sync_slave_sql_with_master.inc
31 include/stop_slave.inc
32 CREATE USER 'replication_applier'@'localhost';
33 GRANT SYSTEM_VARIABLES_ADMIN, REPLICATION_APPLIER, CREATE, INSERT, DELETE, SKIP_QUERY_REWRITE on *.* to 'replication_applier'@'localhost';
34 FLUSH PRIVILEGES;
35 CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER='replication_applier'@'localhost';
36 include/start_slave.inc
37 CREATE TABLE test.t1 ( a INT, b INT , c INT, PRIMARY KEY(a));
38 INSERT INTO test.t1 (a, b) VALUES (1, 2);
39 include/sync_slave_sql_with_master.inc
40 #
41 # Replicated INSERTs are not rewritten, so rows at replica match source
42 #
43 include/assert.inc [Replicated INSERT should not be rewritten]
44 #
45 # Replicated INSERTs rewritten when PRIVILEGE_CHECKS_USER does not have
46 # SKIP_QUERY_REWRITE privilege
47 #
48 REVOKE SKIP_QUERY_REWRITE ON *.* FROM 'replication_applier'@'localhost';
49 FLUSH PRIVILEGES;
50 DELETE FROM test.t1;
51 INSERT INTO test.t1 (a, b) VALUES (3, 4);
52 include/sync_slave_sql_with_master.inc
53 #
54 # Replicated INSERTs are rewritten, so rows at replica do not match source
55 #
56 include/assert.inc [Replicated INSERT should be rewritten]
57 #
58 # Replicated INSERTs not rewritten when PRIVILEGE_CHECKS_USER = NULL and
59 # rewriter_enabled_for_threads_without_privilege_checks = OFF
60 #
61 SET GLOBAL rewriter_enabled_for_threads_without_privilege_checks = OFF;
62 include/stop_slave.inc
63 CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = NULL;
64 include/start_slave.inc
65 DELETE FROM test.t1;
66 INSERT INTO test.t1 (a, b) VALUES (5, 6);
67 include/sync_slave_sql_with_master.inc
68 #
69 # Replicated INSERTs are not rewritten, so rows at replica match source
70 #
71 include/assert.inc [Replicated INSERT should not be rewritten]
72 #
73 # Replicated INSERTs rewritten when PRIVILEGE_CHECKS_USER = NULL and
74 # rewriter_enabled_for_threads_without_privilege_checks = ON
75 #
76 SET GLOBAL rewriter_enabled_for_threads_without_privilege_checks = ON;
77 DELETE FROM test.t1;
78 INSERT INTO test.t1 (a, b) VALUES (7, 8);
79 include/sync_slave_sql_with_master.inc
80 #
81 # Replicated INSERTs are rewritten, so rows at replica do not match source
82 #
83 include/assert.inc [Replicated INSERT should be rewritten]
84 #
85 # Cleanup and uninstall plugin.
86 #
87 DROP USER 'replication_applier'@'localhost';
88 SET GLOBAL rewriter_enabled_for_threads_without_privilege_checks = DEFAULT;
89 DROP TABLE test.t1;
90 SET GLOBAL binlog_format=@saved_binlog_format;
91 Warnings:
92 Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release.
93 include/sync_slave_sql_with_master.inc
94 SET GLOBAL rewriter_enabled_for_threads_without_privilege_checks = DEFAULT;
95 Warnings:
96 Warning 1620 Plugin is busy and will be uninstalled on shutdown
97 # Query rewrite plugin was queued for uninstalling.
98 include/rpl_end.inc