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
902415bf
Commit
902415bf
authored
Jun 01, 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.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.0
parents
dcdc6ffa
2848e6c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
28 deletions
+83
-28
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+50
-10
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+26
-9
sql/sql_cache.cc
sql/sql_cache.cc
+7
-9
No files found.
mysql-test/r/query_cache.result
View file @
902415bf
...
...
@@ -501,22 +501,62 @@ drop table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
create table t1 (a int);
set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
set GLOBAL query_cache_size=1100;
set GLOBAL query_cache_size=1200;
set GLOBAL query_cache_size=1300;
set GLOBAL query_cache_size=1400;
set GLOBAL query_cache_size=1500;
set GLOBAL query_cache_size=1600;
set GLOBAL query_cache_size=1700;
set GLOBAL query_cache_size=1800;
set GLOBAL query_cache_size=1900;
select * from t1;
a
set GLOBAL query_cache_size=1024;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=10240;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=20480;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=40960;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 0
select * from t1;
a
set GLOBAL query_cache_size=51200;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 51200
select * from t1;
a
set GLOBAL query_cache_size=61440;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 1024
query_cache_size 61440
select * from t1;
a
set GLOBAL query_cache_size=81920;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 81920
select * from t1;
a
set GLOBAL query_cache_size=102400;
show global variables like "query_cache_size";
Variable_name Value
query_cache_size 102400
select * from t1;
a
drop table t1;
set GLOBAL query_cache_size=1048576;
create table t1 (i int not null);
create table t2 (i int not null);
...
...
mysql-test/t/query_cache.test
View file @
902415bf
...
...
@@ -343,18 +343,35 @@ show status like "Qcache_queries_in_cache";
#
# Test of query cache resizing
#
create
table
t1
(
a
int
);
set
GLOBAL
query_cache_size
=
1000
;
show
global
variables
like
"query_cache_size"
;
set
GLOBAL
query_cache_size
=
1100
;
set
GLOBAL
query_cache_size
=
1200
;
set
GLOBAL
query_cache_size
=
1300
;
set
GLOBAL
query_cache_size
=
1400
;
set
GLOBAL
query_cache_size
=
1500
;
set
GLOBAL
query_cache_size
=
1600
;
set
GLOBAL
query_cache_size
=
1700
;
set
GLOBAL
query_cache_size
=
1800
;
set
GLOBAL
query_cache_size
=
1900
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
1024
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
10240
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
20480
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
40960
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
51200
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
61440
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
81920
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
set
GLOBAL
query_cache_size
=
102400
;
show
global
variables
like
"query_cache_size"
;
select
*
from
t1
;
drop
table
t1
;
#
# Temporary tables
...
...
sql/sql_cache.cc
View file @
902415bf
...
...
@@ -731,7 +731,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
query_cache_size_arg
));
free_cache
(
0
);
query_cache_size
=
query_cache_size_arg
;
DBUG_RETURN
(
init_cache
());
DBUG_RETURN
(
::
query_cache_size
=
init_cache
());
}
...
...
@@ -1282,6 +1282,12 @@ ulong Query_cache::init_cache()
mem_bin_steps
=
1
;
mem_bin_size
=
max_mem_bin_size
>>
QUERY_CACHE_MEM_BIN_STEP_PWR2
;
prev_size
=
0
;
if
(
mem_bin_size
<=
min_allocation_unit
)
{
DBUG_PRINT
(
"qcache"
,
(
"too small query cache => query cache disabled"
));
// TODO here (and above) should be warning in 4.1
goto
err
;
}
while
(
mem_bin_size
>
min_allocation_unit
)
{
mem_bin_num
+=
mem_bin_count
;
...
...
@@ -1308,14 +1314,6 @@ ulong Query_cache::init_cache()
query_cache_size
-=
additional_data_size
;
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
max_mem_bin_size
<=
min_allocation_unit
)
{
DBUG_PRINT
(
"qcache"
,
(
" max bin size (%lu) <= min_allocation_unit => cache disabled"
,
max_mem_bin_size
));
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
goto
err
;
}
if
(
!
(
cache
=
(
byte
*
)
my_malloc_lock
(
query_cache_size
+
additional_data_size
,
MYF
(
0
))))
...
...
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