summaryrefslogtreecommitdiff
path: root/include/keycache.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2014-07-19 17:46:08 +0300
committerMichael Widenius <monty@askmonty.org>2014-07-19 17:46:08 +0300
commitf0f2072d1fe2616a734e3d100f251516c3f2e0b2 (patch)
treee49597b4ef92d725a4ccf0c6e85deb9dd81825e7 /include/keycache.h
parentff205b25d543f87c8b79afc3ea0013017e751cd9 (diff)
downloadmariadb-git-f0f2072d1fe2616a734e3d100f251516c3f2e0b2.tar.gz
Fixed problem with very slow shutdown when using 100,000 MyISAM tables with delay_key_write
Reason for the problem was that the hash of changed files in the key cache was too small (was 128). Fixed by making the hash size larger and changeable. - Introduced key-cache-file-hash-size (default 512) for MyISAM and aria_pagecache_file_hash_size (default 512) for Aria. - Added new status variable "Feature_delay_key_write" which counts number of tables opened that are using delay_key_write mysql-test/r/features.result: Added test of Feature_delay_key_write mysql-test/r/key_cache.result: Updated tests as the number of blocks has changed mysql-test/r/mysqld--help.result: Updated result mysql-test/suite/maria/maria3.result: Updated result mysql-test/suite/sys_vars/r/key_cache_file_hash_size_basic.result: Test new variable mysql-test/suite/sys_vars/t/aria_pagecache_file_hash_size_basic.test: Test new variable mysql-test/suite/sys_vars/t/key_cache_file_hash_size_basic.test: Test new variable mysql-test/t/features.test: Added test of Feature_delay_key_write mysql-test/t/key_cache.test: Updated tests as the number of blocks has changed mysys/mf_keycache.c: Made CHANGED_BLOCKS_HASH dynamic sql/handler.cc: Updated call to init_key_cache() sql/mysqld.cc: Added "Feature_delay_key_write" Added support for key-cache-file-hash-size sql/mysqld.h: Added support for key-cache-file-hash-size sql/sql_class.h: Added feature_files_opened_with_delayed_keys sql/sys_vars.cc: Added key_cache_file_hash_size storage/maria/ha_maria.cc: Added pagecache_file_hash_size Added counting of files with delay_key_write storage/maria/ma_checkpoint.c: Fixed compiler warning storage/maria/ma_pagecache.c: Made PAGECACHE_CHANGED_BLOCKS_HASH into a variable storage/maria/ma_pagecache.h: Made PAGECACHE_CHANGED_BLOCKS_HASH into a variable storage/maria/ma_rt_test.c: Updated parameters for init_pagecache() storage/maria/ma_test1.c: Updated parameters for init_pagecache() storage/maria/ma_test2.c: Updated parameters for init_pagecache() storage/maria/ma_test3.c: Updated parameters for init_pagecache() storage/maria/maria_chk.c: Updated parameters for init_pagecache() storage/maria/maria_ftdump.c: Updated parameters for init_pagecache() storage/maria/maria_pack.c: Updated parameters for init_pagecache() storage/maria/maria_read_log.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_pagecache_consist.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_pagecache_rwconsist.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_pagecache_rwconsist2.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_pagecache_single.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_multithread-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_noflush-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_nologs-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Updated parameters for init_pagecache() storage/maria/unittest/ma_test_loghandler_purge-t.c: Updated parameters for init_pagecache() storage/myisam/ha_myisam.cc: Added counting of files with delay_key_write storage/myisam/mi_check.c: Updated call to init_key_cache() storage/myisam/mi_test1.c: Updated call to init_key_cache() storage/myisam/mi_test2.c: Updated call to init_key_cache() storage/myisam/mi_test3.c: Updated call to init_key_cache() storage/myisam/mi_test_all.sh: Fixed broken test storage/myisam/myisam_ftdump.c: Updated call to init_key_cache() storage/myisam/myisamchk.c: Updated call to init_key_cache() storage/myisam/myisamlog.c: Updated call to init_key_cache()
Diffstat (limited to 'include/keycache.h')
-rw-r--r--include/keycache.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/keycache.h b/include/keycache.h
index 8fa9bf1cd18..85937ebefb9 100644
--- a/include/keycache.h
+++ b/include/keycache.h
@@ -67,11 +67,13 @@ typedef enum key_cache_type
typedef
int (*INIT_KEY_CACHE)
(void *, uint key_cache_block_size,
- size_t use_mem, uint division_limit, uint age_threshold);
+ size_t use_mem, uint division_limit, uint age_threshold,
+ uint changed_blocks_hash_size);
typedef
int (*RESIZE_KEY_CACHE)
(void *, uint key_cache_block_size,
- size_t use_mem, uint division_limit, uint age_threshold);
+ size_t use_mem, uint division_limit, uint age_threshold,
+ uint changed_blocks_hash_size);
typedef
void (*CHANGE_KEY_CACHE_PARAM)
(void *keycache_cb,
@@ -146,6 +148,7 @@ typedef struct st_key_cache
ulonglong param_division_limit;/* min. percentage of warm blocks */
ulonglong param_age_threshold; /* determines when hot block is downgraded */
ulonglong param_partitions; /* number of the key cache partitions */
+ ulonglong changed_blocks_hash_size; /* number of hash buckets for changed files */
my_bool key_cache_inited; /* <=> key cache has been created */
my_bool can_be_used; /* usage of cache for read/write is allowed */
my_bool in_init; /* set to 1 in MySQL during init/resize */
@@ -160,10 +163,11 @@ extern KEY_CACHE dflt_key_cache_var, *dflt_key_cache;
extern int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
size_t use_mem, uint division_limit,
- uint age_threshold, uint partitions);
+ uint age_threshold, uint changed_blocks_hash_size,
+ uint partitions);
extern int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
size_t use_mem, uint division_limit,
- uint age_threshold);
+ uint age_threshold, uint changed_blocks_hash_size);
extern void change_key_cache_param(KEY_CACHE *keycache, uint division_limit,
uint age_threshold);
extern uchar *key_cache_read(KEY_CACHE *keycache,
@@ -202,6 +206,7 @@ extern int repartition_key_cache(KEY_CACHE *keycache,
size_t use_mem,
uint division_limit,
uint age_threshold,
+ uint changed_blocks_hash_size,
uint partitions);
C_MODE_END
#endif /* _keycache_h */