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
5e774747
Commit
5e774747
authored
May 08, 2007
by
thek@adventure.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.1 -> 5.0 Manual merge for Bug #27792
parent
4744b0b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
5 deletions
+186
-5
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+94
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+72
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/set_var.cc
sql/set_var.cc
+5
-0
sql/sql_cache.cc
sql/sql_cache.cc
+14
-5
No files found.
mysql-test/r/query_cache.result
View file @
5e774747
...
@@ -1321,3 +1321,97 @@ insert into t1(c1) select c1 from v1;
...
@@ -1321,3 +1321,97 @@ insert into t1(c1) select c1 from v1;
drop table t1, t2, t3;
drop table t1, t2, t3;
drop view v1;
drop view v1;
set global query_cache_size=0;
set global query_cache_size=0;
create table t1 (a int);
insert into t1 values (1),(2),(3);
set GLOBAL query_cache_type=1;
set GLOBAL query_cache_limit=10000;
set GLOBAL query_cache_min_res_unit=0;
set GLOBAL query_cache_size= 100000;
reset query cache;
set LOCAL default_week_format = 0;
select week('2007-01-04');
week('2007-01-04')
0
select week('2007-01-04') from t1;
week('2007-01-04')
0
0
0
select extract(WEEK FROM '2007-01-04') from t1;
extract(WEEK FROM '2007-01-04')
0
0
0
set LOCAL default_week_format = 2;
select week('2007-01-04');
week('2007-01-04')
53
select week('2007-01-04') from t1;
week('2007-01-04')
53
53
53
select extract(WEEK FROM '2007-01-04') from t1;
extract(WEEK FROM '2007-01-04')
53
53
53
reset query cache;
set LOCAL div_precision_increment=2;
select 1/7;
1/7
0.14
select 1/7 from t1;
1/7
0.14
0.14
0.14
set LOCAL div_precision_increment=4;
select 1/7;
1/7
0.1429
select 1/7 from t1;
1/7
0.1429
0.1429
0.1429
drop table t1;
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Full-text indexes', 'are called collections'),
('Only MyISAM tables','support collections'),
('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model');
set GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
a b x
MySQL has now support for full-text search 0
Full-text indexes are called collections 1
Only MyISAM tables support collections 0
Function MATCH ... AGAINST() is used to do a search 0
Full-text search in MySQL implements vector space model 0
set GLOBAL ft_boolean_syntax='- +><()~*:""&|';
select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
a b x
MySQL has now support for full-text search 0
Full-text indexes are called collections 0
Only MyISAM tables support collections 0
Function MATCH ... AGAINST() is used to do a search 0
Full-text search in MySQL implements vector space model 0
create function change_global() returns integer
begin
set global ft_boolean_syntax='+ -><()~*:""&|';
return 1;
end|
select *, change_global() from t1;
a b change_global()
MySQL has now support for full-text search 1
Full-text indexes are called collections 1
Only MyISAM tables support collections 1
Function MATCH ... AGAINST() is used to do a search 1
Full-text search in MySQL implements vector space model 1
drop function change_global;
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size= default;
mysql-test/t/query_cache.test
View file @
5e774747
...
@@ -899,3 +899,75 @@ insert into t1(c1) select c1 from v1;
...
@@ -899,3 +899,75 @@ insert into t1(c1) select c1 from v1;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
drop
view
v1
;
drop
view
v1
;
set
global
query_cache_size
=
0
;
set
global
query_cache_size
=
0
;
#
# Query cache and changes to system variables
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),(
2
),(
3
);
set
GLOBAL
query_cache_type
=
1
;
set
GLOBAL
query_cache_limit
=
10000
;
set
GLOBAL
query_cache_min_res_unit
=
0
;
set
GLOBAL
query_cache_size
=
100000
;
# default_week_format
reset
query
cache
;
set
LOCAL
default_week_format
=
0
;
select
week
(
'2007-01-04'
);
select
week
(
'2007-01-04'
)
from
t1
;
select
extract
(
WEEK
FROM
'2007-01-04'
)
from
t1
;
set
LOCAL
default_week_format
=
2
;
select
week
(
'2007-01-04'
);
select
week
(
'2007-01-04'
)
from
t1
;
select
extract
(
WEEK
FROM
'2007-01-04'
)
from
t1
;
# div_precision_increment
reset
query
cache
;
set
LOCAL
div_precision_increment
=
2
;
select
1
/
7
;
select
1
/
7
from
t1
;
set
LOCAL
div_precision_increment
=
4
;
select
1
/
7
;
select
1
/
7
from
t1
;
drop
table
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
200
),
b
TEXT
,
FULLTEXT
(
a
,
b
));
INSERT
INTO
t1
VALUES
(
'MySQL has now support'
,
'for full-text search'
),
(
'Full-text indexes'
,
'are called collections'
),
(
'Only MyISAM tables'
,
'support collections'
),
(
'Function MATCH ... AGAINST()'
,
'is used to do a search'
),
(
'Full-text search in MySQL'
,
'implements vector space model'
);
set
GLOBAL
ft_boolean_syntax
=
'+ -><()~*:""&|'
;
select
*
,
MATCH
(
a
,
b
)
AGAINST
(
"+called +collections"
IN
BOOLEAN
MODE
)
as
x
from
t1
;
# swap +/-
set
GLOBAL
ft_boolean_syntax
=
'- +><()~*:""&|'
;
select
*
,
MATCH
(
a
,
b
)
AGAINST
(
"+called +collections"
IN
BOOLEAN
MODE
)
as
x
from
t1
;
# If in the future we need to cache queries with functions
# be sure not to cause dead lock if the query cache is flushed
# while inserting a query in the query cache.
delimiter
|
;
create
function
change_global
()
returns
integer
begin
set
global
ft_boolean_syntax
=
'+ -><()~*:""&|'
;
return
1
;
end
|
delimiter
;
|
select
*
,
change_global
()
from
t1
;
drop
function
change_global
;
set
GLOBAL
query_cache_type
=
default
;
set
GLOBAL
query_cache_limit
=
default
;
set
GLOBAL
query_cache_min_res_unit
=
default
;
set
GLOBAL
query_cache_size
=
default
;
# End of 5.0 tests
sql/mysql_priv.h
View file @
5e774747
...
@@ -643,6 +643,7 @@ struct Query_cache_query_flags
...
@@ -643,6 +643,7 @@ struct Query_cache_query_flags
ulong
max_sort_length
;
ulong
max_sort_length
;
ulong
group_concat_max_len
;
ulong
group_concat_max_len
;
ulong
default_week_format
;
ulong
default_week_format
;
ulong
div_precision_increment
;
MY_LOCALE
*
lc_time_names
;
MY_LOCALE
*
lc_time_names
;
};
};
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
...
...
sql/set_var.cc
View file @
5e774747
...
@@ -1200,6 +1200,11 @@ static bool sys_update_ftb_syntax(THD *thd, set_var * var)
...
@@ -1200,6 +1200,11 @@ static bool sys_update_ftb_syntax(THD *thd, set_var * var)
{
{
strmake
(
ft_boolean_syntax
,
var
->
value
->
str_value
.
c_ptr
(),
strmake
(
ft_boolean_syntax
,
var
->
value
->
str_value
.
c_ptr
(),
sizeof
(
ft_boolean_syntax
)
-
1
);
sizeof
(
ft_boolean_syntax
)
-
1
);
#ifdef HAVE_QUERY_CACHE
query_cache
.
flush
();
#endif
/* HAVE_QUERY_CACHE */
return
0
;
return
0
;
}
}
...
...
sql/sql_cache.cc
View file @
5e774747
...
@@ -865,10 +865,12 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
...
@@ -865,10 +865,12 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
lc_time_names
=
thd
->
variables
.
lc_time_names
;
flags
.
lc_time_names
=
thd
->
variables
.
lc_time_names
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
flags
.
div_precision_increment
=
thd
->
variables
.
div_precincrement
;
flags
.
default_week_format
=
thd
->
variables
.
default_week_format
;
DBUG_PRINT
(
"qcache"
,
(
"long %d, 4.1: %d, more results %d, pkt_nr: %d, \
DBUG_PRINT
(
"qcache"
,
(
"long %d, 4.1: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
sql mode: 0x%lx, sort len: %lu, conncat len: %lu
"
,
sql mode: 0x%lx, sort len: %lu, conncat len: %lu
, div_precision: %lu, \
(
int
)
flags
.
client_long_flag
,
def_week_frmt: %lu"
,
(
int
)
flags
.
client_protocol_41
,
(
int
)
flags
.
client_protocol_41
,
(
int
)
flags
.
more_results_exists
,
(
int
)
flags
.
more_results_exists
,
flags
.
pkt_nr
,
flags
.
pkt_nr
,
...
@@ -879,7 +881,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
...
@@ -879,7 +881,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
(
ulong
)
flags
.
time_zone
,
(
ulong
)
flags
.
time_zone
,
flags
.
sql_mode
,
flags
.
sql_mode
,
flags
.
max_sort_length
,
flags
.
max_sort_length
,
flags
.
group_concat_max_len
));
flags
.
group_concat_max_len
,
flags
.
div_precision_increment
,
flags
.
default_week_format
));
/*
/*
Make InnoDB to release the adaptive hash index latch before
Make InnoDB to release the adaptive hash index latch before
acquiring the query cache mutex.
acquiring the query cache mutex.
...
@@ -1107,10 +1111,13 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
...
@@ -1107,10 +1111,13 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
flags
.
sql_mode
=
thd
->
variables
.
sql_mode
;
flags
.
sql_mode
=
thd
->
variables
.
sql_mode
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
flags
.
div_precision_increment
=
thd
->
variables
.
div_precincrement
;
flags
.
default_week_format
=
thd
->
variables
.
default_week_format
;
flags
.
lc_time_names
=
thd
->
variables
.
lc_time_names
;
flags
.
lc_time_names
=
thd
->
variables
.
lc_time_names
;
DBUG_PRINT
(
"qcache"
,
(
"long %d, 4.1: %d, more results %d, pkt_nr: %d, \
DBUG_PRINT
(
"qcache"
,
(
"long %d, 4.1: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
CS client: %u, CS result: %u, CS conn: %u, limit: %lu, TZ: 0x%lx, \
sql mode: 0x%lx, sort len: %lu, conncat len: %lu"
,
sql mode: 0x%lx, sort len: %lu, conncat len: %lu, div_precision: %lu, \
def_week_frmt: %lu"
,
(
int
)
flags
.
client_long_flag
,
(
int
)
flags
.
client_long_flag
,
(
int
)
flags
.
client_protocol_41
,
(
int
)
flags
.
client_protocol_41
,
(
int
)
flags
.
more_results_exists
,
(
int
)
flags
.
more_results_exists
,
...
@@ -1122,7 +1129,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
...
@@ -1122,7 +1129,9 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu",
(
ulong
)
flags
.
time_zone
,
(
ulong
)
flags
.
time_zone
,
flags
.
sql_mode
,
flags
.
sql_mode
,
flags
.
max_sort_length
,
flags
.
max_sort_length
,
flags
.
group_concat_max_len
));
flags
.
group_concat_max_len
,
flags
.
div_precision_increment
,
flags
.
default_week_format
));
memcpy
((
void
*
)(
sql
+
(
tot_length
-
QUERY_CACHE_FLAGS_SIZE
)),
memcpy
((
void
*
)(
sql
+
(
tot_length
-
QUERY_CACHE_FLAGS_SIZE
)),
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
query_block
=
(
Query_cache_block
*
)
hash_search
(
&
queries
,
(
byte
*
)
sql
,
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