Bug #68351 Out of range updates/deletes are not written to binlog

Submitted: 12 Feb 2013 18:44 Modified: 13 Feb 2013 8:11
Reporter: Yoshinori Matsunobu (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6.10 OS:Any
Assigned to: CPU Architecture:Any

[12 Feb 2013 18:44] Yoshinori Matsunobu
Description:
See "how to repeat" for details.

How to repeat:
Run the following statements with log-bin and run mysqlbinlog

mysql> create table t1 (id int unsigned primary key, value int) engine=innodb;
Query OK, 0 rows affected (0.16 sec)

mysql> insert into t1 values (1,1),(2,2),(3,3);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

# out of range from int unsigned, not written to binlog
mysql> update t1 set value=value+1 where id=100000000000000;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

# max int unsigned, written to binlog
mysql> update t1 set value=value+1 where id=4294967295;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

# max int unsigned + 1, not written to binlog
mysql> update t1 set value=value+1 where id=4294967296;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

# null cond on not null column, not written to binlog
mysql> update t1 set value=1000 where id is null;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

# same as above, not written to binlog
mysql> delete from t1 where id is null;
Query OK, 0 rows affected (0.00 sec)

Suggested fix:
In mysql_update() function...
    if (error || !limit ||
        (select && select->check_quick(thd, safe_update, limit)))
...
      DBUG_PRINT("info",("0 records updated"));
      DBUG_RETURN(0);
    }

When entering this if-block, writing to binlog logic is not called.
check_quick() may return 0 if save_value_and_handle_conversion() sets
(*tree)->type= SEL_ARG::IMPOSSIBLE. This is set if out of range
conditions are specified.
[13 Feb 2013 8:11] Erlend Dahl
Thank you for the bug report. Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.