diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2015-06-03 23:31:05 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2015-06-04 18:04:31 +0300 |
commit | a477cd175476b26e5bc0090b580e9b590b17e29a (patch) | |
tree | 3195406d09827eba38e840b40b82ea17c28b746c /sql | |
parent | 08fa02cf227a632ed787357357d6116b72c6d5e6 (diff) | |
download | mariadb-git-a477cd175476b26e5bc0090b580e9b590b17e29a.tar.gz |
MDEV-6500: Stale data returned after TRUNCATE PARTITION operation
When truncating a table's partition, we also need to invalidate the
query cache for it.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_partition_admin.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index a03dcc5c16e..a104676a3ff 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -174,9 +174,16 @@ bool Alter_table_truncate_partition_statement::execute(THD *thd) log. The exception is a unimplemented truncate method or failure before any call to handler::truncate() is done. Also, it is logged in statement format, regardless of the binlog format. + + Since we've changed data within the table, we also have to invalidate + the query cache for it. */ - if (error != HA_ERR_WRONG_COMMAND && binlog_stmt) - error|= write_bin_log(thd, !error, thd->query(), thd->query_length()); + if (error != HA_ERR_WRONG_COMMAND) + { + query_cache_invalidate3(thd, first_table, FALSE); + if (binlog_stmt) + error|= write_bin_log(thd, !error, thd->query(), thd->query_length()); + } /* A locked table ticket was upgraded to a exclusive lock. After the |