Bug #87206 flow control variables are not validated passed as cmd line during server start
Submitted: 26 Jul 2017 13:22 Modified: 15 Sep 2017 14:50
Reporter: Ganapati Sabhahit Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Group Replication Severity:S3 (Non-critical)
Version:8.0.3 OS:Any
Assigned to: CPU Architecture:Any

[26 Jul 2017 13:22] Ganapati Sabhahit
Description:
Eventhough the server is started with incorrect values(min quota value is larger than max quota) for group_replication_flow_control_max_quota, group_replication_flow_control_min_quota variables, I am able to start the group replication.

The same operation to set the same values is not allowed once the server is started.

How to repeat:
Test steps :
1. Initialize and start gr with --group_replication_flow_control_max_quota=10 --group_replication_flow_control_min_quota=20
(min quota value is more than max quota)
./bin/mysqld --no-defaults --datadir=$PWD/d10 --basedir=$PWD --initialize-insecure

./bin/mysqld --no-defaults --basedir=$PWD --datadir=$PWD/d10 --log-bin=mysql-bin10.log --port=19920 --socket=/tmp/mysqld10.sock --server-id=10 --enforce-gtid-consistency --gtid-mode=on --log-slave-updates --binlog-format=row --transaction-write-set-extraction=MURMUR32 --binlog-checksum=NONE --master-info-repository=TABLE --relay_log_info_repository=TABLE --plugin-load=group_replication.so --plugin-dir=lib/plugin --relay-log-recovery=on --relay-log=server-relay-log10 --group_replication_components_stop_timeout=30 --group_replication_recovery_reconnect_interval=10 --group_replication_recovery_retry_count=5 --group_replication_allow_local_lower_version_join=OFF --group_replication_auto_increment_increment=7 --group_replication_group_name='aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' --group_replication_start_on_boot=OFF --group_replication_group_seeds="127.0.0.1:10300,127.0.0.1:10301,127.0.0.1:10302,127.0.0.1:10303,127.0.0.1:10304,127.0.0.1:10305,127.0.0.1:10306,127.0.0.1:10307,127.0.0.1:10308" --rpl_stop_slave_timeout=30 --lock_wait_timeout=30 --innodb_lock_wait_timeout=10 --report-host=localhost --group_replication_local_address="127.0.0.1:10308" --group_replication_bootstrap_group=Off --group_replication_start_on_boot=Off --group_replication_single_primary_mode=OFF --group_replication_enforce_update_everywhere_checks=ON --group_replication_flow_control_max_quota=10 --group_replication_flow_control_min_quota=20

2. Check the flow control variables
mysql> show variables like "%group_replication_flow_control_%";
+-----------------------------------------------------+-------+
| Variable_name                                       | Value |
+-----------------------------------------------------+-------+
| group_replication_flow_control_applier_threshold    | 25000 |
| group_replication_flow_control_certifier_threshold  | 25000 |
| group_replication_flow_control_hold_percent         | 10    |
| group_replication_flow_control_max_quota            | 10    |
| group_replication_flow_control_member_quota_percent | 0     |
| group_replication_flow_control_min_quota            | 20    |
| group_replication_flow_control_min_recovery_quota   | 0     |
| group_replication_flow_control_mode                 | QUOTA |
| group_replication_flow_control_period               | 1     |
| group_replication_flow_control_release_percent      | 50    |
+-----------------------------------------------------+-------+
10 rows in set (0.02 sec)

3. Bootstrap the server and start the gr and check the variable values
mysql> set global group_replication_bootstrap_group=on;
Query OK, 0 rows affected (0.01 sec)

mysql> start group_replication;
Query OK, 0 rows affected (2.12 sec)

mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 69134139-7204-11e7-8e3a-0021f62e972b | localhost   |       19920 | ONLINE       | PRIMARY     | 8.0.3          |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
1 row in set (0.00 sec)

mysql> show variables like "%group_replication_flow_control_%";
+-----------------------------------------------------+-------+
| Variable_name                                       | Value |
+-----------------------------------------------------+-------+
| group_replication_flow_control_applier_threshold    | 25000 |
| group_replication_flow_control_certifier_threshold  | 25000 |
| group_replication_flow_control_hold_percent         | 10    |
| group_replication_flow_control_max_quota            | 10    |
| group_replication_flow_control_member_quota_percent | 0     |
| group_replication_flow_control_min_quota            | 20    |
| group_replication_flow_control_min_recovery_quota   | 0     |
| group_replication_flow_control_mode                 | QUOTA |
| group_replication_flow_control_period               | 1     |
| group_replication_flow_control_release_percent      | 50    |
+-----------------------------------------------------+-------+
10 rows in set (0.01 sec)

mysql>

4. If you try to set the same values for min and max quota it fails

mysql> set global group_replication_flow_control_max_quota=10;
ERROR 1231 (42000): Variable 'group_replication_flow_control_max_quota' can't be set to the value of '10'
mysql> set global group_replication_flow_control_min_quota=20;
ERROR 1231 (42000): Variable 'group_replication_flow_control_min_quota' can't be set to the value of '20'
mysql> set global group_replication_flow_control_min_quota=25;
ERROR 1231 (42000): Variable 'group_replication_flow_control_min_quota' can't be set to the value of '25'
mysql> set global group_replication_flow_control_max_quota=15;
ERROR 1231 (42000): Variable 'group_replication_flow_control_max_quota' can't be set to the value of '15'

Note : The extensive check for all the gr variables needs to be done on validation part when the variables are passed as command line.
This has been found while testing the behavior of some new upcoming group replication variable.

Suggested fix:
The value set should be validated either during the startup or as part of start group replication and it should block the start group replication.
[15 Sep 2017 14:50] David Moss
Posted by developer:
 
Thank you for your feedback, this has been fixed in upcoming versions and the following was added to the 8.0.3 changelog:
It was possible to start the server with invalid values for the Group Replication flow control options. Now, the --group-replication-flow-control-min-quota, --group-replication-flow-control-max-quota, and --group-replication-flow-control-min-recovery-quota options are validated on server startup.