From 549e7644313ae0ac7f19083b4ec5a200d853184a Mon Sep 17 00:00:00 2001 From: vasil <> Date: Wed, 9 Sep 2009 12:35:58 +0000 Subject: [PATCH] branches/zip: Fix a bug in manipulating the variable innodb_old_blocks_pct: for any value assigned it got that value -1, except for 75. When assigned 75, it got 75. mysql> set global innodb_old_blocks_pct=15; Query OK, 0 rows affected (0.00 sec) mysql> show variables like 'innodb_old_blocks_pct'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | innodb_old_blocks_pct | 14 | +-----------------------+-------+ 1 row in set (0.00 sec) mysql> set global innodb_old_blocks_pct=75; Query OK, 0 rows affected (0.00 sec) mysql> show variables like 'innodb_old_blocks_pct'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | innodb_old_blocks_pct | 75 | +-----------------------+-------+ After the fix it gets exactly what was assigned. Approved by: Marko (via IM) --- buf/buf0lru.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buf/buf0lru.c b/buf/buf0lru.c index e7cf852e200..dd632ace4ac 100644 --- a/buf/buf0lru.c +++ b/buf/buf0lru.c @@ -1866,7 +1866,9 @@ buf_LRU_old_ratio_update( buf_LRU_old_ratio = ratio; } - return(ratio * 100 / BUF_LRU_OLD_RATIO_DIV); + /* the reverse of + ratio = old_pct * BUF_LRU_OLD_RATIO_DIV / 100 */ + return((uint) (ratio * 100 / (double) BUF_LRU_OLD_RATIO_DIV + 0.5)); } /********************************************************************//**