diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2020-01-24 01:49:42 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2020-01-24 01:56:55 +0400 |
commit | 9bb931fcdc828cb169cc88d19f0e1d9a895f0f85 (patch) | |
tree | 12e0bd7eb1b2ae970ce4c2de773670221ccde498 | |
parent | e89fdd3de79e84e5de513d098ba2df3cc8a8b253 (diff) | |
download | mariadb-git-10.5-svoj-MDEV-19964.tar.gz |
discover_check_version() -> rebind()10.5-svoj-MDEV-19964
-rw-r--r-- | sql/handler.h | 8 | ||||
-rw-r--r-- | sql/sql_base.cc | 21 | ||||
-rw-r--r-- | storage/maria/ha_s3.cc | 16 | ||||
-rw-r--r-- | storage/maria/ha_s3.h | 1 |
4 files changed, 20 insertions, 26 deletions
diff --git a/sql/handler.h b/sql/handler.h index b8e5744dd44..d21d749f44c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4874,14 +4874,6 @@ public: { return false; } - /* - Allow engines that is using discovery to check if versions match - Called by open_table() for tables that was in the table definition cache - */ - virtual int discover_check_version() - { - return 0; - } /* If the table is using sql level unique constraints on some column */ bool has_long_unique(); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 04167ab0130..d436e87e417 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1909,8 +1909,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) mdl_ticket= table_list->mdl_request.ticket; } -retry_share: - if (table_list->open_strategy == TABLE_LIST::OPEN_IF_EXISTS) { if (!ha_table_exists(thd, &table_list->db, &table_list->table_name)) @@ -1928,6 +1926,8 @@ retry_share: else gts_flags= GTS_TABLE | GTS_VIEW; +retry_share: + share= tdc_acquire_share(thd, table_list, gts_flags, &table); if (unlikely(!share)) @@ -1999,17 +1999,7 @@ retry_share: if (!(flags & MYSQL_OPEN_IGNORE_FLUSH)) { - bool force_flush= 0; - if (table && table->file->discover_check_version()) - { - DBUG_PRINT("error", ("discover_check_version failed")); - /* - Table definition is out of sync - Close all instances of the table and retry - */ - force_flush= 1; - } - if (share->tdc->flushed || force_flush) + if (share->tdc->flushed) { /* We already have an MDL lock. But we have encountered an old @@ -2025,11 +2015,6 @@ retry_share: else tdc_release_share(share); - if (force_flush) - tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, - table_list->db.str, - table_list->table_name.str); - MDL_deadlock_handler mdl_deadlock_handler(ot_ctx); bool wait_result; diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index 93c3d85239c..fe400ccee9f 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -480,6 +480,9 @@ int ha_s3::open(const char *name, int mode, uint open_flags) open_args= &s3_info; } + if (discover_check_version()) + DBUG_RETURN(HA_ERR_TABLE_DEF_CHANGED); + if (!(res= ha_maria::open(name, mode, open_flags))) { if ((open_flags & HA_OPEN_FOR_CREATE)) @@ -662,6 +665,19 @@ int ha_s3::discover_check_version() } +int ha_s3::rebind() +{ + if (auto error= handler::rebind()) + return error; + if (discover_check_version()) + { + handler::unbind_psi(); + return HA_ERR_TABLE_DEF_CHANGED; + } + return 0; +} + + /** Update the .frm file in S3 */ diff --git a/storage/maria/ha_s3.h b/storage/maria/ha_s3.h index cd43d6c6521..61502449dac 100644 --- a/storage/maria/ha_s3.h +++ b/storage/maria/ha_s3.h @@ -65,6 +65,7 @@ public: int delete_table(const char *name); int rename_table(const char *from, const char *to); int discover_check_version(); + int rebind(); S3_INFO *s3_open_args() { return open_args; } void register_handler(MARIA_HA *file); }; |