Bug #75449 mysqlrpladmin switchover should allow different replication filters
Submitted: 8 Jan 2015 16:35 Modified: 9 Jan 2015 9:53
Reporter: Ed Dawley Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities Severity:S3 (Non-critical)
Version:1.5.3 OS:Any
Assigned to: CPU Architecture:Any

[8 Jan 2015 16:35] Ed Dawley
Description:
When attempting a mysqlrpladmin switchover, the command will fail to run if any slave has different replication filters.  In general this is a good check, but there are valid use cases for having some slaves only replicate a subset of tables.  As long as all DML is written appropriately, such a setup works just fine.  Really the check needs to ensure that *only* the candidate master has the same replication filters.  Other slaves should not check filters.

The only workaround at the moment is to specify --force but that turns off all error checking which is undesirable.   

How to repeat:
Create a topology with a slave replicating a subset of tables.

mysqlrpladmn switchover ....

# Checking candidate slave prerequisites.
Master and slave filters differ.
ERROR: Master and slave filters differ.
# Errors found. Switchover aborted.  

Suggested fix:
mysql/utilities/common/topology::_check_candidate_eligibility() should only abort if the master candidate has differing replication filters.
[9 Jan 2015 9:53] MySQL Verification Team
Hello Ed D,

Thank you for the report.
For contribution, please sign the OCA, so that we can consider taking your patch if provided. Please see the following for more details: http://www.oracle.com/technetwork/community/oca-486395.html

Thanks,
Umesh
[9 Jan 2015 9:53] MySQL Verification Team
//

[root@cluster-repo mysql-utilities-1.5.3]#   scripts/mysqlrpladmin.py --master=ushastry@localhost:15000  --slave=ushastry@localhost:15001 --new-master=ushastry@localhost:15001 --format=vertical --demote-master switchover
WARNING: Using a password on the command line interface can be insecure.
WARNING: The --format option is not required for 'switchover' (option ignored). Only used with the health or gtid command.
# Checking privileges.
# WARNING: You may be mixing host names and IP addresses. This may result in negative status reporting if your DNS services do not support reverse name lookup.
# WARNING: Errant transactions check skipped (GTID not enabled for the whole topology).
# Performing switchover from master at localhost:15000 to slave at localhost:15001.
# Checking candidate slave prerequisites.
Master and slave filters differ.
ERROR: Master and slave filters differ.
# Errors found. Switchover aborted.
#
# Replication Topology Health:
+------------+--------+---------+--------+------------+-------------------------------------------+
| host       | port   | role    | state  | gtid_mode  | health                                    |
+------------+--------+---------+--------+------------+-------------------------------------------+
| localhost  | 15000  | MASTER  | UP     | OFF        | OK                                        |
| localhost  | 15001  | SLAVE   | UP     | OFF        | Binary log and Relay log filters differ.  |
+------------+--------+---------+--------+------------+-------------------------------------------+
# ...done.
[9 Jan 2015 9:55] MySQL Verification Team
// verbose mode

[root@cluster-repo mysql-utilities-1.5.3]#   scripts/mysqlrpladmin.py --master=ushastry@localhost:15000  --slave=ushastry@localhost:15001 --new-master=ushastry@localhost:15001 -vv --format=vertical --demote-master switchover
WARNING: Using a password on the command line interface can be insecure.
WARNING: The --format option is not required for 'switchover' (option ignored). Only used with the health or gtid command.
# Checking privileges.
# WARNING: You may be mixing host names and IP addresses. This may result in negative status reporting if your DNS services do not support reverse name lookup.
# WARNING: Errant transactions check skipped (GTID not enabled for the whole topology).
# Performing switchover from master at localhost:15000 to slave at localhost:15001.
# Checking candidate slave prerequisites.
# Checking eligibility of slave localhost:15001 for candidate.
#   Slave connected to master ... Ok
#   Slave not behind master ... Ok
# Filter Check Failed.
+---------+-----------+--------------+
| role    | *_do_db   | *_ignore_db  |
+---------+-----------+--------------+
| master  | foo,foo1  |              |
| SLAVE   |           |              |
+---------+-----------+--------------+
#   Logging filters agree ... FAIL
Master and slave filters differ.
ERROR: Master and slave filters differ.
# Errors found. Switchover aborted.
# Attempting to contact localhost ... Success
# Filter Check Failed.
+---------+-----------+--------------+
| role    | *_do_db   | *_ignore_db  |
+---------+-----------+--------------+
| master  | foo,foo1  |              |
| SLAVE   |           |              |
+---------+-----------+--------------+
# Attempting to contact localhost ... Success
#
# Replication Topology Health:
+------------+--------+---------+--------+------------+-------------------------------------------+--------------------------------------------+--------------------+-----------------+------------+-------------+--------------+------------------+---------------+-----------+----------------+------------+---------------+
| host       | port   | role    | state  | gtid_mode  | health                                    | version                                    | master_log_file    | master_log_pos  | IO_Thread  | SQL_Thread  | Secs_Behind  | Remaining_Delay  | IO_Error_Num  | IO_Error  | SQL_Error_Num  | SQL_Error  | Trans_Behind  |
+------------+--------+---------+--------+------------+-------------------------------------------+--------------------------------------------+--------------------+-----------------+------------+-------------+--------------+------------------+---------------+-----------+----------------+------------+---------------+
| localhost  | 15000  | MASTER  | UP     | OFF        | OK                                        | 5.6.22-enterprise-commercial-advanced-log  | master-bin.000003  | 960             |            |             |              |                  |               |           |                |            |               |
| localhost  | 15001  | SLAVE   | UP     | OFF        | Binary log and Relay log filters differ.  | 5.6.22-enterprise-commercial-advanced-log  | master-bin.000003  | 960             | Yes        | Yes         | 0            | No               | 0             |           | 0              |            |               |
+------------+--------+---------+--------+------------+-------------------------------------------+--------------------------------------------+--------------------+-----------------+------------+-------------+--------------+------------------+---------------+-----------+----------------+------------+---------------+
# ...done.