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
d03034d3
Commit
d03034d3
authored
Mar 04, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
invalidation of locking for write tables (BUG#2693)
fixed linking query_prealloc_size to query cache presence
parent
f8345cc6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
4 deletions
+82
-4
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+17
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+16
-1
sql/mysqld.cc
sql/mysqld.cc
+7
-2
sql/set_var.cc
sql/set_var.cc
+4
-0
sql/sql_cache.cc
sql/sql_cache.cc
+31
-0
sql/sql_cache.h
sql/sql_cache.h
+1
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+5
-1
No files found.
mysql-test/r/query_cache.result
View file @
d03034d3
...
...
@@ -687,4 +687,21 @@ select * from t3;
delete from t4 where a=1;
flush query cache;
drop table t1,t2,t3,t4;
set query_cache_wlock_invalidate=1;
create table t1 (a int not null);
create table t2 (a int not null);
select * from t1;
a
select * from t2;
a
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
lock table t1 write, t2 read;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
unlock table;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
set GLOBAL query_cache_size=0;
mysql-test/t/query_cache.test
View file @
d03034d3
...
...
@@ -504,6 +504,21 @@ select * from t3;
enable_result_log
;
delete
from
t4
where
a
=
1
;
flush
query
cache
;
drop
table
t1
,
t2
,
t3
,
t4
;
#
# WRITE LOCK & QC
#
set
query_cache_wlock_invalidate
=
1
;
create
table
t1
(
a
int
not
null
);
create
table
t2
(
a
int
not
null
);
select
*
from
t1
;
select
*
from
t2
;
show
status
like
"Qcache_queries_in_cache"
;
lock
table
t1
write
,
t2
read
;
show
status
like
"Qcache_queries_in_cache"
;
unlock
table
;
drop
table
t1
,
t2
;
set
query_cache_wlock_invalidate
=
default
;
set
GLOBAL
query_cache_size
=
0
;
sql/mysqld.cc
View file @
d03034d3
...
...
@@ -3228,7 +3228,7 @@ enum options_mysqld {
OPT_NET_READ_TIMEOUT
,
OPT_NET_WRITE_TIMEOUT
,
OPT_OPEN_FILES_LIMIT
,
OPT_QUERY_CACHE_LIMIT
,
OPT_QUERY_CACHE_SIZE
,
OPT_QUERY_CACHE_TYPE
,
OPT_RECORD_BUFFER
,
OPT_QUERY_CACHE_TYPE
,
OPT_
QUERY_CACHE_WLOCK_INVALIDATE
,
OPT_
RECORD_BUFFER
,
OPT_RECORD_RND_BUFFER
,
OPT_RELAY_LOG_SPACE_LIMIT
,
OPT_SLAVE_NET_TIMEOUT
,
OPT_SLAVE_COMPRESSED_PROTOCOL
,
OPT_SLOW_LAUNCH_TIME
,
OPT_READONLY
,
OPT_DEBUGGING
,
...
...
@@ -4015,12 +4015,17 @@ this value; if zero (the default): when the size exceeds max_binlog_size. \
(
gptr
*
)
&
global_system_variables
.
query_cache_type
,
(
gptr
*
)
&
max_system_variables
.
query_cache_type
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1
,
0
,
2
,
0
,
1
,
0
},
{
"query_cache_wlock_invalidate"
,
OPT_QUERY_CACHE_WLOCK_INVALIDATE
,
"Invalidate queries in query cache on LOCK for write"
,
(
gptr
*
)
&
global_system_variables
.
query_cache_wlock_invalidate
,
(
gptr
*
)
&
max_system_variables
.
query_cache_wlock_invalidate
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
1
,
0
,
1
,
0
},
#endif
/*HAVE_QUERY_CACHE*/
{
"query_prealloc_size"
,
OPT_QUERY_PREALLOC_SIZE
,
"Persistent buffer for query parsing and execution"
,
(
gptr
*
)
&
global_system_variables
.
query_prealloc_size
,
(
gptr
*
)
&
max_system_variables
.
query_prealloc_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
QUERY_ALLOC_PREALLOC_SIZE
,
1024
,
~
0L
,
0
,
1024
,
0
},
#endif
/*HAVE_QUERY_CACHE*/
{
"read_buffer_size"
,
OPT_RECORD_BUFFER
,
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value."
,
(
gptr
*
)
&
global_system_variables
.
read_buff_size
,
...
...
sql/set_var.cc
View file @
d03034d3
...
...
@@ -229,6 +229,9 @@ sys_var_long_ptr sys_query_cache_limit("query_cache_limit",
sys_var_thd_enum
sys_query_cache_type
(
"query_cache_type"
,
&
SV
::
query_cache_type
,
&
query_cache_type_typelib
);
sys_var_thd_bool
sys_query_cache_wlock_invalidate
(
"query_cache_wlock_invalidate"
,
&
SV
::
query_cache_wlock_invalidate
);
#endif
/* HAVE_QUERY_CACHE */
sys_var_long_ptr
sys_server_id
(
"server_id"
,
&
server_id
);
sys_var_bool_ptr
sys_slave_compressed_protocol
(
"slave_compressed_protocol"
,
...
...
@@ -405,6 +408,7 @@ sys_var *sys_variables[]=
#ifdef HAVE_QUERY_CACHE
&
sys_query_cache_limit
,
&
sys_query_cache_type
,
&
sys_query_cache_wlock_invalidate
,
#endif
/* HAVE_QUERY_CACHE */
&
sys_quote_show_create
,
&
sys_rand_seed1
,
...
...
sql/sql_cache.cc
View file @
d03034d3
...
...
@@ -1090,6 +1090,37 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
DBUG_VOID_RETURN
;
}
/*
Invalidate locked for write
SYNOPSIS
Query_cache::invalidate_locked_for_write()
tables_used - table list
NOTE
can be used only for opened tables
*/
void
Query_cache
::
invalidate_locked_for_write
(
TABLE_LIST
*
tables_used
)
{
DBUG_ENTER
(
"Query_cache::invalidate (changed table list)"
);
if
(
query_cache_size
>
0
&&
tables_used
)
{
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
>
0
)
{
DUMP
(
this
);
for
(;
tables_used
;
tables_used
=
tables_used
->
next
)
{
if
(
tables_used
->
lock_type
&
(
TL_WRITE_LOW_PRIORITY
|
TL_WRITE
))
invalidate_table
(
tables_used
->
table
);
}
}
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
}
DBUG_VOID_RETURN
;
}
/*
Remove all cached queries that uses the given table
*/
...
...
sql/sql_cache.h
View file @
d03034d3
...
...
@@ -360,6 +360,7 @@ class Query_cache
void
invalidate
(
THD
*
thd
,
TABLE_LIST
*
tables_used
,
my_bool
using_transactions
);
void
invalidate
(
CHANGED_TABLE_LIST
*
tables_used
);
void
invalidate_locked_for_write
(
TABLE_LIST
*
tables_used
);
void
invalidate
(
THD
*
thd
,
TABLE
*
table
,
my_bool
using_transactions
);
void
invalidate
(
THD
*
thd
,
const
char
*
key
,
uint32
key_length
,
my_bool
using_transactions
);
...
...
sql/sql_class.h
View file @
d03034d3
...
...
@@ -336,6 +336,7 @@ struct system_variables
my_bool
log_warnings
;
my_bool
low_priority_updates
;
my_bool
new_mode
;
my_bool
query_cache_wlock_invalidate
;
CONVERT
*
convert_set
;
};
...
...
sql/sql_parse.cc
View file @
d03034d3
...
...
@@ -2307,8 +2307,12 @@ mysql_execute_command(void)
goto
error
;
thd
->
in_lock_tables
=
1
;
thd
->
options
|=
OPTION_TABLE_LOCK
;
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
tables
)))
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
tables
)))
{
#ifdef HAVE_QUERY_CACHE
if
(
thd
->
variables
.
query_cache_wlock_invalidate
)
query_cache
.
invalidate_locked_for_write
(
tables
);
#endif
/*HAVE_QUERY_CACHE*/
thd
->
locked_tables
=
thd
->
lock
;
thd
->
lock
=
0
;
send_ok
(
&
thd
->
net
);
...
...
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