Skip to content

Commit

Permalink
MDEV-33251 Redundant check on prebuilt::n_rows_fetched overflow
Browse files Browse the repository at this point in the history
row_search_mvcc(): Revise an overflow check, disabling it on 64-bit
systems. The maximum number of consecutive record reads in a key range
scan should be limited by the maximum number of records per page
(less than 2^13) and the maximum number of pages per tablespace (2^32)
to less than 2^45. On 32-bit systems we can simplify the overflow check.

Reviewed by: Vladislav Lesin
  • Loading branch information
dr-m committed Jan 30, 2024
1 parent 57ffcd6 commit bc28495
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions storage/innobase/row/row0sel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4406,13 +4406,11 @@ row_search_mvcc(
goto func_exit;
}

#if SIZEOF_SIZE_T < 8
if (UNIV_LIKELY(~prebuilt->n_rows_fetched))
#endif
prebuilt->n_rows_fetched++;

if (prebuilt->n_rows_fetched > 1000000000) {
/* Prevent wrap-over */
prebuilt->n_rows_fetched = 500000000;
}

mode = pcur->search_mode;
}

Expand Down

0 comments on commit bc28495

Please sign in to comment.