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
a37899a8
Commit
a37899a8
authored
Apr 05, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Post review fixes.
parent
8730d0a4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
20 deletions
+127
-20
include/keycache.h
include/keycache.h
+1
-1
mysql-test/suite/funcs_1/r/is_columns_is.result
mysql-test/suite/funcs_1/r/is_columns_is.result
+24
-0
mysql-test/suite/funcs_1/r/is_tables_is.result
mysql-test/suite/funcs_1/r/is_tables_is.result
+46
-0
mysys/mf_keycache.c
mysys/mf_keycache.c
+55
-18
sql/sql_show.cc
sql/sql_show.cc
+1
-1
No files found.
include/keycache.h
View file @
a37899a8
...
...
@@ -52,7 +52,7 @@ typedef struct st_key_cache_statistics
ulonglong
writes
;
/* number of actual writes from buffers into files */
}
KEY_CACHE_STATISTICS
;
#define N
O
_LONG_KEY_CACHE_STAT_VARIABLES 3
#define N
UM
_LONG_KEY_CACHE_STAT_VARIABLES 3
/* The type of a key cache object */
typedef
enum
key_cache_type
...
...
mysql-test/suite/funcs_1/r/is_columns_is.result
View file @
a37899a8
...
...
@@ -230,6 +230,18 @@ NULL information_schema INNODB_TRX trx_started 3 0000-00-00 00:00:00 NO datetime
NULL information_schema INNODB_TRX trx_state 2 NO varchar 13 39 NULL NULL utf8 utf8_general_ci varchar(13) select
NULL information_schema INNODB_TRX trx_wait_started 5 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
NULL information_schema INNODB_TRX trx_weight 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES BLOCK_SIZE 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES DIRTY_BLOCKS 8 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES FULL_SIZE 4 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES KEY_CACHE_NAME 1 NO varchar 192 576 NULL NULL utf8 utf8_general_ci varchar(192) select
NULL information_schema KEY_CACHES PARTITIONS 2 NULL YES int NULL NULL 10 0 NULL NULL int(3) unsigned select
NULL information_schema KEY_CACHES PARTITION_NUMBER 3 NULL YES int NULL NULL 10 0 NULL NULL int(3) unsigned select
NULL information_schema KEY_CACHES READS 10 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES READ_REQUESTS 9 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES UNUSED_BLOCKS 7 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES USED_BLOCKS 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES WRITES 12 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_CACHES WRITE_REQUESTS 11 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
NULL information_schema KEY_COLUMN_USAGE COLUMN_NAME 7 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
NULL information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
...
...
@@ -743,6 +755,18 @@ NULL information_schema INNODB_TRX trx_wait_started datetime NULL NULL NULL NULL
NULL information_schema INNODB_TRX trx_weight bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema INNODB_TRX trx_mysql_thread_id bigint NULL NULL NULL NULL bigint(21) unsigned
3.0000 information_schema INNODB_TRX trx_query varchar 1024 3072 utf8 utf8_general_ci varchar(1024)
3.0000 information_schema KEY_CACHES KEY_CACHE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema KEY_CACHES PARTITIONS int NULL NULL NULL NULL int(3) unsigned
NULL information_schema KEY_CACHES PARTITION_NUMBER int NULL NULL NULL NULL int(3) unsigned
NULL information_schema KEY_CACHES FULL_SIZE bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES BLOCK_SIZE bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES USED_BLOCKS bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES UNUSED_BLOCKS bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES DIRTY_BLOCKS bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES READ_REQUESTS bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES READS bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES WRITE_REQUESTS bigint NULL NULL NULL NULL bigint(21) unsigned
NULL information_schema KEY_CACHES WRITES bigint NULL NULL NULL NULL bigint(21) unsigned
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
...
...
mysql-test/suite/funcs_1/r/is_tables_is.result
View file @
a37899a8
...
...
@@ -590,6 +590,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG NULL
TABLE_SCHEMA information_schema
TABLE_NAME KEY_CACHES
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 10
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG NULL
TABLE_SCHEMA information_schema
TABLE_NAME KEY_COLUMN_USAGE
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
...
...
@@ -1688,6 +1711,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG NULL
TABLE_SCHEMA information_schema
TABLE_NAME KEY_CACHES
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 10
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG NULL
TABLE_SCHEMA information_schema
TABLE_NAME KEY_COLUMN_USAGE
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
...
...
mysys/mf_keycache.c
View file @
a37899a8
...
...
@@ -5158,6 +5158,7 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
{
int
i
;
size_t
mem_per_cache
;
size_t
mem_decr
;
int
cnt
;
SIMPLE_KEY_CACHE_CB
*
partition
;
SIMPLE_KEY_CACHE_CB
**
partition_ptr
;
...
...
@@ -5175,9 +5176,11 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
(
SIMPLE_KEY_CACHE_CB
**
)
my_malloc
(
sizeof
(
SIMPLE_KEY_CACHE_CB
*
)
*
partitions
,
MYF
(
MY_WME
))))
DBUG_RETURN
(
-
1
);
bzero
(
partition_ptr
,
sizeof
(
SIMPLE_KEY_CACHE_CB
*
)
*
partitions
);
keycache
->
partition_array
=
partition_ptr
;
}
mem_decr
=
mem_per_cache
/
5
;
mem_per_cache
=
use_mem
/
partitions
;
for
(
i
=
0
;
i
<
(
int
)
partitions
;
i
++
)
...
...
@@ -5194,30 +5197,64 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
partition
->
key_cache_inited
=
0
;
}
if
((
cnt
=
init_simple_key_cache
(
partition
,
key_cache_block_size
,
mem_per_cache
,
division_limit
,
age_threshold
))
<=
0
)
cnt
=
init_simple_key_cache
(
partition
,
key_cache_block_size
,
mem_per_cache
,
division_limit
,
age_threshold
);
if
(
cnt
<=
0
)
{
end_simple_key_cache
(
partition
,
1
);
my_free
(
partition
,
MYF
(
0
));
partition
=
0
;
if
(
key_cache_inited
)
if
(
!
key_cache_inited
)
{
m
emmove
(
partition_ptr
,
partition_ptr
+
1
,
sizeof
(
partition_ptr
)
*
(
partitions
-
i
-
1
))
;
m
y_free
(
partition
,
MYF
(
0
));
partition
=
0
;
}
if
(
!--
partitions
)
break
;
if
(
i
==
0
)
if
(
i
==
0
&&
cnt
<
0
||
i
>
0
)
{
i
--
;
mem_per_cache
=
use_mem
/
partitions
;
continue
;
/*
Here we have two cases:
1. i == 0 and cnt < 0
cnt < 0 => mem_per_cache is not big enough to allocate minimal
number of key blocks in the key cache of the partition.
Decrease the the number of the partitions by 1 and start again.
2. i > 0
There is not enough memory for one of the succeeding partitions.
Just skip this partition decreasing the number of partitions in
the key cache by one.
Do not change the value of mem_per_cache in both cases.
*/
if
(
key_cache_inited
)
{
my_free
(
partition
,
MYF
(
0
));
partition
=
0
;
if
(
key_cache_inited
)
memmove
(
partition_ptr
,
partition_ptr
+
1
,
sizeof
(
partition_ptr
)
*
(
partitions
-
i
-
1
));
}
if
(
!--
partitions
)
break
;
}
else
{
/*
We come here when i == 0 && cnt == 0.
cnt == 0 => the memory allocator fails to allocate a block of
memory of the size mem_per_cache. Decrease the value of
mem_per_cache without changing the current number of partitions
and start again. Make sure that such a decrease may happen not
more than 5 times in total.
*/
if
(
use_mem
<=
mem_decr
)
break
;
use_mem
-=
mem_decr
;
}
i
--
;
mem_per_cache
=
use_mem
/
partitions
;
continue
;
}
else
{
blocks
+=
cnt
;
*
partition_ptr
++=
partition
;
}
blocks
+=
cnt
;
*
partition_ptr
++=
partition
;
}
keycache
->
partitions
=
partitions
=
partition_ptr
-
keycache
->
partition_array
;
...
...
@@ -5859,7 +5896,7 @@ get_partitioned_key_cache_stat_value(PARTITIONED_KEY_CACHE_CB *keycache,
ulonglong
res
=
0
;
DBUG_ENTER
(
"get_partitioned_key_cache_stat_value"
);
if
(
var_no
<
N
O
_LONG_KEY_CACHE_STAT_VARIABLES
)
if
(
var_no
<
N
UM
_LONG_KEY_CACHE_STAT_VARIABLES
)
{
for
(
i
=
0
;
i
<
partitions
;
i
++
)
{
...
...
sql/sql_show.cc
View file @
a37899a8
...
...
@@ -2265,7 +2265,7 @@ static void update_key_cache_stat_var(KEY_CACHE *key_cache, size_t ofs)
case
offsetof
(
KEY_CACHE
,
global_cache_read
):
case
offsetof
(
KEY_CACHE
,
global_cache_w_requests
):
case
offsetof
(
KEY_CACHE
,
global_cache_write
):
var_no
=
N
O
_LONG_KEY_CACHE_STAT_VARIABLES
+
var_no
=
N
UM
_LONG_KEY_CACHE_STAT_VARIABLES
+
(
ofs
-
offsetof
(
KEY_CACHE
,
global_cache_w_requests
))
/
sizeof
(
ulonglong
);
*
(
ulonglong
*
)((
char
*
)
key_cache
+
ofs
)
=
...
...
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