diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2016-05-30 21:22:50 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2016-08-31 17:17:46 +0200 |
commit | 0ee3e64c55664332e8e92eda55b43692159fe4fe (patch) | |
tree | b12a876260d383a9ded16593bda2edcc668cbf7c /sql/sql_cache.cc | |
parent | c8948b0d0db4c182a744bc8bdbde7cbccff3d57d (diff) | |
download | mariadb-git-0ee3e64c55664332e8e92eda55b43692159fe4fe.tar.gz |
MDEV-8931: (server part of) session state tracking
Transaction tracker
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 06c5f992939..8ff4684f0ff 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1381,6 +1381,21 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) DBUG_VOID_RETURN; } + /* + Do not store queries while tracking transaction state. + The tracker already flags queries that actually have + transaction tracker items, but this will make behavior + more straight forward. + */ +#ifndef EMBEDDED_LIBRARY + if (thd->variables.session_track_transaction_info != TX_TRACK_NONE) + { + DBUG_PRINT("qcache", ("Do not work with transaction tracking")); + DBUG_VOID_RETURN; + } +#endif //EMBEDDED_LIBRARY + + /* The following assert fails if we haven't called send_result_to_client */ DBUG_ASSERT(thd->base_query.is_alloced() || thd->base_query.ptr() == thd->query()); @@ -1719,6 +1734,20 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) goto err; } + /* + Don't allow serving from Query_cache while tracking transaction + state. This is a safeguard in case an otherwise matching query + was added to the cache before tracking was turned on. + */ +#ifndef EMBEDDED_LIBRARY + if (thd->variables.session_track_transaction_info != TX_TRACK_NONE) + { + DBUG_PRINT("qcache", ("Do not work with transaction tracking")); + goto err; + } +#endif //EMBEDDED_LIBRARY + + thd->query_cache_is_applicable= 1; sql= org_sql; sql_end= sql + query_length; |