Bug #75822 --force doesn't work for missing objects with mysqldiff
Submitted: 9 Feb 2015 9:00 Modified: 13 Dec 2016 23:46
Reporter: Steve Hanselman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S3 (Non-critical)
Version:1.5.3 OS:Any
Assigned to: CPU Architecture:Any

[9 Feb 2015 9:00] Steve Hanselman
Description:
Even with --force specified the diff on a list of multiple objects stops when a missing one is found.

How to repeat:
mysqldiff --force --server1=root@localhost --server2=root@localhost db1.objecta:db2.objecta db1.objectb:db2.objectb db1.objectc:db2.objectc

If objectb is missing in db2 then objectc is not compared

Suggested fix:
Suspect this is because there is a raise in diff.py/object_diff

This should probably be a check for force and a return of a suitable string in the result array.
[10 Feb 2015 8:50] MySQL Verification Team
Hello Steve Hanselman,

Thank you for the report.

Thanks,
Umesh
[10 Feb 2015 8:51] MySQL Verification Team
// from MySQL session

mysql> create database db1;
Query OK, 1 row affected (0.00 sec)

mysql> create database db2;
Query OK, 1 row affected (0.00 sec)

mysql> create table db1.t1 select 1 from dual;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> create table db1.t2 select 1 from dual;
Query OK, 1 row affected (0.00 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> create table db1.t3 select 1 from dual;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> create table db1.t4 select 1 from dual;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> create table db2.t1 select 1 from dual;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> create table db2.t2 select 1 from dual;
Query OK, 1 row affected (0.00 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> create table db2.t4 select 1 from dual;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

// mysqldiff session

[root@cluster-repo ~]# mysqldiff --force --server1=root@localhost:/tmp/mysql_ushastry.sock --server2=root@localhost:/tmp/mysql_ushastry.sock db1.t1:db2.t1 db1.t2:db2.t2 db1.t3:db2.t3 db1.t4:db2.t4
# WARNING: Using a password on the command line interface can be insecure.
# server1 on localhost: ... connected.
# server2 on localhost: ... connected.
# Comparing db1.t1 to db2.t1                                       [PASS]
# server1 on localhost: ... connected.
# server2 on localhost: ... connected.
# Comparing db1.t2 to db2.t2                                       [PASS]
# server1 on localhost: ... connected.
# server2 on localhost: ... connected.
ERROR: The object db2.t3 does not exist.
[10 Feb 2015 8:53] MySQL Verification Team
// This way it compares with t4

[root@cluster-repo ~]# mysqldiff --force --server1=root@localhost:/tmp/mysql_ushastry.sock --server2=root@localhost:/tmp/mysql_ushastry.sock db1:db2
# WARNING: Using a password on the command line interface can be insecure.
# server1 on localhost: ... connected.
# server2 on localhost: ... connected.
# WARNING: Objects in server1.db1 but not in server1.db2:
#        TABLE: t3
# Comparing `db1` to `db2`                                         [FAIL]
# Object definitions differ. (--changes-for=server1)
#

--- `db1`
+++ `db2`
@@ -1,1 +1,1 @@
-CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET latin1 */
# Comparing `db1`.`t1` to `db2`.`t1`                               [PASS]
# Comparing `db1`.`t2` to `db2`.`t2`                               [PASS]
# Comparing `db1`.`t4` to `db2`.`t4`                               [PASS]
Success. All objects are the same.
[13 Dec 2016 18:04] Chuck Bell
Posted by developer:
 
Pushed to release-1.6.5
[13 Dec 2016 23:46] Christine Cole
Fixed as of the upcoming MySQL Utilities 1.6.5 release, and here's the changelog entry:

Improved the --force option for the mysqldiff utility to allow checks to
continue when missing objects are detected.

Thank you for the bug report.