diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2020-08-28 22:14:37 +0300 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-09-04 07:53:01 +0200 |
commit | a9ad24cc4c097339e33a4c70e815317a21a5b0ad (patch) | |
tree | a74cbf38441b8139b2fc21527fb32131e9523b1d | |
parent | 8c1f48a0c542f5072582816e46ad863b1ca2937c (diff) | |
download | mariadb-git-a9ad24cc4c097339e33a4c70e815317a21a5b0ad.tar.gz |
MENT-906: Xpand replication: Make CREATE TABLE work with HTON_IGNORE_UPDATES
"CREATE TABLE xpand_table" didn't work on the slave if the table already
existed, even if the engine has HTON_IGNORE_UPDATES flag (which meaning
is "ignore such statements").
The statement failed in upgrade_lock_if_not_exists(), where the code
would expect that the table being created does not exist yet.
Fixed by following the code path of CREATE OR REPLACE, where it is allowed
that the table being created does exist.
-rw-r--r-- | sql/sql_base.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 6a313616025..006d138774f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3899,8 +3899,10 @@ static bool upgrade_lock_if_not_exists(THD *thd, thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE) { DEBUG_SYNC(thd,"create_table_before_check_if_exists"); + handlerton *hton; if (!create_info.or_replace() && - ha_table_exists(thd, &create_table->db, &create_table->table_name)) + ha_table_exists(thd, &create_table->db, &create_table->table_name, + NULL, NULL, &hton)) { if (create_info.if_not_exists()) { @@ -3909,7 +3911,7 @@ static bool upgrade_lock_if_not_exists(THD *thd, ER_THD(thd, ER_TABLE_EXISTS_ERROR), create_table->table_name.str); } - else + else if (!(hton->flags & HTON_IGNORE_UPDATES)) my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->table_name.str); DBUG_RETURN(true); } |