diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-08-11 23:55:41 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-08-11 23:55:41 -0400 |
commit | 8358dd53b7406deaa9f50ad09b16a86b7e367632 (patch) | |
tree | ef8995ad0e400cb6a1842649c3c886c7b3474835 /storage/maria | |
parent | e06e12f5b8dfe0ab2e5976eec1b27b25d318441b (diff) | |
parent | 4105cbf4a230c82ea7dee31d4d2262b798fad9f4 (diff) | |
download | mariadb-git-8358dd53b7406deaa9f50ad09b16a86b7e367632.tar.gz |
bzr merge -r4346 maria/10.0 (maria-10.0.13)
Diffstat (limited to 'storage/maria')
29 files changed, 163 insertions, 104 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 081e90f89f7..7155faa72f4 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -57,7 +57,7 @@ C_MODE_END #endif #define THD_TRN (*(TRN **)thd_ha_data(thd, maria_hton)) -ulong pagecache_division_limit, pagecache_age_threshold; +ulong pagecache_division_limit, pagecache_age_threshold, pagecache_file_hash_size; ulonglong pagecache_buffer_size; const char *zerofill_error_msg= "Table is from another system and must be zerofilled or repaired to be " @@ -250,6 +250,13 @@ static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit, "The minimum percentage of warm blocks in key cache", 0, 0, 100, 1, 100, 1); +static MYSQL_SYSVAR_ULONG(pagecache_file_hash_size, pagecache_file_hash_size, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Number of hash buckets for open and changed files. If you have a lot of Aria " + "files open you should increase this for faster flush of changes. A good " + "value is probably 1/10 of number of possible open Aria files.", 0,0, + 512, 128, 16384, 1); + static MYSQL_SYSVAR_SET(recover, maria_recover_options, PLUGIN_VAR_OPCMDARG, "Specifies how corrupted tables should be automatically repaired." " Possible values are one or more of \"NORMAL\" (the default), " @@ -1236,6 +1243,14 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) table->key_info[i].block_size= file->s->keyinfo[i].block_length; } my_errno= 0; + + /* Count statistics of usage for newly open normal files */ + if (file->s->reopen == 1 && ! (test_if_locked & HA_OPEN_TMP_TABLE)) + { + if (file->s->delay_key_write) + feature_files_opened_with_delayed_keys++; + } + return my_errno; } @@ -2819,7 +2834,8 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn) TRN *trn; int error; uint locked_tables; - TABLE *table; + DYNAMIC_ARRAY used_tables; + DBUG_ENTER("ha_maria::implicit_commit"); if (!maria_hton || !(trn= THD_TRN)) DBUG_RETURN(0); @@ -2835,7 +2851,38 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn) DBUG_PRINT("info", ("locked_tables, skipping")); DBUG_RETURN(0); } + locked_tables= trnman_has_locked_tables(trn); + + if (new_trn && trn && trn->used_tables) + { + MARIA_USED_TABLES *tables; + /* + Save locked tables so that we can move them to another transaction + We are using a dynamic array as locked_tables in some cases can be + smaller than the used_tables list (for example when the server does + early unlock of tables. + */ + + my_init_dynamic_array2(&used_tables, sizeof(MARIA_SHARE*), (void*) 0, + locked_tables, 8, MYF(MY_THREAD_SPECIFIC)); + for (tables= (MARIA_USED_TABLES*) trn->used_tables; + tables; + tables= tables->next) + { + if (tables->share->base.born_transactional) + { + if (insert_dynamic(&used_tables, (uchar*) &tables->share)) + { + error= HA_ERR_OUT_OF_MEM; + goto end_and_free; + } + } + } + } + else + bzero(&used_tables, sizeof(used_tables)); + error= 0; if (unlikely(ma_commit(trn))) error= 1; @@ -2859,7 +2906,7 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn) if (unlikely(trn == NULL)) { error= HA_ERR_OUT_OF_MEM; - goto end; + goto end_and_free; } /* Move all locked tables to the new transaction @@ -2868,13 +2915,21 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn) when we should call _ma_setup_live_state() and in some cases, like in check table, we use the table without calling start_stmt(). */ - for (table=thd->open_tables; table ; table=table->next) + + uint i; + for (i= 0 ; i < used_tables.elements ; i++) { - if (table->db_stat && table->file->ht == maria_hton) + MARIA_SHARE *share; + LIST *handlers; + + share= *(dynamic_element(&used_tables, i, MARIA_SHARE**)); + /* Find table instances that was used in this transaction */ + for (handlers= share->open_list; handlers; handlers= handlers->next) { - MARIA_HA *handler= ((ha_maria*) table->file)->file; - if (handler->s->base.born_transactional) - { + MARIA_HA *handler= (MARIA_HA*) handlers->data; + if (handler->external_ref && + ((TABLE*) handler->external_ref)->in_use == thd) + { _ma_set_trn_for_table(handler, trn); /* If handler uses versioning */ if (handler->s->lock_key_trees) @@ -2888,6 +2943,8 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn) /* This is just a commit, tables stay locked if they were: */ trnman_reset_locked_tables(trn, locked_tables); +end_and_free: + delete_dynamic(&used_tables); end: DBUG_RETURN(error); } @@ -3520,10 +3577,11 @@ static int ha_maria_init(void *p) mark_recovery_start(log_dir)) || !init_pagecache(maria_pagecache, (size_t) pagecache_buffer_size, pagecache_division_limit, - pagecache_age_threshold, maria_block_size, 0) || + pagecache_age_threshold, maria_block_size, pagecache_file_hash_size, + 0) || !init_pagecache(maria_log_pagecache, TRANSLOG_PAGECACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, 0) || + TRANSLOG_PAGE_SIZE, 0, 0) || translog_init(maria_data_root, log_file_size, MYSQL_VERSION_ID, server_id, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS, 0) || @@ -3639,6 +3697,7 @@ struct st_mysql_sys_var* system_variables[]= { MYSQL_SYSVAR(pagecache_age_threshold), MYSQL_SYSVAR(pagecache_buffer_size), MYSQL_SYSVAR(pagecache_division_limit), + MYSQL_SYSVAR(pagecache_file_hash_size), MYSQL_SYSVAR(recover), MYSQL_SYSVAR(repair_threads), MYSQL_SYSVAR(sort_buffer_size), @@ -3870,6 +3929,6 @@ maria_declare_plugin(aria) status_variables, /* status variables */ system_variables, /* system variables */ "1.5", /* string version */ - MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ + MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ } maria_declare_plugin_end; diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index e4adf5fbccd..de8a9610a64 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -230,7 +230,7 @@ static int really_execute_checkpoint(void) sizeof(checkpoint_start_log_horizon_char); for (i= 0; i < (sizeof(record_pieces)/sizeof(record_pieces[0])); i++) { - log_array[TRANSLOG_INTERNAL_PARTS + 1 + i].str= record_pieces[i].str; + log_array[TRANSLOG_INTERNAL_PARTS + 1 + i].str= (uchar*) record_pieces[i].str; log_array[TRANSLOG_INTERNAL_PARTS + 1 + i].length= record_pieces[i].length; total_rec_length+= (translog_size_t) record_pieces[i].length; } diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c index dd3a034425a..4532b029126 100644 --- a/storage/maria/ma_close.c +++ b/storage/maria/ma_close.c @@ -80,7 +80,10 @@ int maria_close(register MARIA_HA *info) } flag= !--share->reopen; if (!internal_table) - maria_open_list=list_delete(maria_open_list,&info->open_list); + { + maria_open_list= list_delete(maria_open_list,&info->open_list); + share->open_list= list_delete(share->open_list, &info->share_list); + } my_free(info->rec_buff); (*share->end)(info); @@ -91,6 +94,7 @@ int maria_close(register MARIA_HA *info) /* Check that we don't have any dangling pointers from the transaction */ DBUG_ASSERT(share->in_trans == 0); + DBUG_ASSERT(share->open_list == 0); if (share->kfile.file >= 0) { diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index e06084cef07..1d274d796be 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -211,8 +211,9 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share, const char *name, if (!internal_table) { - m_info->open_list.data=(void*) m_info; - maria_open_list=list_add(maria_open_list,&m_info->open_list); + m_info->open_list.data= m_info->share_list.data= (void*) m_info; + maria_open_list= list_add(maria_open_list, &m_info->open_list); + share->open_list= list_add(share->open_list, &m_info->share_list); } else { diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 8e8ecf945f0..bb085bbdc7a 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -502,7 +502,7 @@ static void test_key_cache(PAGECACHE *pagecache, #define PAGECACHE_HASH(p, f, pos) (((ulong) (pos) + \ (ulong) (f).file) & (p->hash_entries-1)) -#define FILE_HASH(f) ((uint) (f).file & (PAGECACHE_CHANGED_BLOCKS_HASH - 1)) +#define FILE_HASH(f,cache) ((uint) (f).file & (cache->changed_blocks_hash_size-1)) #define DEFAULT_PAGECACHE_DEBUG_LOG "pagecache_debug.log" @@ -743,7 +743,8 @@ static inline uint next_power(uint value) ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, uint division_limit, uint age_threshold, - uint block_size, myf my_readwrite_flags) + uint block_size, uint changed_blocks_hash_size, + myf my_readwrite_flags) { ulong blocks, hash_links, length; int error; @@ -786,6 +787,10 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, 2 * sizeof(PAGECACHE_HASH_LINK) + sizeof(PAGECACHE_HASH_LINK*) * 5/4 + block_size)); + /* Changed blocks hash needs to be a power of 2 */ + changed_blocks_hash_size= my_round_up_to_next_power(MY_MAX(changed_blocks_hash_size, + MIN_PAGECACHE_CHANGED_BLOCKS_HASH_SIZE)); + /* We need to support page cache with just one block to be able to do scanning of rows-in-block files @@ -809,10 +814,11 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, hash_links= MAX_THREADS + blocks - 1; #endif while ((length= (ALIGN_SIZE(blocks * sizeof(PAGECACHE_BLOCK_LINK)) + - ALIGN_SIZE(hash_links * sizeof(PAGECACHE_HASH_LINK)) + ALIGN_SIZE(sizeof(PAGECACHE_HASH_LINK*) * - pagecache->hash_entries))) + - (blocks << pagecache->shift) > use_mem) + pagecache->hash_entries) + + ALIGN_SIZE(hash_links * sizeof(PAGECACHE_HASH_LINK)) + + sizeof(PAGECACHE_BLOCK_LINK*)* (changed_blocks_hash_size*2))) + + (blocks << pagecache->shift) > use_mem && blocks > 8) blocks--; /* Allocate memory for cache page buffers */ if ((pagecache->block_mem= @@ -823,8 +829,17 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, Allocate memory for blocks, hash_links and hash entries; For each block 2 hash links are allocated */ - if ((pagecache->block_root= - (PAGECACHE_BLOCK_LINK*) my_malloc((size_t) length, MYF(0)))) + if (my_multi_malloc(MYF(MY_ZEROFILL), + &pagecache->block_root, blocks * sizeof(PAGECACHE_BLOCK_LINK), + &pagecache->hash_root, + sizeof(PAGECACHE_HASH_LINK*) * pagecache->hash_entries, + &pagecache->hash_link_root, + hash_links * sizeof(PAGECACHE_HASH_LINK), + &pagecache->changed_blocks, + sizeof(PAGECACHE_BLOCK_LINK*) * changed_blocks_hash_size, + &pagecache->file_blocks, + sizeof(PAGECACHE_BLOCK_LINK*) * changed_blocks_hash_size, + NullS)) break; my_large_free(pagecache->block_mem); pagecache->block_mem= 0; @@ -834,19 +849,6 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, pagecache->blocks_unused= blocks; pagecache->disk_blocks= (long) blocks; pagecache->hash_links= hash_links; - pagecache->hash_root= - (PAGECACHE_HASH_LINK**) ((char*) pagecache->block_root + - ALIGN_SIZE(blocks*sizeof(PAGECACHE_BLOCK_LINK))); - pagecache->hash_link_root= - (PAGECACHE_HASH_LINK*) ((char*) pagecache->hash_root + - ALIGN_SIZE((sizeof(PAGECACHE_HASH_LINK*) * - pagecache->hash_entries))); - bzero((uchar*) pagecache->block_root, - pagecache->disk_blocks * sizeof(PAGECACHE_BLOCK_LINK)); - bzero((uchar*) pagecache->hash_root, - pagecache->hash_entries * sizeof(PAGECACHE_HASH_LINK*)); - bzero((uchar*) pagecache->hash_link_root, - pagecache->hash_links * sizeof(PAGECACHE_HASH_LINK)); pagecache->hash_links_used= 0; pagecache->free_hash_list= NULL; pagecache->blocks_used= pagecache->blocks_changed= 0; @@ -866,6 +868,7 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, pagecache->age_threshold= (age_threshold ? blocks * age_threshold / 100 : blocks); + pagecache->changed_blocks_hash_size= changed_blocks_hash_size; pagecache->cnt_for_resize_op= 0; pagecache->resize_in_flush= 0; @@ -879,12 +882,6 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, pagecache->disk_blocks, (long) pagecache->block_root, pagecache->hash_entries, (long) pagecache->hash_root, pagecache->hash_links, (long) pagecache->hash_link_root)); - bzero((uchar*) pagecache->changed_blocks, - sizeof(pagecache->changed_blocks[0]) * - PAGECACHE_CHANGED_BLOCKS_HASH); - bzero((uchar*) pagecache->file_blocks, - sizeof(pagecache->file_blocks[0]) * - PAGECACHE_CHANGED_BLOCKS_HASH); pagecache->blocks= pagecache->disk_blocks > 0 ? pagecache->disk_blocks : 0; DBUG_RETURN((ulong) pagecache->disk_blocks); @@ -980,12 +977,11 @@ static int flush_all_key_blocks(PAGECACHE *pagecache) #if NOT_USED /* keep disabled until code is fixed see above !! */ ulong resize_pagecache(PAGECACHE *pagecache, size_t use_mem, uint division_limit, - uint age_threshold) + uint age_threshold, uint changed_blocks_hash_size) { ulong blocks; struct st_my_thread_var *thread; WQUEUE *wqueue; - DBUG_ENTER("resize_pagecache"); if (!pagecache->inited) @@ -1028,7 +1024,7 @@ ulong resize_pagecache(PAGECACHE *pagecache, end_pagecache(pagecache, 0); /* Don't free mutex */ /* The following will work even if use_mem is 0 */ blocks= init_pagecache(pagecache, pagecache->block_size, use_mem, - division_limit, age_threshold, + division_limit, age_threshold, changed_blocks_hash_size, pagecache->readwrite_flags); finish: @@ -1237,7 +1233,7 @@ static void link_to_file_list(PAGECACHE *pagecache, { if (unlink_flag) unlink_changed(block); - link_changed(block, &pagecache->file_blocks[FILE_HASH(*file)]); + link_changed(block, &pagecache->file_blocks[FILE_HASH(*file, pagecache)]); if (block->status & PCBLOCK_CHANGED) { block->status&= ~(PCBLOCK_CHANGED | PCBLOCK_DEL_WRITE); @@ -1258,7 +1254,7 @@ static inline void link_to_changed_list(PAGECACHE *pagecache, { unlink_changed(block); link_changed(block, - &pagecache->changed_blocks[FILE_HASH(block->hash_link->file)]); + &pagecache->changed_blocks[FILE_HASH(block->hash_link->file, pagecache)]); block->status|=PCBLOCK_CHANGED; pagecache->blocks_changed++; pagecache->global_blocks_changed++; @@ -4578,7 +4574,7 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache, Count how many key blocks we have to cache to be able to flush all dirty pages with minimum seek moves. */ - for (block= pagecache->changed_blocks[FILE_HASH(*file)] ; + for (block= pagecache->changed_blocks[FILE_HASH(*file, pagecache)] ; block; block= block->next_changed) { @@ -4603,7 +4599,7 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache, /* Retrieve the blocks and write them to a buffer to be flushed */ restart: end= (pos= cache)+count; - for (block= pagecache->changed_blocks[FILE_HASH(*file)] ; + for (block= pagecache->changed_blocks[FILE_HASH(*file, pagecache)] ; block; block= next) { @@ -4729,7 +4725,7 @@ restart: #if defined(PAGECACHE_DEBUG) cnt=0; #endif - for (block= pagecache->file_blocks[FILE_HASH(*file)] ; + for (block= pagecache->file_blocks[FILE_HASH(*file, pagecache)] ; block; block= next) { @@ -4918,7 +4914,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache, } /* Count how many dirty pages are interesting */ - for (file_hash= 0; file_hash < PAGECACHE_CHANGED_BLOCKS_HASH; file_hash++) + for (file_hash= 0; file_hash < pagecache->changed_blocks_hash_size; file_hash++) { PAGECACHE_BLOCK_LINK *block; for (block= pagecache->changed_blocks[file_hash] ; @@ -4957,7 +4953,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache, DBUG_PRINT("info", ("found %lu dirty pages", stored_list_size)); if (stored_list_size == 0) goto end; - for (file_hash= 0; file_hash < PAGECACHE_CHANGED_BLOCKS_HASH; file_hash++) + for (file_hash= 0; file_hash < pagecache->changed_blocks_hash_size; file_hash++) { PAGECACHE_BLOCK_LINK *block; for (block= pagecache->changed_blocks[file_hash] ; @@ -5008,7 +5004,7 @@ void pagecache_file_no_dirty_page(PAGECACHE *pagecache, PAGECACHE_FILE *file) { File fd= file->file; PAGECACHE_BLOCK_LINK *block; - for (block= pagecache->changed_blocks[FILE_HASH(*file)]; + for (block= pagecache->changed_blocks[FILE_HASH(*file, pagecache)]; block != NULL; block= block->next_changed) if (block->hash_link->file.file == fd) diff --git a/storage/maria/ma_pagecache.h b/storage/maria/ma_pagecache.h index 8460eaddc57..f7ddb2fe716 100644 --- a/storage/maria/ma_pagecache.h +++ b/storage/maria/ma_pagecache.h @@ -104,7 +104,9 @@ typedef struct st_pagecache_hash_link PAGECACHE_HASH_LINK; #include <wqueue.h> -#define PAGECACHE_CHANGED_BLOCKS_HASH 128 /* must be power of 2 */ +/* Default size of hash for changed files */ +#define MIN_PAGECACHE_CHANGED_BLOCKS_HASH_SIZE 512 + #define PAGECACHE_PRIORITY_LOW 0 #define PAGECACHE_PRIORITY_DEFAULT 3 #define PAGECACHE_PRIORITY_HIGH 6 @@ -121,6 +123,7 @@ typedef struct st_pagecache ulong age_threshold; /* age threshold for hot blocks */ ulonglong time; /* total number of block link operations */ ulong hash_entries; /* max number of entries in the hash table */ + ulong changed_blocks_hash_size; /* Number of hash buckets for file blocks */ long hash_links; /* max number of hash links */ long hash_links_used; /* number of hash links taken from free links pool */ long disk_blocks; /* max number of blocks in the cache */ @@ -145,9 +148,9 @@ typedef struct st_pagecache WQUEUE waiting_for_hash_link;/* waiting for a free hash link */ WQUEUE waiting_for_block; /* requests waiting for a free block */ /* hash for dirty file bl.*/ - PAGECACHE_BLOCK_LINK *changed_blocks[PAGECACHE_CHANGED_BLOCKS_HASH]; + PAGECACHE_BLOCK_LINK **changed_blocks; /* hash for other file bl.*/ - PAGECACHE_BLOCK_LINK *file_blocks[PAGECACHE_CHANGED_BLOCKS_HASH]; + PAGECACHE_BLOCK_LINK **file_blocks; /* The following variables are and variables used to hold parameters for @@ -195,10 +198,11 @@ extern PAGECACHE dflt_pagecache_var, *dflt_pagecache; extern ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, uint division_limit, uint age_threshold, - uint block_size, myf my_read_flags); + uint block_size, uint changed_blocks_hash_size, + myf my_read_flags); extern ulong resize_pagecache(PAGECACHE *pagecache, size_t use_mem, uint division_limit, - uint age_threshold); + uint age_threshold, uint changed_blocks_hash_size); extern void change_pagecache_param(PAGECACHE *pagecache, uint division_limit, uint age_threshold); diff --git a/storage/maria/ma_rt_test.c b/storage/maria/ma_rt_test.c index 29244bab6ce..9d8574212ca 100644 --- a/storage/maria/ma_rt_test.c +++ b/storage/maria/ma_rt_test.c @@ -100,11 +100,11 @@ int main(int argc, char *argv[]) /* Maria requires that we always have a page cache */ if (maria_init() || (init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0, - maria_block_size, MY_WME) == 0) || + maria_block_size, 0, MY_WME) == 0) || ma_control_file_open(TRUE, TRUE) || (init_pagecache(maria_log_pagecache, TRANSLOG_PAGECACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, MY_WME) == 0) || + TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || translog_init(maria_data_root, TRANSLOG_FILE_SIZE, 0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS, 0) || diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c index f130da21d07..0c673ded04e 100644 --- a/storage/maria/ma_state.c +++ b/storage/maria/ma_state.c @@ -240,6 +240,7 @@ void _ma_reset_state(MARIA_HA *info) MARIA_STATE_HISTORY *history= share->state_history; DBUG_ENTER("_ma_reset_state"); + /* Always true if share->now_transactional is set */ if (history) { MARIA_STATE_HISTORY *next; @@ -769,7 +770,7 @@ void _ma_copy_nontrans_state_information(MARIA_HA *info) /** Reset history - This is only called during repair when we the only one using the table. + This is only called during repair when we are the only one using the table. */ void _ma_reset_history(MARIA_SHARE *share) diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c index 595b87ef4d0..901a7ef06e3 100644 --- a/storage/maria/ma_test1.c +++ b/storage/maria/ma_test1.c @@ -79,11 +79,11 @@ int main(int argc,char *argv[]) /* Maria requires that we always have a page cache */ if (maria_init() || (init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0, - maria_block_size, MY_WME) == 0) || + maria_block_size, 0, MY_WME) == 0) || ma_control_file_open(TRUE, TRUE) || (init_pagecache(maria_log_pagecache, TRANSLOG_PAGECACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, MY_WME) == 0) || + TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || translog_init(maria_data_root, TRANSLOG_FILE_SIZE, 0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS, 0) || diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c index 52c0839cff6..709a190c1a7 100644 --- a/storage/maria/ma_test2.c +++ b/storage/maria/ma_test2.c @@ -91,11 +91,11 @@ int main(int argc, char *argv[]) /* Maria requires that we always have a page cache */ if (maria_init() || (init_pagecache(maria_pagecache, pagecache_size, 0, 0, - maria_block_size, MY_WME) == 0) || + maria_block_size, 0, MY_WME) == 0) || ma_control_file_open(TRUE, TRUE) || (init_pagecache(maria_log_pagecache, TRANSLOG_PAGECACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, MY_WME) == 0) || + TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || translog_init(maria_data_root, TRANSLOG_FILE_SIZE, 0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS, 0) || diff --git a/storage/maria/ma_test3.c b/storage/maria/ma_test3.c index 64b22e45c1b..5d57bef8f9e 100644 --- a/storage/maria/ma_test3.c +++ b/storage/maria/ma_test3.c @@ -178,7 +178,7 @@ void start_test(int id) exit(1); } if (pagecacheing && rnd(2) == 0) - init_pagecache(maria_pagecache, 65536L, 0, 0, MARIA_KEY_BLOCK_LENGTH, + init_pagecache(maria_pagecache, 65536L, 0, 0, MARIA_KEY_BLOCK_LENGTH, 0, MY_WME); printf("Process %d, pid: %ld\n",id,(long) getpid()); fflush(stdout); diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 9235d5ee96a..2ea647ea1f5 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -140,7 +140,7 @@ int main(int argc, char **argv) { if (init_pagecache(maria_log_pagecache, TRANSLOG_PAGECACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, MY_WME) == 0 || + TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0 || translog_init(opt_log_dir, TRANSLOG_FILE_SIZE, 0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS, 0)) @@ -1178,7 +1178,7 @@ static int maria_chk(HA_CHECK *param, char *filename) maria_lock_database(info, F_EXTRA_LCK); datafile= info->dfile.file; if (init_pagecache(maria_pagecache, (size_t) param->use_buffers, 0, 0, - maria_block_size, MY_WME) == 0) + maria_block_size, 0, MY_WME) == 0) { _ma_check_print_error(param, "Can't initialize page cache with %lu memory", (ulong) param->use_buffers); diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index ab4ade30c44..b878aaa0f7d 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -364,6 +364,7 @@ typedef struct st_maria_share LEX_STRING index_file_name; LEX_STRING open_file_name; /* parameter to open filename */ uchar *file_map; /* mem-map of file if possible */ + LIST *open_list; /* Tables open with this share */ PAGECACHE *pagecache; /* ref to the current key cache */ MARIA_DECODE_TREE *decode_trees; /* @@ -629,6 +630,7 @@ struct st_maria_handler PAGECACHE_FILE dfile; /* The datafile */ IO_CACHE rec_cache; /* When cacheing records */ LIST open_list; + LIST share_list; MY_BITMAP changed_fields; ulong row_base_length; /* Length of row header */ uint row_flag; /* Flag to store in row header */ diff --git a/storage/maria/maria_ftdump.c b/storage/maria/maria_ftdump.c index 68e13a8ddc4..4e34678c8f8 100644 --- a/storage/maria/maria_ftdump.c +++ b/storage/maria/maria_ftdump.c @@ -85,7 +85,7 @@ int main(int argc,char *argv[]) } init_pagecache(maria_pagecache, PAGE_BUFFER_INIT, 0, 0, - MARIA_KEY_BLOCK_LENGTH, MY_WME); + MARIA_KEY_BLOCK_LENGTH, 0, MY_WME); if (!(info=maria_open(argv[0], O_RDONLY, HA_OPEN_ABORT_IF_LOCKED|HA_OPEN_FROM_SQL_LAYER))) diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c index 26d57ade59a..7eca9e14e93 100644 --- a/storage/maria/maria_pack.c +++ b/storage/maria/maria_pack.c @@ -511,7 +511,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) fn_format(org_name,isam_file->s->open_file_name.str, "",MARIA_NAME_DEXT, 2+4+16); if (init_pagecache(maria_pagecache, MARIA_MIN_PAGE_CACHE_SIZE, 0, 0, - maria_block_size, MY_WME) == 0) + maria_block_size, 0, MY_WME) == 0) { fprintf(stderr, "Can't initialize page cache\n"); goto err; diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c index f5b91f9628f..8fa6533bc46 100644 --- a/storage/maria/maria_read_log.c +++ b/storage/maria/maria_read_log.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) goto err; } if (init_pagecache(maria_pagecache, opt_page_buffer_size, 0, 0, - maria_block_size, MY_WME) == 0) + maria_block_size, 0, MY_WME) == 0) { fprintf(stderr, "Got error in init_pagecache() (errno: %d)\n", errno); goto err; @@ -82,7 +82,7 @@ int main(int argc, char **argv) which is useless. TODO: start log handler in read-only mode. */ if (init_pagecache(maria_log_pagecache, opt_translog_buffer_size, - 0, 0, TRANSLOG_PAGE_SIZE, MY_WME) == 0 || + 0, 0, TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0 || translog_init(maria_data_root, TRANSLOG_FILE_SIZE, 0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS, opt_display_only)) diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c index 6a25a47591c..5f0e25b5bf4 100644 --- a/storage/maria/unittest/ma_pagecache_consist.c +++ b/storage/maria/unittest/ma_pagecache_consist.c @@ -431,7 +431,7 @@ int main(int argc __attribute__((unused)), #endif if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TEST_PAGE_SIZE, 0)) == 0) + TEST_PAGE_SIZE, 0, 0)) == 0) { diag("Got error: init_pagecache() (errno: %d)\n", errno); diff --git a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c index 7afdbfd0ac1..1a268db6ad5 100644 --- a/storage/maria/unittest/ma_pagecache_rwconsist.c +++ b/storage/maria/unittest/ma_pagecache_rwconsist.c @@ -301,7 +301,7 @@ int main(int argc __attribute__((unused)), #endif if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TEST_PAGE_SIZE, 0)) == 0) + TEST_PAGE_SIZE, 0, 0)) == 0) { diag("Got error: init_pagecache() (errno: %d)\n", errno); diff --git a/storage/maria/unittest/ma_pagecache_rwconsist2.c b/storage/maria/unittest/ma_pagecache_rwconsist2.c index 917fddd0bcf..751c045a879 100644 --- a/storage/maria/unittest/ma_pagecache_rwconsist2.c +++ b/storage/maria/unittest/ma_pagecache_rwconsist2.c @@ -297,7 +297,7 @@ int main(int argc __attribute__((unused)), #endif if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TEST_PAGE_SIZE, 0)) == 0) + TEST_PAGE_SIZE, 0, 0)) == 0) { diag("Got error: init_pagecache() (errno: %d)\n", errno); diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c index 0031582589e..64f6782f20f 100644 --- a/storage/maria/unittest/ma_pagecache_single.c +++ b/storage/maria/unittest/ma_pagecache_single.c @@ -828,7 +828,7 @@ int main(int argc __attribute__((unused)), #endif if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TEST_PAGE_SIZE, MYF(MY_WME))) == 0) + TEST_PAGE_SIZE, 0, MYF(MY_WME))) == 0) { fprintf(stderr,"Got error: init_pagecache() (errno: %d)\n", errno); diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c index abf2078ce8f..18650fa400d 100644 --- a/storage/maria/unittest/ma_test_loghandler-t.c +++ b/storage/maria/unittest/ma_test_loghandler-t.c @@ -147,7 +147,6 @@ int main(int argc __attribute__((unused)), char *argv[]) { uint32 i; uint32 rec_len; - uint pagen; uchar long_tr_id[6]; uchar lsn_buff[23]= { @@ -203,8 +202,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + TRANSLOG_PAGE_SIZE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c index 9ebd56c754c..cf86b59da45 100644 --- a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c +++ b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c @@ -35,7 +35,6 @@ static const char *default_dbug_option; int main(int argc __attribute__((unused)), char *argv[]) { - uint pagen; uchar long_tr_id[6]; PAGECACHE pagecache; LSN lsn, first_lsn, theor_lsn; @@ -72,8 +71,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + PCACHE_PAGE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c index 4ae9def8598..855135451c3 100644 --- a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c +++ b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c @@ -36,7 +36,6 @@ static const char *default_dbug_option; int main(int argc __attribute__((unused)), char *argv[]) { ulong i; - uint pagen; uchar long_tr_id[6]; PAGECACHE pagecache; LSN lsn, max_lsn, last_lsn= LSN_IMPOSSIBLE; @@ -70,8 +69,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + PCACHE_PAGE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c index c8e63cb26ab..63d1f1c6977 100644 --- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c +++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c @@ -226,7 +226,6 @@ int main(int argc __attribute__((unused)), char *argv[]) { uint32 i; uint32 rec_len; - uint pagen; uchar long_tr_id[6]; uchar lsn_buff[23]= { @@ -284,8 +283,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + TRANSLOG_PAGE_SIZE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); @@ -447,8 +446,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "pass2: Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + TRANSLOG_PAGE_SIZE, 0, 0) == 0) { fprintf(stderr, "pass2: Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c index 18fbaeace5a..535f363048b 100644 --- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c +++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c @@ -261,7 +261,6 @@ int main(int argc __attribute__((unused)), char **argv __attribute__ ((unused))) { uint32 i; - uint pagen; PAGECACHE pagecache; LSN first_lsn; TRANSLOG_HEADER_BUFFER rec; @@ -341,8 +340,8 @@ int main(int argc __attribute__((unused)), fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - TRANSLOG_PAGE_SIZE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + TRANSLOG_PAGE_SIZE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_noflush-t.c b/storage/maria/unittest/ma_test_loghandler_noflush-t.c index c8c0f7d1873..8d0af947574 100644 --- a/storage/maria/unittest/ma_test_loghandler_noflush-t.c +++ b/storage/maria/unittest/ma_test_loghandler_noflush-t.c @@ -34,7 +34,6 @@ static const char *default_dbug_option; int main(int argc __attribute__((unused)), char *argv[]) { - uint pagen; int rc= 1; uchar long_tr_id[6]; PAGECACHE pagecache; @@ -71,8 +70,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + PCACHE_PAGE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c index 24c93e428e1..5d6db7355c2 100644 --- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c +++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c @@ -36,7 +36,6 @@ static const char *default_dbug_option; int main(int argc __attribute__((unused)), char *argv[]) { ulong i; - uint pagen; uchar long_tr_id[6]; PAGECACHE pagecache; LSN lsn; @@ -72,8 +71,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + PCACHE_PAGE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); @@ -145,8 +144,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + PCACHE_PAGE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c index a939cef71a7..e634506628a 100644 --- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c +++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c @@ -64,7 +64,6 @@ dummy_fail_callback(uchar* data_ptr __attribute__((unused))) int main(int argc __attribute__((unused)), char *argv[]) { - uint pagen; uchar long_tr_id[6]; PAGECACHE pagecache; LSN lsn; @@ -99,8 +98,8 @@ int main(int argc __attribute__((unused)), char *argv[]) fprintf(stderr, "Can't init control file (%d)\n", errno); exit(1); } - if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + if (init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, + PCACHE_PAGE, 0, 0) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); diff --git a/storage/maria/unittest/ma_test_loghandler_purge-t.c b/storage/maria/unittest/ma_test_loghandler_purge-t.c index 6ae0e7830ae..a13645f1bb8 100644 --- a/storage/maria/unittest/ma_test_loghandler_purge-t.c +++ b/storage/maria/unittest/ma_test_loghandler_purge-t.c @@ -73,7 +73,7 @@ int main(int argc __attribute__((unused)), char *argv[]) exit(1); } if ((pagen= init_pagecache(&pagecache, PCACHE_SIZE, 0, 0, - PCACHE_PAGE, 0)) == 0) + PCACHE_PAGE, 0, 0)) == 0) { fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); exit(1); |