Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_image_check_for_insert_select.test

raw
1 # ==== Purpose ====
2 #
3 # Verify that INSERT..SELECT query is logged as a row event and honors
4 # binlog_row_image= FULL when binlog_format=MIXED with transaction isolation
5 # level set to READ-COMMITTED.
6 #
7 # ==== Implementation ====
8 #
9 # 1. Initial setup includes setting the transaction isolation level to
10 # 'READ-COMMITTED' on master and setting binlog_row_image = FULL using
11 # rpl_row_img_set.inc.
12 # 2. Create two tables with same structure and insert a row into a table.
13 # 3. Verify that INSERT..SELECT query is logged with full image on both master
14 # and slave with the use of rpl_row_img_parts_master_slave.inc file.
15 #
16 # Note: Please see rpl_row_img_set.inc and rpl_row_img_parts_master_slave.inc
17 # for more details.
18 #
19 # ==== References ====
20 #
21 # Bug#29110804: BINLOG_ROW_IMAGE=FULL NOT ALWAYS HONOURED FOR BINROW_FORMAT=MIXED
22
23 --source include/have_binlog_format_mixed.inc
24 --source include/master-slave.inc
25
26 # Save the value binlog_row_image
27 SET @old_binlog_row_image= @@binlog_row_image;
28 --source include/rpl_connection_slave.inc
29 SET @old_binlog_row_image= @@binlog_row_image;
30 --source include/rpl_connection_master.inc
31
32 --echo # 1. Initial setup includes setting the transaction isolation level to
33 --echo # 'READ-COMMITTED' on master and setting binlog_row_image = FULL using
34 --echo # rpl_row_img_set.inc.
35
36 SET @old_transaction_isolation= @@session.transaction_isolation;
37 SET SESSION transaction_isolation='READ-COMMITTED';
38
39 --echo # Set the binlog_row_image to FULL on both master and slave.
40 --let $row_img_set=master:FULL:N,slave:FULL:Y
41 --source include/rpl_row_img_set.inc
42
43 --echo #
44 --echo # 2. Create two tables with same structure and insert a row into a table.
45 --echo #
46 CREATE DATABASE a;
47 CREATE DATABASE b;
48
49 CREATE TABLE a.test (id INT PRIMARY KEY, name VARCHAR(50) DEFAULT NULL, age BIGINT)ENGINE=InnoDB;
50 CREATE TABLE b.test (id INT PRIMARY KEY, name VARCHAR(50) DEFAULT NULL, age BIGINT)ENGINE=InnoDB;
51
52 --source include/sync_slave_sql_with_master.inc
53
54 --echo #
55 --echo # 3. Verify that INSERT..SELECT query is logged with full image on both
56 --echo # master and slave with the use of rpl_row_img_parts_master_slave.inc
57 --echo # file.
58 --echo #
59 --source include/rpl_connection_master.inc
60 --let $row_img_query= INSERT INTO a.test(id, age) VALUES (1,5)
61 --let $row_img_expected_master= | 1:1 2:NULL 3:5
62 --let $row_img_expected_slave = | 1:1 2:NULL 3:5
63 --source include/rpl_row_img_parts_master_slave.inc
64
65 --let $row_img_query= INSERT INTO b.test(id,age) SELECT id , age FROM a.test
66 --let $row_img_expected_master= | 1:1 2:NULL 3:5
67 --let $row_img_expected_slave = | 1:1 2:NULL 3:5
68 --source include/rpl_row_img_parts_master_slave.inc
69
70 # CLEAN UP
71 DROP DATABASE a;
72 DROP DATABASE b;
73 --source include/sync_slave_sql_with_master.inc
74
75 --source include/rpl_connection_master.inc
76 SET GLOBAL binlog_row_image= @old_binlog_row_image;
77 SET SESSION binlog_row_image= @old_binlog_row_image;
78 SET SESSION transaction_isolation= @old_transaction_isolation;
79
80 --source include/rpl_connection_slave.inc
81 SET GLOBAL binlog_row_image= @old_binlog_row_image;
82 SET SESSION binlog_row_image= @old_binlog_row_image;
83
84 --source include/rpl_end.inc