Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-16952 Introduce SET GLOBAL innodb_max_purge_lag_wait
Let us introduce a dummy variable innodb_max_purge_lag_wait for waiting that the InnoDB history list length is below the user-specified limit. Specifically, SET GLOBAL innodb_max_purge_lag_wait=0; should wait for all history to be purged. This could be useful when upgrading from an older version to MariaDB 10.3 or later, to avoid hitting MDEV-15912. Note: the history cannot be purged if there exist transactions that may see old versions. Reviewed by: Vladislav Vaintroub
- Loading branch information
Showing
3 changed files
with
47 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
# Wait for everything to be purged. | ||
# The user should have set innodb_purge_rseg_truncate_frequency=1. | ||
|
||
--disable_query_log | ||
if (!$wait_all_purged) | ||
{ | ||
let $wait_all_purged= 0; | ||
SET GLOBAL innodb_max_purge_lag_wait= 0; | ||
} | ||
let $remaining_expect= `select concat('InnoDB ',$wait_all_purged)`; | ||
|
||
let $wait_counter= 600; | ||
while ($wait_counter) | ||
if ($wait_all_purged) | ||
{ | ||
--replace_regex /.*History list length ([0-9]+).*/\1/ | ||
let $remaining= `SHOW ENGINE INNODB STATUS`; | ||
if ($remaining == $remaining_expect) | ||
{ | ||
let $wait_counter= 0; | ||
} | ||
if ($wait_counter) | ||
{ | ||
real_sleep 0.1; | ||
dec $wait_counter; | ||
} | ||
eval SET GLOBAL innodb_max_purge_lag_wait= $wait_all_purged; | ||
} | ||
--enable_query_log | ||
|
||
--replace_regex /.*History list length ([0-9]+).*/\1/ | ||
let $remaining= `SHOW ENGINE INNODB STATUS`; | ||
echo $remaining transactions not purged; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters