Bug #73625 Strange error message for incompatible gtid options for mysqlbinlog
Submitted: 18 Aug 2014 14:54 Modified: 28 Aug 2014 11:25
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[18 Aug 2014 14:54] Sven Sandberg
Description:
1. The --raw option for mysqlbinlog cannot be used together with --include-gtids.
2. Moreover, the --raw option cannot be used together with --exclude-gtids, if read-from-remote-master=BINLOG-DUMP-NON-GTIDS

The error message for case 1 does not parse:
 "You cannot set --include-gtids for --raw-mode when --read-from-remote-master=BINLOG_DUMP_GTID for"

The error message for case 2 is correct, but unnecessarily complicated.
 "You cannot set --exclude-gtids or --include-gtids for --raw-mode when --read-from-remote-master=BINLOG_DUMP_NON_GTID"

How to repeat:
CREATE TABLE t1 (a INT);
DROP TABLE t1;
--let $datadir= `SELECT @@GLOBAL.DATADIR`
--let $binlog= query_get_value(SHOW MASTER STATUS, File, 1)

--error 1
--exec $MYSQL_BINLOG --raw --include-gtids= --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --read-from-remote-master=BINLOG-DUMP-GTIDS $datadir/$binlog 2>&1

--echo foo

--error 1
--exec $MYSQL_BINLOG --raw --exclude-gtids= --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --read-from-remote-master=BINLOG-DUMP-NON-GTIDS $datadir/$binlog 2>&1

--echo bar

--exit

Suggested fix:
=== modified file 'client/mysqlbinlog.cc'
--- client/mysqlbinlog.cc	revid:tor.didriksen@oracle.com-20140814135756-tm90xr1m3246af6v
+++ client/mysqlbinlog.cc	2014-08-18 14:48:58 +0000
@@ -2872,18 +2872,17 @@ static int args_post_process(void)
       DBUG_RETURN(ERROR_STOP);
     }
 
-    if (opt_remote_proto == BINLOG_DUMP_NON_GTID &&
-        (opt_exclude_gtids_str != NULL || opt_include_gtids_str != NULL))
+    if (opt_include_gtids_str != NULL)
     {
-      error("You cannot set --exclude-gtids or --include-gtids for --raw-mode "
-            "when --read-from-remote-master=BINLOG_DUMP_NON_GTID");
+      error("You cannot use --exclude-gtids and --raw together.");
       DBUG_RETURN(ERROR_STOP);
     }
 
-    if (opt_remote_proto == BINLOG_DUMP_GTID && opt_include_gtids_str != NULL)
+    if (opt_remote_proto == BINLOG_DUMP_NON_GTID &&
+        opt_exclude_gtids_str != NULL)
     {
-      error("You cannot set --include-gtids for --raw-mode "
-            "when --read-from-remote-master=BINLOG_DUMP_GTID for");
+      error("You cannot use --exclude-gtids, --raw, and "
+            "--read-from-remote-master=BINLOG-DUMP-NON-GTIDS together.");
       DBUG_RETURN(ERROR_STOP);
     }
[28 Aug 2014 11:25] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

Documented fix in the MySQL 5.7.5 changelog as follows:

    Misleading or confusing error messages have been revised, which
    were produced in the following 2 cases when using mysqlbinlog
    with the --raw option:

        When this option was used together with --include-gtids.

        When this option was used together with --exclude-gtids and
        --read-from-remote-master=BINLOG-DUMP-NON-GTIDS.

Closed.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html