mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Post review fixes.
This commit is contained in:
@ -52,7 +52,7 @@ typedef struct st_key_cache_statistics
|
|||||||
ulonglong writes; /* number of actual writes from buffers into files */
|
ulonglong writes; /* number of actual writes from buffers into files */
|
||||||
} KEY_CACHE_STATISTICS;
|
} KEY_CACHE_STATISTICS;
|
||||||
|
|
||||||
#define NO_LONG_KEY_CACHE_STAT_VARIABLES 3
|
#define NUM_LONG_KEY_CACHE_STAT_VARIABLES 3
|
||||||
|
|
||||||
/* The type of a key cache object */
|
/* The type of a key cache object */
|
||||||
typedef enum key_cache_type
|
typedef enum key_cache_type
|
||||||
|
@ -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_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_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 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 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_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
|
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_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
|
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 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_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_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)
|
3.0000 information_schema KEY_COLUMN_USAGE CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||||
|
@ -590,6 +590,29 @@ user_comment
|
|||||||
Separator -----------------------------------------------------
|
Separator -----------------------------------------------------
|
||||||
TABLE_CATALOG NULL
|
TABLE_CATALOG NULL
|
||||||
TABLE_SCHEMA information_schema
|
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_NAME KEY_COLUMN_USAGE
|
||||||
TABLE_TYPE SYSTEM VIEW
|
TABLE_TYPE SYSTEM VIEW
|
||||||
ENGINE MEMORY
|
ENGINE MEMORY
|
||||||
@ -1688,6 +1711,29 @@ user_comment
|
|||||||
Separator -----------------------------------------------------
|
Separator -----------------------------------------------------
|
||||||
TABLE_CATALOG NULL
|
TABLE_CATALOG NULL
|
||||||
TABLE_SCHEMA information_schema
|
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_NAME KEY_COLUMN_USAGE
|
||||||
TABLE_TYPE SYSTEM VIEW
|
TABLE_TYPE SYSTEM VIEW
|
||||||
ENGINE MEMORY
|
ENGINE MEMORY
|
||||||
|
@ -5158,6 +5158,7 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t mem_per_cache;
|
size_t mem_per_cache;
|
||||||
|
size_t mem_decr;
|
||||||
int cnt;
|
int cnt;
|
||||||
SIMPLE_KEY_CACHE_CB *partition;
|
SIMPLE_KEY_CACHE_CB *partition;
|
||||||
SIMPLE_KEY_CACHE_CB **partition_ptr;
|
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 *) *
|
(SIMPLE_KEY_CACHE_CB **) my_malloc(sizeof(SIMPLE_KEY_CACHE_CB *) *
|
||||||
partitions, MYF(MY_WME))))
|
partitions, MYF(MY_WME))))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
bzero(partition_ptr, sizeof(SIMPLE_KEY_CACHE_CB *) * partitions);
|
||||||
keycache->partition_array= partition_ptr;
|
keycache->partition_array= partition_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mem_decr= mem_per_cache / 5;
|
||||||
mem_per_cache = use_mem / partitions;
|
mem_per_cache = use_mem / partitions;
|
||||||
|
|
||||||
for (i= 0; i < (int) partitions; i++)
|
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;
|
partition->key_cache_inited= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cnt= init_simple_key_cache(partition,
|
cnt= init_simple_key_cache(partition, key_cache_block_size, mem_per_cache,
|
||||||
key_cache_block_size, mem_per_cache,
|
division_limit, age_threshold);
|
||||||
division_limit, age_threshold)) <= 0)
|
if (cnt <= 0)
|
||||||
{
|
{
|
||||||
end_simple_key_cache(partition, 1);
|
end_simple_key_cache(partition, 1);
|
||||||
my_free(partition, MYF(0));
|
if (!key_cache_inited)
|
||||||
partition= 0;
|
|
||||||
if (key_cache_inited)
|
|
||||||
{
|
{
|
||||||
memmove(partition_ptr, partition_ptr+1,
|
my_free(partition, MYF(0));
|
||||||
sizeof(partition_ptr)*(partitions-i-1));
|
partition= 0;
|
||||||
}
|
}
|
||||||
if (!--partitions)
|
if (i == 0 && cnt < 0 || i > 0)
|
||||||
break;
|
|
||||||
if (i == 0)
|
|
||||||
{
|
{
|
||||||
i--;
|
/*
|
||||||
mem_per_cache = use_mem / partitions;
|
Here we have two cases:
|
||||||
continue;
|
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;
|
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;
|
ulonglong res= 0;
|
||||||
DBUG_ENTER("get_partitioned_key_cache_stat_value");
|
DBUG_ENTER("get_partitioned_key_cache_stat_value");
|
||||||
|
|
||||||
if (var_no < NO_LONG_KEY_CACHE_STAT_VARIABLES)
|
if (var_no < NUM_LONG_KEY_CACHE_STAT_VARIABLES)
|
||||||
{
|
{
|
||||||
for (i = 0; i < partitions; i++)
|
for (i = 0; i < partitions; i++)
|
||||||
{
|
{
|
||||||
|
@ -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_read):
|
||||||
case offsetof(KEY_CACHE, global_cache_w_requests):
|
case offsetof(KEY_CACHE, global_cache_w_requests):
|
||||||
case offsetof(KEY_CACHE, global_cache_write):
|
case offsetof(KEY_CACHE, global_cache_write):
|
||||||
var_no= NO_LONG_KEY_CACHE_STAT_VARIABLES +
|
var_no= NUM_LONG_KEY_CACHE_STAT_VARIABLES +
|
||||||
(ofs-offsetof(KEY_CACHE, global_cache_w_requests))/
|
(ofs-offsetof(KEY_CACHE, global_cache_w_requests))/
|
||||||
sizeof(ulonglong);
|
sizeof(ulonglong);
|
||||||
*(ulonglong *)((char *) key_cache + ofs)=
|
*(ulonglong *)((char *) key_cache + ofs)=
|
||||||
|
Reference in New Issue
Block a user