summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-05-06 10:45:18 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-05-06 15:11:02 +0300
commit706a8232da40fee3e89d0ba2f419142bf5335f45 (patch)
treebc02ccbfe93fd6b462dfe94345c40470eb98389a /sql/sql_base.cc
parent92bfc0e8c4bb5c86359c29458d67f3e7836ec18a (diff)
downloadmariadb-git-706a8232da40fee3e89d0ba2f419142bf5335f45.tar.gz
MDEV-25477 Auto-create breaks replication when triggering event was not replicated
If UPDATE/DELETE does not change data it is skipped from replication. We now force replication of such events when they trigger partition auto-creation. For ROLLBACK it is as simple as set OPTION_KEEP_LOG flag. trans_cannot_safely_rollback() does the rest. For UPDATE/DELETE .. LIMIT 0 we make additional binlog_query() calls at the early points of return. As a safety measure we also convert row format into statement if it is needed. The condition is decided by binlog_need_stmt_format(). Basically if there are some row events in cache we don't need that: table open of row event will trigger auto-creation anyway. Multi-update/delete works via mysql_select(). There is no early points of return, so binlogging is always checked by send_eof()/abort_resultset(). But we must comply with the above measure of converting into statement.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 73bfa7290e5..50371b3e722 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1674,6 +1674,7 @@ bool TABLE::vers_switch_partition(THD *thd, TABLE_LIST *table_list,
{
switch (thd->lex->sql_command)
{
+ case SQLCOM_INSERT_SELECT:
case SQLCOM_INSERT:
if (thd->lex->duplicates != DUP_UPDATE)
return false;