MDEV-34167 We fail to terminate transaction early with ER_LOCK_TABLE_… #3263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This regression is introduced in 10.6 by following commit. commit b6a2472
MDEV-27891: SIGSEGV in InnoDB buffer pool resize
During DML, we check if buffer pool is running out of data pages in buf_pool_t::running_out. Here, if 75% of the buffer pool is occupied by non-data pages, we rollback the current transaction and exit with ER_LOCK_TABLE_FULL.
The integer division (n_chunks_new / 4) becomes zero whenever the total number of chunks are < 4 making the check completely ineffective for such cases. Also the check is inaccurate for larger chunks.
Fix-1: Correct the check in buf_pool_t::running_out.
Fix-2: While waiting for free page, check for
buf_LRU_check_size_of_non_data_objects.
Release Notes
When system is reaching out of memory in BP due to too many locks, it allows DMLs to exit before reaching the critical stage of server exit.
How can this PR be tested?
The test case from MDEV-34166 which is being fixed in 10.5 would also test this patch once merged. So. we would have the automated test running soon. Till that time it is difficult to add an automated test as it requires large BP and records in the order of millions to validate it.
In MDEV, I have updated the way it can be tested manually.
Basing the PR against the correct MariaDB version
PR quality check