A bug titled DELETE FROM inconsistency for NDB (Bug#19066) dropped into my lap, and while fixing it, we had to make some hard decisions on what should be considered the "correct" way to solve this.
The bug is related to the difference between TRUNCATE
TABLE and DELETE FROM with no
WHERE clause. On the surface, they seem to be
equivalent, but when digging deeper, we will see that there is
big difference between the statement when replication comes into
play.
Before delving into the problem and the solution, I'll start by recapitulate some selected parts of the manual.
- The
TRUNCATE TABLEandDELETE FROMwith no condition are "logically equivalent":TRUNCATE TABLEempties a table completely. Logically, this is equivalent to aDELETEstatement that …