TODO-4509: Attempt to improve performance for many partitions
In most cases, ha_partition forwards calls to all locked_partitions. It
doesn't make sense to forward some calls for partitions that were pruned
away.
This patch introduces ha_partition::loop_read_partitions and makes these
calls use it:
This change was triggered to help some MariaDB users with close to
10000 bits in their bitmaps.
- Change underlaying storage to be 64bit instead of 32bit.
- This reduses number of loops to scan bitmaps.
- This can cause some bitmaps to be 4 byte large.
- Ensure that all not used top-bits are always 0 (simplifes code as
the last 64bit storage not anymore a special case).
- Use my_find_first_bit() to find the first set bit which is much faster
than scanning trough things byte by byte and then bit by bit.
Other things:
- Added a bool to remember if my_bitmap_init() did allocate the bitmap
array. my_bitmap_free() will only free arrays it did allocate.
This allowed me to remove setting 'bitmap=0' before calling
my_bitmap_free() for cases where the bitmap's where allocated externally.
- Added 'universal' asserts to most bitmap functions.
- Change all remaining calls to bitmap_init() to my_bitmap_init().
- To finish the change from 2014.
- Changed all usage of uint32 when assking bitmap->bitmap to my_bitmap_map.
- Added bitmap_copy_data() for safe copy of external bitmap to my_bitmap.
- Removed const from bitmap_exists_intersection() as this caused casts
on all usage.
- Extended bitmap-t with test for more bitmap functions.
MDEV-33464 Crash when innodb_max_undo_log_size is set to innodb_page_size*4294967296
purge_sys_t::truncating_tablespace(): Clamp the
innodb_max_undo_log_size to the maximum number of pages
before converting the result into a 32-bit unsigned integer.
This fixes up commit f8c88d905b44bffe161158309e9acc25ad3691aa (MDEV-33213).
In later major versions, we would use 32-bit unsigned integer here
due to commit ca501ffb04246dcaa1f1d433d916d8436e30602e
and the code would crash also on 64-bit processors.
MDEV-33332 SIGSEGV in buf_read_ahead_linear() when bpage is in buf_pool.watch
buf_read_ahead_linear(): If buf_pool.watch_is_sentinel(*bpage),
do not attempt to read the page frame because the pointer would be null
for the elements of buf_pool.watch[].
Hitting this bug requires the use of a non-default value of
innodb_change_buffering.