Bug #47868 statement based logging of partially failed statements
Submitted: 6 Oct 2009 16:18 Modified: 21 Dec 2011 16:14
Reporter: Axel Schwenke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:any OS:Any
Assigned to: Axel Schwenke CPU Architecture:Any

[6 Oct 2009 16:18] Axel Schwenke
Description:
If the MySQL server executes a DML statement that partially succeeds and partially fails (i.e. a multi-row INSERT with a UNIQUE violation in a subsequent row) then this statement is written to the binlog and when it hits the a slave, the slave will stop.

This behavior is quite undesired because it requires manual intervention on the slave(s).

The documentation should make this more clearly. Specifically there should be warnings in the respective chapters of the manual.

How to repeat:
On a replication master, execute an INSERT statement that inserts two rows, but violates a constraint in the second row. The slave stops.

Suggested fix:
Add a warning like "a partially successful DML statement will be written to the binlog and cause a replication stop" to the following chapters in the manual:

1. INSERT syntax (for multi-row insert)
2. KILL syntax (for killing longrunning DML statements)
3. the BINLOG chapter
4. somewhere in the REPLICATION ISSUES chapter; it is mentioned there under TRANSACTIONS but should get a more prominent place
5. maybe in the RBR chapter like "RBR solves the problem of logging half-completed DML statements"
6. in the SQL MODES chapter; there is a note for TRADITIONAL mode, that it will increase the odds to end with half-completed DML statements, but it should be made clear that this is a problem in a replication environment
[21 Dec 2011 16:14] Axel Schwenke
I retested the behavior with 5.5.9. This version writes the correct error code for the half-completed statement into the binlog. So the slave ignores this error. Closing this bug.