diff options
author | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2021-06-09 11:03:03 -0600 |
---|---|---|
committer | Brandon Nesterenko <brandon.nesterenko@mariadb.com> | 2021-06-09 12:27:15 -0600 |
commit | 1b0ffdd35dde8fc382626f91d9911576a4a6794f (patch) | |
tree | 4bc070aa0ba2249206c29d96f863f33b8e2b1a70 /sql/sql_base.cc | |
parent | c872125a664842ecfb66c60f69b3a87390aec23d (diff) | |
download | mariadb-git-bb-10.2-MDEV-25607.tar.gz |
MDEV-25607: Auto-generated DELETE from HEAP table can break replicationbb-10.2-MDEV-25607
Problem:
=======
The special logic used by the memory storage engine
to keep slaves in sync with the master on a restart can
break replication. In particular, after a restart, the
master writes DELETE statements in the binlog for
each MEMORY-based table so the slave can empty its
data. If the DELETE is not executable, e.g. due to
invalid triggers, the slave will error and fail, whereas
the master will never see the problem.
Solution:
=======
Instead of DELETE statements, use TRUNCATE to
keep slaves in-sync with the master, thereby bypassing
triggers.
Reviewed By:
===========
<TODO>
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 11f4cb9890b..d3e605651bf 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2796,7 +2796,7 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry) String query(query_buf, sizeof(query_buf), system_charset_info); query.length(0); - query.append("DELETE FROM "); + query.append("TRUNCATE TABLE "); append_identifier(thd, &query, share->db.str, share->db.length); query.append("."); append_identifier(thd, &query, share->table_name.str, |