Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2, 11.3(EOL), 11.4
Description
In an InnoDB record cursor, there is a counter row_prebuilt_t::n_rows_fetched that counts records that have been fetched in a key range scan. The main purpose of this counter is to control whether to trigger a prefetch of a cache that is slated for removal in MDEV-16232.
On 64-bit systems, this counter cannot overflow. If we overestimate that InnoDB could read 10¹² or 2⁴⁰ records per second in a range scan, it would take more than half a year of such a range scan before the counter would wrap around. An even more rigid limitation would be that InnoDB only supports 2³² pages per tablespace, and you could fit at most a few thousand or 2¹² records per page, that is, there can't be more than some 2⁴⁴ records per index.
I would propose to revise an overflow check as follows, disabling it on 64-bit systems:
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
|
index 4504fabd4e0..b217f6d20fe 100644
|
--- a/storage/innobase/row/row0sel.cc
|
+++ b/storage/innobase/row/row0sel.cc
|
@@ -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;
|
}
|
|
Attachments
Issue Links
- relates to
-
MDEV-16232 Use fewer mini-transactions
- Stalled