# ==== Purpose ==== # # #R1. Multi-table UPDATE statements must generate partial JSON for all # # involved tables where it is possible. # # This does not work yet! It only generates partial JSON for the first # # table. So we do not verify this. # # R2. Slave must apply multi-table partial JSON updates correctly. # # ==== Implementation ==== # # Execute the following scenarios of two-table updates: # 1. Both tables can use partial updates # 2. Only first table can use partial updates # 3. Only second table can use partial updates # 4. Neither table can use partial updates # # ==== Related Worklog ==== # # WL#2955: RBR replication of partial JSON updates --source include/have_binlog_format_row.inc --source include/master-slave.inc --echo ######## Configure ######## SET @@SESSION.BINLOG_ROW_IMAGE = 'MINIMAL'; SET @@SESSION.BINLOG_ROW_VALUE_OPTIONS = 'PARTIAL_JSON'; --source include/rpl_connection_slave.inc SET @old_binlog_row_image= @@GLOBAL.BINLOG_ROW_IMAGE; SET @old_binlog_row_value_options= @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS; SET @@GLOBAL.BINLOG_ROW_IMAGE = 'MINIMAL'; SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS = 'PARTIAL_JSON'; --source include/stop_slave.inc --source include/start_slave.inc --echo ######## Initialize ######## --source include/rpl_connection_master.inc CREATE TABLE t1 (i INT PRIMARY KEY, j JSON); CREATE TABLE t2 (i INT PRIMARY KEY, j JSON); INSERT INTO t1 VALUES (1, '["a-1", "b-1"]'); INSERT INTO t2 VALUES (1, '["c-1", "d-1"]'); --source include/sync_slave_sql_with_master.inc --echo ######## Test ######## --source include/rpl_connection_master.inc --echo # Both tables with partial update UPDATE t1, t2 SET t1.j= JSON_SET(t1.j, '$[0]', 'a-2'), t2.j= JSON_SET(t2.j, '$[0]', 'c-2'); --source include/sync_slave_sql_with_master.inc --source include/rpl_connection_master.inc --let $diff_tables= master:t1, slave:t1 --source include/diff_tables.inc --let $diff_tables= master:t2, slave:t2 --source include/diff_tables.inc --echo # First table partial update, second table full update UPDATE t1, t2 SET t1.j= JSON_SET(t1.j, '$[0]', 'a-3'), t2.j= '["c-3", "d-1"]'; --source include/sync_slave_sql_with_master.inc --source include/rpl_connection_master.inc --let $diff_tables= master:t1, slave:t1 --source include/diff_tables.inc --let $diff_tables= master:t2, slave:t2 --source include/diff_tables.inc --echo # First table full update, second table partial update UPDATE t1, t2 SET t1.j= '["a-4", "b-1"]', t2.j= JSON_SET(t2.j, '$[0]', 'c-4'); --source include/sync_slave_sql_with_master.inc --source include/rpl_connection_master.inc --let $diff_tables= master:t1, slave:t1 --source include/diff_tables.inc --let $diff_tables= master:t2, slave:t2 --source include/diff_tables.inc --echo # Both tables with full update UPDATE t1, t2 SET t1.j= '["a-5", "b-1"]', t2.j= '["c-5", "d-1"]'; --source include/sync_slave_sql_with_master.inc --source include/rpl_connection_master.inc --let $diff_tables= master:t1, slave:t1 --source include/diff_tables.inc --let $diff_tables= master:t2, slave:t2 --source include/diff_tables.inc --echo ######## Clean up ######## DROP TABLE t1, t2; --source include/sync_slave_sql_with_master.inc SET @@GLOBAL.BINLOG_ROW_VALUE_OPTIONS= @old_binlog_row_value_options; SET @@GLOBAL.BINLOG_ROW_IMAGE= @old_binlog_row_image; --source include/rpl_end.inc