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
2266c99b
Commit
2266c99b
authored
Sep 15, 2003
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@213.136.52.20:/home/bk/mysql-4.1
into mysql.com:/home/mysql_src/mysql-4.1
parents
dcab920a
8d05911d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
7 deletions
+99
-7
mysql-test/r/ctype_mb.result
mysql-test/r/ctype_mb.result
+31
-0
mysql-test/r/innodb_cache.result
mysql-test/r/innodb_cache.result
+4
-4
mysql-test/t/ctype_mb.test
mysql-test/t/ctype_mb.test
+11
-0
sql/sql_cache.cc
sql/sql_cache.cc
+42
-0
sql/sql_cache.h
sql/sql_cache.h
+2
-0
sql/sql_show.cc
sql/sql_show.cc
+3
-1
sql/sql_table.cc
sql/sql_table.cc
+6
-2
No files found.
mysql-test/r/ctype_mb.result
View file @
2266c99b
...
@@ -19,3 +19,34 @@ SELECT * FROM t1;
...
@@ -19,3 +19,34 @@ SELECT * FROM t1;
c1 c2 c3
c1 c2 c3
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(4) character set utf8 default NULL,
KEY `key_a` (`a`(3))
) TYPE=MyISAM CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 key_a 1 a A NULL 9 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(4) default NULL,
KEY `key_a` (`a`(3))
) TYPE=MyISAM CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 key_a 1 a A NULL 3 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(4) character set utf8 default NULL,
KEY `key_a` (`a`(3))
) TYPE=MyISAM CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 key_a 1 a A NULL 9 NULL YES BTREE
DROP TABLE t1;
mysql-test/r/innodb_cache.result
View file @
2266c99b
...
@@ -10,7 +10,7 @@ a
...
@@ -10,7 +10,7 @@ a
3
3
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache
1
Qcache_queries_in_cache
0
drop table t1;
drop table t1;
commit;
commit;
set autocommit=1;
set autocommit=1;
...
@@ -24,7 +24,7 @@ a
...
@@ -24,7 +24,7 @@ a
3
3
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache
1
Qcache_queries_in_cache
0
drop table t1;
drop table t1;
commit;
commit;
create table t1 (a int not null) type=innodb;
create table t1 (a int not null) type=innodb;
...
@@ -90,14 +90,14 @@ a
...
@@ -90,14 +90,14 @@ a
2
2
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache
3
Qcache_queries_in_cache
1
show status like "Qcache_hits";
show status like "Qcache_hits";
Variable_name Value
Variable_name Value
Qcache_hits 4
Qcache_hits 4
commit;
commit;
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache
3
Qcache_queries_in_cache
1
drop table if exists t1;
drop table if exists t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=InnoDB;
select count(*) from t1;
select count(*) from t1;
...
...
mysql-test/t/ctype_mb.test
View file @
2266c99b
...
@@ -6,3 +6,14 @@ SHOW CREATE TABLE t1;
...
@@ -6,3 +6,14 @@ SHOW CREATE TABLE t1;
INSERT
INTO
t1
VALUES
(
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
);
INSERT
INTO
t1
VALUES
(
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
,
'aaaabbbbccccdddd'
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
CHAR
(
4
)
CHARACTER
SET
utf8
,
KEY
key_a
(
a
(
3
)));
SHOW
CREATE
TABLE
t1
;
SHOW
KEYS
FROM
t1
;
ALTER
TABLE
t1
CHANGE
a
a
CHAR
(
4
);
SHOW
CREATE
TABLE
t1
;
SHOW
KEYS
FROM
t1
;
ALTER
TABLE
t1
CHANGE
a
a
CHAR
(
4
)
CHARACTER
SET
utf8
;
SHOW
CREATE
TABLE
t1
;
SHOW
KEYS
FROM
t1
;
DROP
TABLE
t1
;
sql/sql_cache.cc
View file @
2266c99b
...
@@ -769,9 +769,18 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
...
@@ -769,9 +769,18 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
STRUCT_LOCK
(
&
structure_guard_mutex
);
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
==
0
)
if
(
query_cache_size
==
0
)
{
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
DUMP
(
this
);
DUMP
(
this
);
if
(
ask_handler_allowance
(
thd
,
tables_used
))
{
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
DBUG_VOID_RETURN
;
}
/* Key is query + database + flag */
/* Key is query + database + flag */
if
(
thd
->
db_length
)
if
(
thd
->
db_length
)
{
{
...
@@ -2548,6 +2557,39 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
...
@@ -2548,6 +2557,39 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
/*
Check handler allowence to cache query with this tables
SYNOPSYS
Query_cache::ask_handler_allowance()
thd - thread handlers
tables_used - tables list used in query
RETURN
0 - caching allowed
1 - caching disallowed
*/
my_bool
Query_cache
::
ask_handler_allowance
(
THD
*
thd
,
TABLE_LIST
*
tables_used
)
{
DBUG_ENTER
(
"Query_cache::is_cacheable"
);
for
(;
tables_used
;
tables_used
=
tables_used
->
next
)
{
TABLE
*
table
=
tables_used
->
table
;
if
(
!
handler
::
caching_allowed
(
thd
,
table
->
table_cache_key
,
table
->
key_length
,
table
->
file
->
table_cache_type
()))
{
DBUG_PRINT
(
"qcache"
,
(
"Handler does not allow caching for %s.%s"
,
tables_used
->
db
,
tables_used
->
alias
));
thd
->
lex
.
safe_to_cache_query
=
0
;
// Don't try to cache this
DBUG_RETURN
(
1
);
}
}
DBUG_RETURN
(
0
);
}
/*****************************************************************************
/*****************************************************************************
Packing
Packing
...
...
sql/sql_cache.h
View file @
2266c99b
...
@@ -345,6 +345,8 @@ class Query_cache
...
@@ -345,6 +345,8 @@ class Query_cache
TABLE_COUNTER_TYPE
is_cacheable
(
THD
*
thd
,
uint32
query_len
,
char
*
query
,
TABLE_COUNTER_TYPE
is_cacheable
(
THD
*
thd
,
uint32
query_len
,
char
*
query
,
LEX
*
lex
,
TABLE_LIST
*
tables_used
,
LEX
*
lex
,
TABLE_LIST
*
tables_used
,
uint8
*
tables_type
);
uint8
*
tables_type
);
static
my_bool
ask_handler_allowance
(
THD
*
thd
,
TABLE_LIST
*
tables_used
);
public:
public:
Query_cache
(
ulong
query_cache_limit
=
ULONG_MAX
,
Query_cache
(
ulong
query_cache_limit
=
ULONG_MAX
,
...
...
sql/sql_show.cc
View file @
2266c99b
...
@@ -1214,7 +1214,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
...
@@ -1214,7 +1214,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
!
(
key_info
->
flags
&
HA_FULLTEXT
)))
!
(
key_info
->
flags
&
HA_FULLTEXT
)))
{
{
buff
[
0
]
=
'('
;
buff
[
0
]
=
'('
;
char
*
end
=
int10_to_str
((
long
)
key_part
->
length
,
buff
+
1
,
10
);
char
*
end
=
int10_to_str
((
long
)
key_part
->
length
/
key_part
->
field
->
charset
()
->
mbmaxlen
,
buff
+
1
,
10
);
*
end
++
=
')'
;
*
end
++
=
')'
;
packet
->
append
(
buff
,(
uint
)
(
end
-
buff
));
packet
->
append
(
buff
,(
uint
)
(
end
-
buff
));
}
}
...
...
sql/sql_table.cc
View file @
2266c99b
...
@@ -729,6 +729,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -729,6 +729,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
*/
*/
if
(
key
->
type
==
Key
::
FULLTEXT
)
if
(
key
->
type
==
Key
::
FULLTEXT
)
column
->
length
=
test
(
f_is_blob
(
sql_field
->
pack_flag
));
column
->
length
=
test
(
f_is_blob
(
sql_field
->
pack_flag
));
else
column
->
length
*=
sql_field
->
charset
->
mbmaxlen
;
if
(
f_is_blob
(
sql_field
->
pack_flag
))
if
(
f_is_blob
(
sql_field
->
pack_flag
))
{
{
if
(
!
(
file
->
table_flags
()
&
HA_BLOB_KEY
))
if
(
!
(
file
->
table_flags
()
&
HA_BLOB_KEY
))
...
@@ -2099,10 +2102,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -2099,10 +2102,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
// Check if sub key
{
// Check if sub key
if
(
cfield
->
field
->
type
()
!=
FIELD_TYPE_BLOB
&&
if
(
cfield
->
field
->
type
()
!=
FIELD_TYPE_BLOB
&&
(
cfield
->
field
->
pack_length
()
==
key_part_length
||
(
cfield
->
field
->
pack_length
()
==
key_part_length
||
cfield
->
length
!=
cfield
->
pack_length
||
cfield
->
length
<=
key_part_length
/
cfield
->
pack_length
<=
key_part_length
))
key_part
->
field
->
charset
()
->
mbmaxlen
))
key_part_length
=
0
;
// Use whole field
key_part_length
=
0
;
// Use whole field
}
}
key_part_length
/=
key_part
->
field
->
charset
()
->
mbmaxlen
;
key_parts
.
push_back
(
new
key_part_spec
(
cfield
->
field_name
,
key_parts
.
push_back
(
new
key_part_spec
(
cfield
->
field_name
,
key_part_length
));
key_part_length
));
}
}
...
...
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