codership / mysql-wsrep

wsrep API patch for MySQL server
Other
65 stars 34 forks source link

ALTER TABLE ADD FOREIGN KEY causes apply error under concurrent and conflicting DML #332

Closed sciascid closed 6 years ago

sciascid commented 6 years ago

Adding a foreign key to an existing table, and concurrently replicating a statement that changes the parent so that it violates the FK constraint, may result in the applier failing and reporting the constraint violation.
The scenario is as follows:

  1. ALTER adds FK in node1 successfully
  2. On node2 UPDATE/DELETE is in pre_commit (FK is not violated, as FK is not applied yet)
  3. On node2 ALTER BF aborts UPDATE/DELETE, after pre_commit certified it successfully e
  4. Applying of UPDATE/DELETE fails due to FK constraint violation and causes crash