| 1 |
# |
| 2 |
# ==== Purpose ==== |
| 3 |
# |
| 4 |
# This test checks that the slave generates and applies binary diffs of partial |
| 5 |
# json events when the binlog option binlog_row_value_options=PARTIAL_JSON on |
| 6 |
# the master side only. |
| 7 |
# It also checks that the binary diffs will only contain the relevant fields |
| 8 |
# when binlog_row_image is set to minimal and even whent he slave has extra |
| 9 |
# columns in the modified table. |
| 10 |
# |
| 11 |
# ==== References ==== |
| 12 |
# |
| 13 |
# BUG#26762675 INNODB: PARTIAL UPDATE DOES NOT PERFORM ON SLAVE SIDE |
| 14 |
# |
| 15 |
|
| 16 |
--source include/have_debug.inc |
| 17 |
--source include/have_debug_sync.inc |
| 18 |
--source include/have_binlog_format_row.inc |
| 19 |
|
| 20 |
--source include/master-slave.inc |
| 21 |
SET @@SESSION.BINLOG_ROW_IMAGE = 'MINIMAL'; |
| 22 |
SET @@SESSION.BINLOG_ROW_VALUE_OPTIONS = 'PARTIAL_JSON'; |
| 23 |
|
| 24 |
CREATE TABLE t1(i INT, j1 JSON, o INT, j2 JSON); |
| 25 |
|
| 26 |
INSERT INTO t1 VALUES(1, '["Apple", "abcdefghijklmnopqghijklmnopqr"]', 2, '["Orange", "abcdefghijklmnopqghijklmnopqr"]'); |
| 27 |
--source include/sync_slave_sql_with_master.inc |
| 28 |
SET @@SESSION.BINLOG_ROW_IMAGE = 'MINIMAL'; |
| 29 |
|
| 30 |
--let $debug_point= rpl_row_jsondiff_binarydiff |
| 31 |
--source include/add_debug_point.inc |
| 32 |
|
| 33 |
--source include/stop_slave_sql.inc |
| 34 |
|
| 35 |
--source include/rpl_connection_master.inc |
| 36 |
--let $diff_tables = master:t1, slave:t1 |
| 37 |
--source include/diff_tables.inc |
| 38 |
|
| 39 |
# execute a statement that generates a partial update log event |
| 40 |
UPDATE t1 SET j1 = JSON_REPLACE(j1, '$[0]', 'Mango'); |
| 41 |
|
| 42 |
--source include/rpl_connection_slave.inc |
| 43 |
--source include/start_slave_sql.inc |
| 44 |
|
| 45 |
# check that the slave generates and applies the corresponding binary diffs |
| 46 |
SET debug_sync= 'now WAIT_FOR signal.rpl_row_jsondiff_binarydiff_created'; |
| 47 |
|
| 48 |
# add an extra column to the table on the slave |
| 49 |
ALTER TABLE t1 ADD u JSON; |
| 50 |
--source include/stop_slave_sql.inc |
| 51 |
--source include/rpl_connection_master.inc |
| 52 |
|
| 53 |
# execute a statement that generates a partial update log event |
| 54 |
UPDATE t1 SET j1 = JSON_REPLACE(j1, '$[0]', 'Fish'); |
| 55 |
|
| 56 |
--source include/rpl_connection_slave.inc |
| 57 |
--source include/start_slave_sql.inc |
| 58 |
|
| 59 |
# check that the slave only marks one column to be added to the binary diff |
| 60 |
SET debug_sync= 'now WAIT_FOR signal.rpl_row_jsondiff_binarydiff_marked_columns'; |
| 61 |
|
| 62 |
#cleanup |
| 63 |
--source include/rpl_connection_master.inc |
| 64 |
DROP TABLE t1; |
| 65 |
--source include/sync_slave_sql_with_master.inc |
| 66 |
--let $debug_point= rpl_row_jsondiff_binarydiff |
| 67 |
--source include/remove_debug_point.inc |
| 68 |
--source include/rpl_end.inc |