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
4d87fd03
Commit
4d87fd03
authored
Mar 31, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug 209 (SQL_SELECT_LIMIT and query cache incompatibility)
parent
63cb5658
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
14 deletions
+49
-14
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+18
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+14
-3
sql/sql_cache.cc
sql/sql_cache.cc
+15
-10
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
No files found.
mysql-test/r/query_cache.result
View file @
4d87fd03
...
...
@@ -581,3 +581,21 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select * from t1;
a
1
2
SET OPTION SQL_SELECT_LIMIT=1;
select * from t1;
a
1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
mysql-test/t/query_cache.test
View file @
4d87fd03
...
...
@@ -401,7 +401,6 @@ select * from t1 where id=2;
#
# Load data invalidation test
#
create
table
t1
(
word
char
(
20
)
not
null
);
select
*
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
...
...
@@ -412,7 +411,6 @@ drop table t1;
#
# INTO OUTFILE/DUMPFILE test
#
drop
table
if
exists
t1
;
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),(
2
),(
3
);
...
...
@@ -420,4 +418,17 @@ show status like "Qcache_queries_in_cache";
select
*
from
t1
into
outfile
"query_caceh.out.file"
;
select
*
from
t1
limit
1
into
dumpfile
"query_cache.dump.file"
;
show
status
like
"Qcache_queries_in_cache"
;
drop
table
t1
;
\ No newline at end of file
drop
table
t1
;
#
# test of SQL_SELECT_LIMIT
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),(
2
);
show
status
like
"Qcache_queries_in_cache"
;
select
*
from
t1
;
SET
OPTION
SQL_SELECT_LIMIT
=
1
;
select
*
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
SET
OPTION
SQL_SELECT_LIMIT
=
DEFAULT
;
drop
table
t1
;
sql/sql_cache.cc
View file @
4d87fd03
...
...
@@ -743,11 +743,11 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
if
(
query_cache_size
==
0
)
DBUG_VOID_RETURN
;
if
((
local_tables
=
is_cacheable
(
thd
,
thd
->
query_length
,
if
((
local_tables
=
is_cacheable
(
thd
,
thd
->
query_length
,
thd
->
query
,
&
thd
->
lex
,
tables_used
)))
{
NET
*
net
=
&
thd
->
net
;
byte
flags
=
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
?
0x80
:
0
);
NET
*
net
=
&
thd
->
net
;
byte
flags
=
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
?
0x80
:
0
);
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
==
0
)
...
...
@@ -775,8 +775,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags
|=
(
byte
)
thd
->
variables
.
convert_set
->
number
();
DBUG_ASSERT
(
thd
->
variables
.
convert_set
->
number
()
<
128
);
}
tot_length
=
thd
->
query_length
+
thd
->
db_length
+
2
;
thd
->
query
[
tot_length
-
1
]
=
(
char
)
flags
;
tot_length
=
thd
->
query_length
+
thd
->
db_length
+
2
+
sizeof
(
ha_rows
);
thd
->
query
[
tot_length
-
1
]
=
(
char
)
flags
;
memcpy
((
void
*
)(
thd
->
query
+
(
tot_length
-
sizeof
(
ha_rows
)
-
1
)),
(
const
void
*
)
&
thd
->
variables
.
select_limit
,
sizeof
(
ha_rows
));
/* Check if another thread is processing the same query? */
Query_cache_block
*
competitor
=
(
Query_cache_block
*
)
...
...
@@ -910,7 +912,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
}
Query_cache_block
*
query_block
;
tot_length
=
query_length
+
thd
->
db_length
+
2
;
tot_length
=
query_length
+
thd
->
db_length
+
2
+
sizeof
(
ha_rows
)
;
if
(
thd
->
db_length
)
{
memcpy
(
sql
+
query_length
+
1
,
thd
->
db
,
thd
->
db_length
);
...
...
@@ -926,15 +928,18 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
Most significant bit - CLIENT_LONG_FLAG,
Other - charset number (0 no charset convertion)
*/
flags
=
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
?
0x80
:
0
);
flags
=
(
thd
->
client_capabilities
&
CLIENT_LONG_FLAG
?
0x80
:
0
);
if
(
thd
->
variables
.
convert_set
!=
0
)
{
flags
|=
(
byte
)
thd
->
variables
.
convert_set
->
number
();
flags
|=
(
byte
)
thd
->
variables
.
convert_set
->
number
();
DBUG_ASSERT
(
thd
->
variables
.
convert_set
->
number
()
<
128
);
}
sql
[
tot_length
-
1
]
=
(
char
)
flags
;
query_block
=
(
Query_cache_block
*
)
hash_search
(
&
queries
,
(
byte
*
)
sql
,
sql
[
tot_length
-
1
]
=
(
char
)
flags
;
memcpy
((
void
*
)(
sql
+
(
tot_length
-
sizeof
(
ha_rows
)
-
1
)),
(
const
void
*
)
&
thd
->
variables
.
select_limit
,
sizeof
(
ha_rows
));
query_block
=
(
Query_cache_block
*
)
hash_search
(
&
queries
,
(
byte
*
)
sql
,
tot_length
);
/* Quick abort on unlocked data */
if
(
query_block
==
0
||
query_block
->
query
()
->
result
()
==
0
||
...
...
sql/sql_parse.cc
View file @
4d87fd03
...
...
@@ -1029,7 +1029,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* We must allocate some extra memory for query cache */
if
(
!
(
thd
->
query
=
(
char
*
)
thd
->
memdup_w_gap
((
gptr
)
(
packet
),
packet_length
,
thd
->
db_length
+
2
)))
thd
->
db_length
+
2
+
sizeof
(
ha_rows
))))
break
;
thd
->
query
[
packet_length
]
=
0
;
thd
->
packet
.
shrink
(
thd
->
variables
.
net_buffer_length
);
// Reclaim some memory
...
...
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