From 73a2ae9f89978a7108bdbe8bc450e855f059d3b6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 19 Sep 2020 19:17:04 +0200 Subject: [PATCH] MDEV-23764 Slave crashes in ha_storage_engine_is_enabled upon rename of view view_pseudo_hton cannot be dereferenced --- mysql-test/suite/rpl/r/rpl_create_drop_view.result | 3 ++- mysql-test/suite/rpl/t/rpl_create_drop_view.test | 3 ++- sql/sql_rename.cc | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_view.result b/mysql-test/suite/rpl/r/rpl_create_drop_view.result index facd40a6018..079eb749b37 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_view.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_view.result @@ -93,7 +93,8 @@ id 80 40 connection master; -DROP VIEW v1; +RENAME TABLE v1 TO v2; +DROP VIEW v2; DROP TABLE t1; DROP VIEW v1; ERROR 42S02: Unknown VIEW: 'test.v1' diff --git a/mysql-test/suite/rpl/t/rpl_create_drop_view.test b/mysql-test/suite/rpl/t/rpl_create_drop_view.test index c26243ab3c6..4abb3ffb252 100644 --- a/mysql-test/suite/rpl/t/rpl_create_drop_view.test +++ b/mysql-test/suite/rpl/t/rpl_create_drop_view.test @@ -38,7 +38,8 @@ SELECT * FROM t1; SELECT * FROM v1; connection master; -DROP VIEW v1; +RENAME TABLE v1 TO v2; +DROP VIEW v2; DROP TABLE t1; --error ER_UNKNOWN_VIEW diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 0ac97bbeafd..77a1e46a75a 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -303,7 +303,8 @@ do_rename(THD *thd, TABLE_LIST *ren_table, const LEX_CSTRING *new_db, DBUG_RETURN(skip_error || if_exists ? 0 : 1); } - if (ha_check_if_updates_are_ignored(thd, hton, "RENAME")) + if (hton != view_pseudo_hton && + ha_check_if_updates_are_ignored(thd, hton, "RENAME")) { /* Shared table. Just drop the old .frm as it's not correct anymore