Bug #85781 GR ALLOWS OPERATIONS ON NON-COMPLAINT TABLES THROUGH MYSQLBINLOG
Submitted: 4 Apr 2017 12:32 Modified: 18 Sep 2017 10:07
Reporter: Dhruthi Komarlu Vasudeva Murthy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Group Replication Severity:S3 (Non-critical)
Version:5.7.19 OS:Any
Assigned to: CPU Architecture:Any

[4 Apr 2017 12:32] Dhruthi Komarlu Vasudeva Murthy
Description:
GR doesn't block operations on tables which are non-complaint when we apply it through mysqlbinlog.

Scenario: 
1. Bootstrap start GR on S1.
2. Create a table without PK on S2, insert some values.
   Save mysqlbinlog output to a file.
3. Try executing mysqlbinlog output of S2 on S1(S1 is part of group)
   Note that S1 allows operations on table without primary key. which should
   be blocked.
   Same scenario can be checked for table with Myisam storage engine etc.,

 Note that if binlog_format=statement on S2, on applying mysqlbinlog output
 on S1, it will error out as expected.

How to repeat:
$cat gr_mysqlbinlog.test

################################################################################
# GR allows operations non-complaint tables when executed through mysqlbinlog.
#
# Test:
# 0. This test requires 2 servers.
# 1. Bootstrap start GR on S1.
# 2. Create a table without PK on S2, insert some values.
#    Save mysqlbinlog output to a file.
# 3. Try executing mysqlbinlog output of S2 on S1(it is part of group)
#    Note that S1 allows operations on table without primary key. which should
#    be blocked.
#    Same scenario can be checked for table with Myisam storage engine etc.,
#
# Note that if binlog_format=statement on S2, on applying mysqlbinlog output
# on S1 will error out as expected.
################################################################################

--source ../inc/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source ../inc/group_replication.inc

--echo # Bootstrap start GR on server1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source ../inc/start_and_bootstrap_group_replication.inc

--echo # Create table without primary key on S2, do some operations
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
CREATE TABLE test.t1 (c1 INT );
INSERT INTO test.t1 VALUES (1);

--echo # Save mysqlbinlog output in a file
--let $server2_datadir= `SELECT @@DATADIR`
--let $server2_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--exec $MYSQL_BINLOG --force-if-open $server2_datadir/$server2_binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_grtest.binlog

--echo # Try executing mysqlbinlog output of S2 on S1.
--echo # S1 should block operations on t1 (without PK), but it sucessfully allows
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--let $server1_connection_args= --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_1
--exec $MYSQL $server1_connection_args -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_grtest.binlog"

select @@global.gtid_executed;

select * from t1;

--query_vertical select * from performance_schema.replication_group_member_stats

# Clean up.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc

# Remove binlog file which is not required now
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_grtest.binlog
DROP TABLE test.t1;

--source ../inc/group_replication_end.inc
[18 Sep 2017 10:07] David Moss
Posted by developer:
 
Thank you for your feedback, this has been fixed in upcoming versions. The fix was part of bug#25609945 and was added to the 8.0.3 changelog.