diff options
author | Daniele Sciascia <daniele.sciascia@galeracluster.com> | 2018-05-22 16:45:27 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2018-08-02 09:03:27 +0300 |
commit | 4d2b5523695ea6b6f7e6cde406165a09d517dfeb (patch) | |
tree | 1070fb8fa71cf1ed1dae6c0d6c1a4e673435ecfe /sql/wsrep_mysqld.h | |
parent | b286a9f8238c4b441d3e42d2b56ba3d5f563bfb1 (diff) | |
download | mariadb-git-4d2b5523695ea6b6f7e6cde406165a09d517dfeb.tar.gz |
Fix FK constraint violation in applier, after ALTER TABLE ADD FK
Adding a FK constraint to an existing table (ALTER TABLE ADD FOREIGN
KEY) causes the applier to fail, if a concurrent DML statement that
violate the new constraint (i.e. a DELETE or UPDATE of record in the
parent table).
For exmaple, the following scenario causes a crash in the applier:
1. ALTER successfully adds FK constraint in node_1
2. On node_2 is UPDATE is in pre_commit() and has certified successfully
3. ALTER is delivered in node_2 and BF aborts DML
4. Applying UPDATE event causes FK violation in node_1
To avoid this situation it is necessary for UPDATE to fail during
certification. And for the UPDATE to fail certfication it is necessary
that ALTER appends certification keys for both the child and the parent
table. Before this patch, ALTER TABLE ADD FK only appended keys for
child table which is ALTERed.
Diffstat (limited to 'sql/wsrep_mysqld.h')
-rw-r--r-- | sql/wsrep_mysqld.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 56e3baae7cc..b1dc5ba452b 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -305,8 +305,10 @@ extern PSI_mutex_key key_LOCK_wsrep_slave_threads; extern PSI_mutex_key key_LOCK_wsrep_desync; #endif /* HAVE_PSI_INTERFACE */ struct TABLE_LIST; +class Alter_info; int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, - const TABLE_LIST* table_list); + const TABLE_LIST* table_list, + Alter_info* alter_info = NULL); void wsrep_to_isolation_end(THD *thd); void wsrep_cleanup_transaction(THD *thd); int wsrep_to_buf_helper( |