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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b2f27a15
Commit
b2f27a15
authored
Mar 02, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made variable query_cache_min_res_unit from QUERY_CACHE_MIN_RESULT_DATA_SIZE (SCRUM)
parent
b381cb04
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
124 additions
and
3 deletions
+124
-3
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+59
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+25
-0
sql/mysql_priv.h
sql/mysql_priv.h
+4
-1
sql/mysqld.cc
sql/mysqld.cc
+9
-2
sql/set_var.cc
sql/set_var.cc
+16
-0
sql/sql_cache.cc
sql/sql_cache.cc
+8
-0
sql/sql_cache.h
sql/sql_cache.h
+3
-0
No files found.
mysql-test/r/query_cache.result
View file @
b2f27a15
...
...
@@ -497,6 +497,65 @@ drop table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show global variables like "query_cache_min_res_unit";
Variable_name Value
query_cache_min_res_unit 4096
set GLOBAL query_cache_min_res_unit=1001;
show global variables like "query_cache_min_res_unit";
Variable_name Value
query_cache_min_res_unit 1008
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
create table t2 (a int not null);
insert into t2 values (1),(2),(3);
select * from t1;
a
1
2
3
select * from t1;
a
1
2
3
select * from t2;
a
1
2
3
select * from t2;
a
1
2
3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 11
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
drop table t1;
select a from t2;
a
1
2
3
select a from t2;
a
1
2
3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 12
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
drop table t2;
set GLOBAL query_cache_min_res_unit=default;
show global variables like "query_cache_min_res_unit";
Variable_name Value
query_cache_min_res_unit 4096
set GLOBAL query_cache_size=1000;
show global variables like "query_cache_size";
Variable_name Value
...
...
mysql-test/t/query_cache.test
View file @
b2f27a15
...
...
@@ -342,6 +342,31 @@ show status like "Qcache_queries_in_cache";
drop
table
t1
;
show
status
like
"Qcache_queries_in_cache"
;
#
# Test of min result data unit size changing
#
show
global
variables
like
"query_cache_min_res_unit"
;
set
GLOBAL
query_cache_min_res_unit
=
1001
;
show
global
variables
like
"query_cache_min_res_unit"
;
create
table
t1
(
a
int
not
null
);
insert
into
t1
values
(
1
),(
2
),(
3
);
create
table
t2
(
a
int
not
null
);
insert
into
t2
values
(
1
),(
2
),(
3
);
select
*
from
t1
;
select
*
from
t1
;
select
*
from
t2
;
select
*
from
t2
;
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_queries_in_cache"
;
drop
table
t1
;
select
a
from
t2
;
select
a
from
t2
;
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_queries_in_cache"
;
drop
table
t2
;
set
GLOBAL
query_cache_min_res_unit
=
default
;
show
global
variables
like
"query_cache_min_res_unit"
;
#
# Test of query cache resizing
#
...
...
sql/mysql_priv.h
View file @
b2f27a15
...
...
@@ -307,6 +307,7 @@ typedef compare_func_creator (*chooser_compare_func_creator)(bool invert);
#define query_cache_destroy() query_cache.destroy()
#define query_cache_result_size_limit(A) query_cache.result_size_limit(A)
#define query_cache_resize(A) query_cache.resize(A)
#define query_cache_set_min_res_unit(A) query_cache.set_min_res_unit(A)
#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C)
#define query_cache_invalidate1(A) query_cache.invalidate(A)
#define query_cache_send_result_to_client(A, B, C) \
...
...
@@ -318,6 +319,7 @@ typedef compare_func_creator (*chooser_compare_func_creator)(bool invert);
#define query_cache_destroy()
#define query_cache_result_size_limit(A)
#define query_cache_resize(A)
#define query_cache_set_min_res_unit(A)
#define query_cache_invalidate3(A, B, C)
#define query_cache_invalidate1(A)
#define query_cache_send_result_to_client(A, B, C) 0
...
...
@@ -699,7 +701,8 @@ extern ulong filesort_rows, filesort_range_count, filesort_scan_count;
extern
ulong
filesort_merge_passes
;
extern
ulong
select_range_check_count
,
select_range_count
,
select_scan_count
;
extern
ulong
select_full_range_join_count
,
select_full_join_count
;
extern
ulong
slave_open_temp_tables
,
query_cache_size
;
extern
ulong
slave_open_temp_tables
;
extern
ulong
query_cache_size
,
query_cache_min_res_unit
;
extern
ulong
thd_startup_options
,
slow_launch_threads
,
slow_launch_time
;
extern
ulong
server_id
,
concurrency
;
extern
ulong
ha_read_count
,
ha_write_count
,
ha_delete_count
,
ha_update_count
;
...
...
sql/mysqld.cc
View file @
b2f27a15
...
...
@@ -363,7 +363,8 @@ ulong slave_net_timeout;
ulong
thread_cache_size
=
0
,
binlog_cache_size
=
0
,
max_binlog_cache_size
=
0
;
ulong
query_cache_size
=
0
;
#ifdef HAVE_QUERY_CACHE
ulong
query_cache_limit
=
0
;
ulong
query_cache_limit
=
0
;
ulong
query_cache_min_res_unit
=
QUERY_CACHE_MIN_RESULT_DATA_SIZE
;
Query_cache
query_cache
;
#endif
arg_cmp_func
Arg_comparator
::
comparator_matrix
[
4
][
2
]
=
...
...
@@ -2148,6 +2149,7 @@ static int init_server_components()
table_cache_init
();
hostname_cache_init
();
query_cache_result_size_limit
(
query_cache_limit
);
query_cache_set_min_res_unit
(
query_cache_min_res_unit
);
query_cache_resize
(
query_cache_size
);
randominit
(
&
sql_rand
,(
ulong
)
start_time
,(
ulong
)
start_time
/
2
);
reset_floating_point_exceptions
();
...
...
@@ -3443,7 +3445,7 @@ enum options
OPT_NET_BUFFER_LENGTH
,
OPT_NET_RETRY_COUNT
,
OPT_NET_READ_TIMEOUT
,
OPT_NET_WRITE_TIMEOUT
,
OPT_OPEN_FILES_LIMIT
,
OPT_QUERY_CACHE_LIMIT
,
OPT_QUERY_CACHE_SIZE
,
OPT_QUERY_CACHE_LIMIT
,
OPT_QUERY_CACHE_
MIN_RES_UNIT
,
OPT_QUERY_CACHE_
SIZE
,
OPT_QUERY_CACHE_TYPE
,
OPT_RECORD_BUFFER
,
OPT_RECORD_RND_BUFFER
,
OPT_RELAY_LOG_SPACE_LIMIT
,
OPT_SLAVE_NET_TIMEOUT
,
OPT_SLAVE_COMPRESSED_PROTOCOL
,
OPT_SLOW_LAUNCH_TIME
,
...
...
@@ -4206,6 +4208,11 @@ struct my_option my_long_options[] =
"Don't cache results that are bigger than this."
,
(
gptr
*
)
&
query_cache_limit
,
(
gptr
*
)
&
query_cache_limit
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1024
*
1024L
,
0
,
(
longlong
)
ULONG_MAX
,
0
,
1
,
0
},
{
"query_cache_min_res_unit"
,
OPT_QUERY_CACHE_MIN_RES_UNIT
,
"minimal size of unit in wich space for results is allocated (last unit will be trimed after writing all result data."
,
(
gptr
*
)
&
query_cache_min_res_unit
,
(
gptr
*
)
&
query_cache_min_res_unit
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
QUERY_CACHE_MIN_RESULT_DATA_SIZE
,
0
,
(
longlong
)
ULONG_MAX
,
0
,
1
,
0
},
#endif
/*HAVE_QUERY_CACHE*/
{
"query_cache_size"
,
OPT_QUERY_CACHE_SIZE
,
"The memory allocated to store results from old queries."
,
...
...
sql/set_var.cc
View file @
b2f27a15
...
...
@@ -85,6 +85,7 @@ static void fix_net_write_timeout(THD *thd, enum_var_type type);
static
void
fix_net_retry_count
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_max_join_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_query_cache_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_query_cache_min_res_unit
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_key_buffer_size
(
THD
*
thd
,
enum_var_type
type
);
static
byte
*
get_error_count
(
THD
*
thd
);
static
byte
*
get_warning_count
(
THD
*
thd
);
...
...
@@ -204,6 +205,9 @@ sys_var_long_ptr sys_query_cache_size("query_cache_size",
#ifdef HAVE_QUERY_CACHE
sys_var_long_ptr
sys_query_cache_limit
(
"query_cache_limit"
,
&
query_cache
.
query_cache_limit
);
sys_var_long_ptr
sys_query_cache_min_res_unit
(
"query_cache_min_res_unit"
,
&
query_cache_min_res_unit
,
fix_query_cache_min_res_unit
);
sys_var_thd_enum
sys_query_cache_type
(
"query_cache_type"
,
&
SV
::
query_cache_type
,
&
query_cache_type_typelib
);
...
...
@@ -384,6 +388,7 @@ sys_var *sys_variables[]=
&
sys_query_cache_size
,
#ifdef HAVE_QUERY_CACHE
&
sys_query_cache_limit
,
&
sys_query_cache_min_res_unit
,
&
sys_query_cache_type
,
#endif
/* HAVE_QUERY_CACHE */
&
sys_quote_show_create
,
...
...
@@ -546,6 +551,8 @@ struct show_var_st init_vars[]= {
{
sys_rpl_recovery_rank
.
name
,(
char
*
)
&
sys_rpl_recovery_rank
,
SHOW_SYS
},
#ifdef HAVE_QUERY_CACHE
{
sys_query_cache_limit
.
name
,(
char
*
)
&
sys_query_cache_limit
,
SHOW_SYS
},
{
sys_query_cache_min_res_unit
.
name
,
(
char
*
)
&
sys_query_cache_min_res_unit
,
SHOW_SYS
},
{
sys_query_cache_size
.
name
,
(
char
*
)
&
sys_query_cache_size
,
SHOW_SYS
},
{
sys_query_cache_type
.
name
,
(
char
*
)
&
sys_query_cache_type
,
SHOW_SYS
},
#endif
/* HAVE_QUERY_CACHE */
...
...
@@ -696,6 +703,15 @@ static void fix_query_cache_size(THD *thd, enum_var_type type)
}
#ifdef HAVE_QUERY_CACHE
static
void
fix_query_cache_min_res_unit
(
THD
*
thd
,
enum_var_type
type
)
{
query_cache_min_res_unit
=
query_cache
.
set_min_res_unit
(
query_cache_min_res_unit
);
}
#endif
static
void
fix_key_buffer_size
(
THD
*
thd
,
enum_var_type
type
)
{
ha_resize_key_cache
();
...
...
sql/sql_cache.cc
View file @
b2f27a15
...
...
@@ -743,6 +743,14 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
}
ulong
Query_cache
::
set_min_res_unit
(
ulong
size
)
{
if
(
size
<
min_allocation_unit
)
size
=
min_allocation_unit
;
return
(
min_result_data_size
=
ALIGN_SIZE
(
size
));
}
void
Query_cache
::
store_query
(
THD
*
thd
,
TABLE_LIST
*
tables_used
)
{
TABLE_COUNTER_TYPE
local_tables
;
...
...
sql/sql_cache.h
View file @
b2f27a15
...
...
@@ -345,7 +345,10 @@ class Query_cache
/* resize query cache (return real query size, 0 if disabled) */
ulong
resize
(
ulong
query_cache_size
);
/* set limit on result size */
inline
void
result_size_limit
(
ulong
limit
){
query_cache_limit
=
limit
;}
/* set minimal result data allocation unit size */
ulong
set_min_res_unit
(
ulong
size
);
/* register query in cache */
void
store_query
(
THD
*
thd
,
TABLE_LIST
*
used_tables
);
...
...
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