mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
fixed invalidation of query cache
excluded double call of 'invalidate()'
This commit is contained in:
@ -98,3 +98,13 @@ commit;
|
|||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Qcache_queries_in_cache 1
|
Qcache_queries_in_cache 1
|
||||||
|
drop table if exists t1;
|
||||||
|
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
insert into t1 (id) values (0);
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
|
@ -47,4 +47,11 @@ select * from t3;
|
|||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
show status like "Qcache_hits";
|
show status like "Qcache_hits";
|
||||||
commit;
|
commit;
|
||||||
show status like "Qcache_queries_in_cache";
|
show status like "Qcache_queries_in_cache";
|
||||||
|
|
||||||
|
drop table if exists t1;
|
||||||
|
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
|
||||||
|
select count(*) from t1;
|
||||||
|
insert into t1 (id) values (0);
|
||||||
|
select count(*) from t1;
|
||||||
|
drop table t1;
|
||||||
|
@ -314,7 +314,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_QUERY_CACHE
|
#ifdef HAVE_QUERY_CACHE
|
||||||
if (transaction_commited)
|
if (transaction_commited && thd->transaction.changed_tables)
|
||||||
query_cache.invalidate(thd->transaction.changed_tables);
|
query_cache.invalidate(thd->transaction.changed_tables);
|
||||||
#endif /*HAVE_QUERY_CACHE*/
|
#endif /*HAVE_QUERY_CACHE*/
|
||||||
if (error && trans == &thd->transaction.all && mysql_bin_log.is_open())
|
if (error && trans == &thd->transaction.all && mysql_bin_log.is_open())
|
||||||
|
@ -179,14 +179,12 @@ cleanup:
|
|||||||
if (ha_autocommit_or_rollback(thd,error >= 0))
|
if (ha_autocommit_or_rollback(thd,error >= 0))
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Only invalidate the query cache if something changed or if we
|
Store table for future invalidation or invalidate it in
|
||||||
didn't commit the transacion (query cache is automaticly
|
the query cache if something changed
|
||||||
invalidated on commit)
|
|
||||||
*/
|
*/
|
||||||
if (deleted &&
|
if (deleted)
|
||||||
(!transactional_table ||
|
|
||||||
thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
|
||||||
{
|
{
|
||||||
query_cache_invalidate3(thd, table_list, 1);
|
query_cache_invalidate3(thd, table_list, 1);
|
||||||
}
|
}
|
||||||
|
@ -319,13 +319,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
|
|||||||
error=ha_autocommit_or_rollback(thd,error);
|
error=ha_autocommit_or_rollback(thd,error);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Only invalidate the query cache if something changed or if we
|
Store table for future invalidation or invalidate it in
|
||||||
didn't commit the transacion (query cache is automaticly
|
the query cache if something changed
|
||||||
invalidated on commit)
|
|
||||||
*/
|
*/
|
||||||
if ((info.copied || info.deleted) &&
|
if (info.copied || info.deleted)
|
||||||
(!transactional_table ||
|
|
||||||
thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
|
||||||
{
|
{
|
||||||
query_cache_invalidate3(thd, table_list, 1);
|
query_cache_invalidate3(thd, table_list, 1);
|
||||||
}
|
}
|
||||||
|
@ -318,14 +318,12 @@ int mysql_update(THD *thd,
|
|||||||
if (ha_autocommit_or_rollback(thd, error >= 0))
|
if (ha_autocommit_or_rollback(thd, error >= 0))
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Only invalidate the query cache if something changed or if we
|
Store table for future invalidation or invalidate it in
|
||||||
didn't commit the transacion (query cache is automaticly
|
the query cache if something changed
|
||||||
invalidated on commit)
|
|
||||||
*/
|
*/
|
||||||
if (updated &&
|
if (updated)
|
||||||
(!transactional_table ||
|
|
||||||
thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
|
||||||
{
|
{
|
||||||
query_cache_invalidate3(thd, table_list, 1);
|
query_cache_invalidate3(thd, table_list, 1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user