Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mysql-test/suite/innodb/r/innodb_buffer_pool_shrink.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
call mtr.add_suppression("innodb_buffer_pool_size change aborted");
CREATE TABLE t (c INT) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 512;
BEGIN;
SELECT * FROM t LOCK IN SHARE MODE;
c
SET @save_size = @@GLOBAL.innodb_buffer_pool_size;
SET GLOBAL innodb_buffer_pool_size=6291456;
COMMIT;
SET GLOBAL innodb_buffer_pool_size=6291456;
SET GLOBAL innodb_buffer_pool_size = @save_size;
DROP TABLE t;
14 changes: 14 additions & 0 deletions mysql-test/suite/innodb/t/innodb_buffer_pool_shrink.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--source include/have_innodb.inc
--source include/have_partition.inc
call mtr.add_suppression("innodb_buffer_pool_size change aborted");
CREATE TABLE t (c INT) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 512;
BEGIN;
SELECT * FROM t LOCK IN SHARE MODE;
SET @save_size = @@GLOBAL.innodb_buffer_pool_size;
--error 0,ER_WRONG_USAGE
SET GLOBAL innodb_buffer_pool_size=6291456;
COMMIT;
--error 0,ER_WRONG_USAGE
SET GLOBAL innodb_buffer_pool_size=6291456;
SET GLOBAL innodb_buffer_pool_size = @save_size;
DROP TABLE t;
6 changes: 6 additions & 0 deletions storage/innobase/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,12 @@ ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size)
goto next;
}

if (block)
buf_LRU_block_free_non_file_page(block);

if (!UT_LIST_GET_LEN(LRU) && n_blocks_to_withdraw)
return SHRINK_ABORT;

if (UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < usable_size() / 20)
return SHRINK_ABORT;

Expand Down