summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result7
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test10
-rw-r--r--storage/innodb_plugin/ChangeLog8
-rw-r--r--storage/innodb_plugin/buf/buf0buf.c11
-rw-r--r--storage/innodb_plugin/handler/ha_innodb.cc61
5 files changed, 94 insertions, 3 deletions
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result
new file mode 100644
index 00000000000..459ad95bdc6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result
@@ -0,0 +1,7 @@
+SELECT @@global.innodb_buffer_pool_evict;
+@@global.innodb_buffer_pool_evict
+
+SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
+SELECT @@global.innodb_buffer_pool_evict;
+@@global.innodb_buffer_pool_evict
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
new file mode 100644
index 00000000000..2350d55c57b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
@@ -0,0 +1,10 @@
+-- source include/have_innodb_plugin.inc
+# This is a debug variable for now
+-- source include/have_debug.inc
+
+SELECT @@global.innodb_buffer_pool_evict;
+
+SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
+
+# Should always be empty.
+SELECT @@global.innodb_buffer_pool_evict;
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),