diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2020-06-11 22:35:30 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2020-06-11 22:35:30 +0300 |
commit | 8c67ffffe827ce07fbe55ba0fb89b82cdd9152dc (patch) | |
tree | 9e164262c9d5ec839e46be8492aad7b8187325bf /sql/sql_cache.cc | |
parent | e835881c474ec1c43ab3c24a9d4a6e2615fb3398 (diff) | |
parent | de20091f5cee6c018da37a6f4c2c57653d369ad6 (diff) | |
download | mariadb-git-8c67ffffe827ce07fbe55ba0fb89b82cdd9152dc.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index d8c78055d12..8555ae6ee3e 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -3396,7 +3396,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used, if (!insert_table(thd, key_length, key, (*block_table), tables_used->view_db.length, 0, HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE)) - DBUG_RETURN(0); + goto err_cleanup; /* We do not need to register view tables here because they are already present in the global list. @@ -3420,7 +3420,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used, tables_used->callback_func, tables_used->engine_data, TRUE)) - DBUG_RETURN(0); + goto err_cleanup; if (tables_used->table->file-> register_query_cache_dependant_tables(thd, this, block_table, &n)) @@ -3428,6 +3428,11 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used, } } DBUG_RETURN(n - counter); +err_cleanup: + // Mark failed + (*block_table)->next= (*block_table)->prev= NULL; + (*block_table)->parent= NULL; + DBUG_RETURN(0); } /* @@ -3461,7 +3466,12 @@ my_bool Query_cache::register_all_tables(THD *thd, for (Query_cache_block_table *tmp = block->table(0) ; tmp != block_table; tmp++) - unlink_table(tmp); + { + if (tmp->prev) // not marked as failed and unuseable + unlink_table(tmp); + else + break; + } if (block_table->parent) unlink_table(block_table); } |