diff options
author | Marko Mäkelä <marko.makela@oracle.com> | 2013-01-21 14:59:49 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@oracle.com> | 2013-01-21 14:59:49 +0200 |
commit | e7283ceaf034072dcd9ad01b2377ee2101eb1b4d (patch) | |
tree | 64a6dedfcb6b9179e08e6487f992b96dc4d6c12f /storage | |
parent | bc21e8cd6946e77ed0c594113d5b47949c89659b (diff) | |
download | mariadb-git-e7283ceaf034072dcd9ad01b2377ee2101eb1b4d.tar.gz |
Bug#16067973 DROP TABLE SLOW WHEN IT DECOMPRESS COMPRESSED-ONLY PAGES
buf_page_get_gen(): Do not attempt to decompress a compressed-only
page when mode == BUF_PEEK_IF_IN_POOL. This mode is only being used by
btr_search_drop_page_hash_when_freed(). There cannot be any adaptive
hash index pointing to a page that does not exist in uncompressed
format in the buffer pool.
innodb_buffer_pool_evict_update(): New function for debug builds, to handle
SET GLOBAL innodb_buffer_pool_evicted='uncompressed'
by evicting all uncompressed page frames of compressed tablespaces
from the buffer pool.
rb#1873 approved by Jimmy Yang
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innodb_plugin/ChangeLog | 8 | ||||
-rw-r--r-- | storage/innodb_plugin/buf/buf0buf.c | 11 | ||||
-rw-r--r-- | storage/innodb_plugin/handler/ha_innodb.cc | 61 |
3 files changed, 77 insertions, 3 deletions
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 6a389f618af..d1953ec6d61 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,9 @@ +2013-01-21 The InnoDB Team + + * buf/buf0buf.cc, handler/ha_innodb.cc: + Fix Bug#16067973 DROP TABLE IS SLOW WHEN IT DECOMPRESSES + COMPRESSED-ONLY PAGES + 2013-01-11 The InnoDB Team * row/row0sel.c: Fix Bug#16088883 KILLING A QUERY INSIDE INNODB CAUSES IT TO @@ -6,7 +12,7 @@ 2012-12-18 The InnoDB Team * include/univ.i: - Fix Bug#Bug#13463493 INNODB PLUGIN WERE CHANGED, BUT STILL USE THE + Fix Bug#13463493 INNODB PLUGIN WERE CHANGED, BUT STILL USE THE SAME VERSION NUMBER 1.0.17 2012-12-13 The InnoDB Team diff --git a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c index e7e60fb2b2a..504718f6e08 100644 --- a/storage/innodb_plugin/buf/buf0buf.c +++ b/storage/innodb_plugin/buf/buf0buf.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -1664,6 +1664,7 @@ loop2: if (must_read && (mode == BUF_GET_IF_IN_POOL || mode == BUF_PEEK_IF_IN_POOL)) { /* The page is only being read to buffer */ +null_exit: buf_pool_mutex_exit(); return(NULL); @@ -1678,6 +1679,14 @@ loop2: case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_DIRTY: + if (mode == BUF_PEEK_IF_IN_POOL) { + /* This mode is only used for dropping an + adaptive hash index. There cannot be an + adaptive hash index for a compressed-only + page, so do not bother decompressing the page. */ + goto null_exit; + } + bpage = &block->page; /* Protect bpage->buf_fix_count. */ mutex_enter(&buf_pool_zip_mutex); diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 51068d26eff..229e7fe71e5 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2013, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. @@ -10926,6 +10926,55 @@ innodb_change_buffering_update( *static_cast<const char*const*>(save); } +#ifndef DBUG_OFF +static char* srv_buffer_pool_evict; + +/****************************************************************//** +Called on SET GLOBAL innodb_buffer_pool_evict=... +Handles some values specially, to evict pages from the buffer pool. +SET GLOBAL innodb_buffer_pool_evict='uncompressed' +evicts all uncompressed page frames of compressed tablespaces. */ +static +void +innodb_buffer_pool_evict_update( +/*============================*/ + THD* thd, /*!< in: thread handle */ + struct st_mysql_sys_var*var, /*!< in: pointer to system variable */ + void* var_ptr,/*!< out: ignored */ + const void* save) /*!< in: immediate result + from check function */ +{ + if (const char* op = *static_cast<const char*const*>(save)) { + if (!strcmp(op, "uncompressed")) { + /* Evict all uncompressed pages of compressed + tables from the buffer pool. Keep the compressed + pages in the buffer pool. */ + + buf_pool_mutex_enter(); + + for (buf_block_t* block = UT_LIST_GET_LAST( + buf_pool->unzip_LRU); + block != NULL; ) { + + buf_block_t* prev_block + = UT_LIST_GET_PREV(unzip_LRU, block); + ut_ad(buf_block_get_state(block) + == BUF_BLOCK_FILE_PAGE); + ut_ad(block->in_unzip_LRU_list); + ut_ad(block->page.in_LRU_list); + + mutex_enter(&block->mutex); + buf_LRU_free_block(&block->page, FALSE); + mutex_exit(&block->mutex); + block = prev_block; + } + + buf_pool_mutex_exit(); + } + } +} +#endif /* !DBUG_OFF */ + static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff) { innodb_export_status(); @@ -11128,6 +11177,13 @@ static MYSQL_SYSVAR_ULONG(autoextend_increment, srv_auto_extend_increment, "Data file autoextend increment in megabytes", NULL, NULL, 8L, 1L, 1000L, 0); +#ifndef DBUG_OFF +static MYSQL_SYSVAR_STR(buffer_pool_evict, srv_buffer_pool_evict, + PLUGIN_VAR_RQCMDARG, + "Evict pages from the InnoDB buffer pool.", + NULL, innodb_buffer_pool_evict_update, ""); +#endif /* !DBUG_OFF */ + static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", @@ -11300,6 +11356,9 @@ static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug, static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), +#ifndef DBUG_OFF + MYSQL_SYSVAR(buffer_pool_evict), +#endif /* !DBUG_OFF */ MYSQL_SYSVAR(buffer_pool_size), MYSQL_SYSVAR(checksums), MYSQL_SYSVAR(commit_concurrency), |