Last commit made on 2022-06-22
Get this branch:
git clone -b 10.6-MDEV-28800

Branch merges

Branch information


Recent commits

74a6f15... by Marko Mäkelä

MDEV-28800 WIP: Avoid crashes on memory allocation failure

FIXME: heap-use-after-free in ./mtr --suite=innodb_gis
and failures of

FIXME: Allocate locks upfront for page reorganize or split,
so that the operation can gracefully fail before any irreversible
persistent changes are performed.

FIXME: Remove buf_pool_t::running_out(), or defer the invocation
to when actually attempting to allocate lock objects.

0fa19fd... by Marko Mäkelä

MDEV-28836 fixup

On GNU/Linux, even though the C11 aligned_alloc() appeared in
GNU libc early on, some custom memory allocators did not
implement it until recently. For example, before
the free() in tcmalloc would fail to free memory that was
returned by aligned_alloc(), because the latter would map to the
built-in allocator of libc. The Linux specific memalign() has a
similar interface and is safer to use, because it has been
available for a longer time. For AddressSanitizer, we will use
aligned_alloc() so that the constraint on size can be enforced.

buf_tmp_reserve_compression_buf(): When HAVE_ALIGNED_ALLOC holds,
round up the size to be an integer multiple of the alignment.

pfs_malloc(): In the unit test stub, round up the size to be an
integer multiple of the alignment.

3794673... by Marko Mäkelä

MDEV-28836: Memory alignment cleanup

Table_cache_instance: Define the structure aligned at
the CPU cache line, and remove a pad[] data member.
Krunal Bauskar reported this to improve performance on ARMv8.

aligned_malloc(): Wrapper for the Microsoft _aligned_malloc()
and the ISO/IEC 9899:2011 <stdlib.h> aligned_alloc().
Note: The parameters are in the Microsoft order (size, alignment),
opposite of aligned_alloc(alignment, size).
Note: The standard defines that size must be an integer multiple
of alignment. It is enforced by AddressSanitizer but not by GNU libc
on Linux.

aligned_free(): Wrapper for the Microsoft _aligned_free() and
the standard free().

HAVE_ALIGNED_ALLOC: A new test. Unfortunately, support for
aligned_alloc() may still be missing on some platforms.
We will fall back to posix_memalign() for those cases.

HAVE_MEMALIGN: Remove, along with any use of the nonstandard memalign().


PFS_ALIGNED: Defined using the C++11 keyword alignas.

lock_sys_t::hash_table::resize(): Pad the allocation size to an
integer multiple of the alignment.

Reviewed by: Vladislav Vaintroub

2e43af6... by Marko Mäkelä


There was a race condition between log_checkpoint_low() and
deleting or renaming data files. The scenario is as follows:

1. The buffer pool does not contain dirty pages.
2. A FILE_DELETE or FILE_RENAME record is written.
3. The checkpoint LSN will be moved ahead of the write of the record.
4. The server is killed before the file is actually renamed or deleted.

We will prevent this race condition by ensuring that a log checkpoint
cannot occur between the durable write and the file system operation:

1. Durably write the FILE_DELETE or FILE_RENAME record.
2. Perform the file system operation.
3. Allow any log checkpoint to proceed.

mtr_t::commit_file(): Implement the DELETE or RENAME logic.

fil_delete_tablespace(): Delegate some of the logic to

fil_space_t::rename(): Delegate some logic to mtr_t::commit_file().
Remove the debug injection point fil_rename_tablespace_failure_2
because we do test RENAME failures without any debug injection.

fil_name_write_rename_low(), fil_name_write_rename(): Remove.

Tested by Matthias Leich

55f02c2... by Marko Mäkelä

MDEV-28845 fixup: Prevent an infinite loop

buf_page_create_low(): Before retrying, release the exclusive page latch
in order to prevent an infinite loop in buf_pool_t::corrupted_evict().

3b662c6... by Marko Mäkelä

MDEV-28782 fixup: ./mtr --embedded

0e4cf49... by Daniel Black

MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode

Work around MDEV-28718 for now, but also optimize the interation
of information_schema.SYSTEM_VARIABLES.

Add test case to show that tzinfo data into bootstrap is
desired functionality.

Bug report thanks to Dan Lenski of AWS.

5bb90cb... by Marko Mäkelä

Merge 10.5 into 10.6

e99ba4a... by Marko Mäkelä

MDEV-28864 Assertion `trx_id <= create_id' failed in innodb_check_version()

ha_innobase::prepare_inplace_alter_table(): If the ALTER TABLE
operation is no-op for InnoDB, do reset m_prebuilt->trx_id
so that ha_innobase::table_version() will always report either 0
or the identifier of the transaction that would commit changes
to the InnoDB data dictionary.

The failure scenario involved a completed DROP INDEX followed by
a no-op ALTER TABLE during which the server was killed.
An effort to create a reproducible test failed.

253806d... by Marko Mäkelä

MDEV-28845 InnoDB: Failing assertion: bpage->can_relocate() in

Since commit 0b47c126e31cddda1e94588799599e138400bcf8 (MDEV-13542)
we treat all-zero pages as corrupted ones.

During a stress test, a read-ahead of an all-zero page was triggered
and the page read was completed concurrently with buf_page_create_low().
This caused the assertion to fail, because buf_page_create_low() was
waiting for the page latch.

buf_page_get_low(): Only invoke buf_pool_t::corrupted_evict()
if the block was not already marked as corrupted.

buf_page_create_low(): On page identifier mismatch, retry the
buf_pool.page_hash lookup.

buf_pool_t::corrupted_evict(): Set the state of the block to FREED
so that a concurrent buf_page_get_low() will refuse to load the page.
Wait for the page latch to be vacant before proceeding to remove
the block from buf_pool.page_hash and buf_pool.LRU.

page_id_t::set_corrupted(), page_id_t::is_corrupted(): Accessors
for indicating a corrupted page identifier.

Tested by Matthias Leich