Skip to content

Commit

Permalink
MDEV-24609: innodb_io_capacity can exceed innodb_io_capacity_max
Browse files Browse the repository at this point in the history
innodb_io_capacity_update(): When the requested innodb_io_capacity
exceeds innodb_io_capacity_max and is more than half the maximum,
do not double it for computing innodb_io_capacity_max.

This integer arithmetics overflow was introduced in
commit 0f32299 (MDEV-7035).

No test case is added, because sizeof(ulong) varies between platforms.
  • Loading branch information
dr-m committed Jan 19, 2021
1 parent 959dfac commit 48ac7e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storage/innobase/handler/ha_innodb.cc
Expand Up @@ -17532,7 +17532,8 @@ innodb_io_capacity_update(
" higher than innodb_io_capacity_max %lu",
in_val, srv_max_io_capacity);

srv_max_io_capacity = in_val * 2;
srv_max_io_capacity = (in_val & ~(~0UL >> 1))
? in_val : in_val * 2;

push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
Expand Down

0 comments on commit 48ac7e1

Please sign in to comment.