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
bfdb6ca3
Commit
bfdb6ca3
authored
Jul 23, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store SERVER_MORE_RESULTS_EXISTS in key of query cache (BUG#6897)
parent
dcb4789d
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
163 additions
and
10 deletions
+163
-10
BitKeeper/etc/config
BitKeeper/etc/config
+1
-1
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+79
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+44
-1
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_cache.cc
sql/sql_cache.cc
+38
-8
No files found.
BitKeeper/etc/config
View file @
bfdb6ca3
...
...
@@ -24,7 +24,7 @@ description: MySQL - fast and reliable SQL database
# repository is commercial it can be an internal email address or "none"
# to disable logging.
#
logging:
logging@openlogging.org
logging:
none
#
# If this field is set, all checkins will appear to be made by this user,
# in effect making this a single user package. Single user packages are
...
...
mysql-test/r/query_cache.result
View file @
bfdb6ca3
This diff is collapsed.
Click to expand it.
mysql-test/t/query_cache.test
View file @
bfdb6ca3
...
...
@@ -616,6 +616,7 @@ set character_set_results=cp1251;
SELECT
a
,
''
,
''
=
''
FROM
t1
;
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_queries_in_cache"
;
SET
NAMES
default
;
DROP
TABLE
t1
;
...
...
@@ -711,9 +712,10 @@ repair table t1;
show
status
like
'qcache_queries_in_cache'
;
drop
table
t1
;
#
# Bug #9549: Make sure cached queries that span more than one cache block
# are handled properly in the embedded server.
#
# We just want a small query cache, so we can fragment it easily
set
GLOBAL
query_cache_size
=
64
*
1024
;
# This actually gives us a usable cache size of about 48K
...
...
@@ -755,6 +757,8 @@ select a from t1;
flush
query
cache
;
drop
table
t1
,
t2
;
set
GLOBAL
query_cache_size
=
1355776
#
# SP cursors and selects with query cache (BUG#9715)
...
...
@@ -788,4 +792,43 @@ drop procedure p1//
drop
table
t1
//
delimiter
;
//
#
# query in QC from normal execution and SP (BUG#6897)
#
flush
query
cache
;
reset
query
cache
;
flush
status
;
delimiter
//;
create
table
t1
(
s1
int
)
//
create
procedure
f1
()
begin
select
sql_cache
*
from
t1
;
select
sql_cache
*
from
t1
;
end
;
//
delimiter
;
//
call
f1
();
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
call
f1
();
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
call
f1
();
select
sql_cache
*
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
insert
into
t1
values
(
1
);
select
sql_cache
*
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
call
f1
();
call
f1
();
select
sql_cache
*
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
drop
procedure
f1
;
drop
table
t1
;
set
GLOBAL
query_cache_size
=
0
;
sql/mysql_priv.h
View file @
bfdb6ca3
...
...
@@ -521,6 +521,7 @@ struct Query_cache_query_flags
{
unsigned
int
client_long_flag
:
1
;
unsigned
int
client_protocol_41
:
1
;
unsigned
int
more_results_exists
:
1
;
uint
character_set_client_num
;
uint
character_set_results_num
;
uint
collation_connection_num
;
...
...
sql/sql_cache.cc
View file @
bfdb6ca3
...
...
@@ -775,10 +775,11 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
Query_cache_query_flags
flags
;
// fill all gaps between fields with 0 to get repeatable key
bzero
(
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
flags
.
client_long_flag
=
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
?
1
:
0
);
flags
.
client_protocol_41
=
(
thd
->
client_capabilities
&
CLIENT_PROTOCOL_41
?
1
:
0
);
flags
.
client_long_flag
=
test
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
);
flags
.
client_protocol_41
=
test
(
thd
->
client_capabilities
&
CLIENT_PROTOCOL_41
);
flags
.
more_results_exists
=
test
(
thd
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
);
flags
.
character_set_client_num
=
thd
->
variables
.
character_set_client
->
number
;
flags
.
character_set_results_num
=
...
...
@@ -792,6 +793,20 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags
.
sql_mode
=
thd
->
variables
.
sql_mode
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
DBUG_PRINT
(
"qcache"
,
(
"long %d, 4.1: %d, more results %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
sql mode: 0x%lx, sort len: %lu, conncat len: %lu"
,
(
int
)
flags
.
client_long_flag
,
(
int
)
flags
.
client_protocol_41
,
(
int
)
flags
.
more_results_exists
,
flags
.
character_set_client_num
,
flags
.
character_set_results_num
,
flags
.
collation_connection_num
,
flags
.
limit
,
(
ulong
)
flags
.
time_zone
,
flags
.
sql_mode
,
flags
.
max_sort_length
,
flags
.
group_concat_max_len
));
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
==
0
)
...
...
@@ -974,10 +989,11 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
// fill all gaps between fields with 0 to get repeatable key
bzero
(
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
flags
.
client_long_flag
=
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
?
1
:
0
);
flags
.
client_protocol_41
=
(
thd
->
client_capabilities
&
CLIENT_PROTOCOL_41
?
1
:
0
);
flags
.
client_long_flag
=
test
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
);
flags
.
client_protocol_41
=
test
(
thd
->
client_capabilities
&
CLIENT_PROTOCOL_41
);
flags
.
more_results_exists
=
test
(
thd
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
);
flags
.
character_set_client_num
=
thd
->
variables
.
character_set_client
->
number
;
flags
.
character_set_results_num
=
(
thd
->
variables
.
character_set_results
?
...
...
@@ -989,6 +1005,20 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
flags
.
sql_mode
=
thd
->
variables
.
sql_mode
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
DBUG_PRINT
(
"qcache"
,
(
"long %d, 4.1: %d, more results %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
sql mode: 0x%lx, sort len: %lu, conncat len: %lu"
,
(
int
)
flags
.
client_long_flag
,
(
int
)
flags
.
client_protocol_41
,
(
int
)
flags
.
more_results_exists
,
flags
.
character_set_client_num
,
flags
.
character_set_results_num
,
flags
.
collation_connection_num
,
flags
.
limit
,
(
ulong
)
flags
.
time_zone
,
flags
.
sql_mode
,
flags
.
max_sort_length
,
flags
.
group_concat_max_len
));
memcpy
((
void
*
)(
sql
+
(
tot_length
-
QUERY_CACHE_FLAGS_SIZE
)),
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
query_block
=
(
Query_cache_block
*
)
hash_search
(
&
queries
,
(
byte
*
)
sql
,
...
...
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