Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6250e763
Commit
6250e763
authored
Aug 12, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-qc-4.1
parents
62849952
57bb575d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
4 deletions
+48
-4
mysql-test/r/innodb_cache.result
mysql-test/r/innodb_cache.result
+4
-4
sql/sql_cache.cc
sql/sql_cache.cc
+42
-0
sql/sql_cache.h
sql/sql_cache.h
+2
-0
No files found.
mysql-test/r/innodb_cache.result
View file @
6250e763
...
...
@@ -10,7 +10,7 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache
1
Qcache_queries_in_cache
0
drop table t1;
commit;
set autocommit=1;
...
...
@@ -24,7 +24,7 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache
1
Qcache_queries_in_cache
0
drop table t1;
commit;
create table t1 (a int not null) type=innodb;
...
...
@@ -90,14 +90,14 @@ a
2
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache
3
Qcache_queries_in_cache
1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache
3
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;
...
...
sql/sql_cache.cc
View file @
6250e763
...
...
@@ -769,9 +769,18 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
==
0
)
{
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
DBUG_VOID_RETURN
;
}
DUMP
(
this
);
if
(
ask_handler_allowance
(
thd
,
tables_used
))
{
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
DBUG_VOID_RETURN
;
}
/* Key is query + database + flag */
if
(
thd
->
db_length
)
{
...
...
@@ -2548,6 +2557,39 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
DBUG_RETURN
(
0
);
}
/*
Check handler allowence to cache query with this tables
SYNOPSYS
Query_cache::ask_handler_allowance()
thd - thread handlers
tables_used - tables list used in query
RETURN
0 - caching allowed
1 - caching disallowed
*/
my_bool
Query_cache
::
ask_handler_allowance
(
THD
*
thd
,
TABLE_LIST
*
tables_used
)
{
DBUG_ENTER
(
"Query_cache::is_cacheable"
);
for
(;
tables_used
;
tables_used
=
tables_used
->
next
)
{
TABLE
*
table
=
tables_used
->
table
;
if
(
!
handler
::
caching_allowed
(
thd
,
table
->
table_cache_key
,
table
->
key_length
,
table
->
file
->
table_cache_type
()))
{
DBUG_PRINT
(
"qcache"
,
(
"Handler does not allow caching for %s.%s"
,
tables_used
->
db
,
tables_used
->
alias
));
thd
->
lex
.
safe_to_cache_query
=
0
;
// Don't try to cache this
DBUG_RETURN
(
1
);
}
}
DBUG_RETURN
(
0
);
}
/*****************************************************************************
Packing
...
...
sql/sql_cache.h
View file @
6250e763
...
...
@@ -345,6 +345,8 @@ protected:
TABLE_COUNTER_TYPE
is_cacheable
(
THD
*
thd
,
uint32
query_len
,
char
*
query
,
LEX
*
lex
,
TABLE_LIST
*
tables_used
,
uint8
*
tables_type
);
static
my_bool
ask_handler_allowance
(
THD
*
thd
,
TABLE_LIST
*
tables_used
);
public:
Query_cache
(
ulong
query_cache_limit
=
ULONG_MAX
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment