mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-32050: Do not copy undo records in purge
Also, default to innodb_purge_batch_size=1000,
replacing the old default value of processing 300 undo log pages
in a batch. Axel Schwenke found this value to help reduce purge lag
without having a significant impact on workload throughput.
In purge, we can simply acquire a shared latch on the undo log page
(to avoid a race condition like the one that was fixed in
commit b102872ad5
) and retain a buffer-fix
after releasing the latch. The buffer-fix will prevent the undo log
page from being evicted from the buffer pool. Concurrent modification
is prevented by design. Only the purge_coordinator_task
(or its accomplice purge_truncation_task) may free the undo log pages,
after any purge_worker_task have completed execution. Hence, we do not
have to worry about any overwriting or reuse of the undo log records.
trx_undo_rec_copy(): Remove. The only remaining caller would have been
trx_undo_get_undo_rec_low(), which is where the logic was merged.
purge_sys_t::m_initialized: Replaces heap.
purge_sys_t::pages: A cache of buffer-fixed pages that have been
looked up from buf_pool.page_hash.
purge_sys_t::get_page(): Return a buffer-fixed undo page, using the
pages cache.
trx_purge_t::batch_cleanup(): Renamed from clone_end_view().
Clear the pages cache and clone the end_view at the end of a batch.
purge_sys_t::n_pages_handled(): Return pages.size(). This determines
if innodb_purge_batch_size was exceeded.
purge_sys_t::rseg_get_next_history_log(): Replaces
trx_purge_rseg_get_next_history_log().
purge_sys_t::choose_next_log(): Replaces trx_purge_choose_next_log()
and trx_purge_read_undo_rec().
purge_sys_t::get_next_rec(): Replaces trx_purge_get_next_rec()
and trx_undo_get_next_rec().
purge_sys_t::fetch_next_rec(): Replaces trx_purge_fetch_next_rec()
and some use of trx_undo_get_first_rec().
trx_purge_attach_undo_recs(): Do not allow purge_sys.n_pages_handled()
exceed the innodb_purge_batch_size or ¾ of the buffer pool, whichever
is smaller.
Reviewed by: Vladislav Lesin
Tested by: Matthias Leich and Axel Schwenke
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
SET @global_start_value = @@global.innodb_purge_batch_size;
|
||||
SELECT @global_start_value;
|
||||
@global_start_value
|
||||
300
|
||||
1000
|
||||
'#--------------------FN_DYNVARS_046_01------------------------#'
|
||||
SET @@global.innodb_purge_batch_size = 1;
|
||||
SET @@global.innodb_purge_batch_size = DEFAULT;
|
||||
SELECT @@global.innodb_purge_batch_size;
|
||||
@@global.innodb_purge_batch_size
|
||||
300
|
||||
1000
|
||||
'#---------------------FN_DYNVARS_046_02-------------------------#'
|
||||
SET innodb_purge_batch_size = 1;
|
||||
ERROR HY000: Variable 'innodb_purge_batch_size' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SELECT @@innodb_purge_batch_size;
|
||||
@@innodb_purge_batch_size
|
||||
300
|
||||
1000
|
||||
SELECT local.innodb_purge_batch_size;
|
||||
ERROR 42S02: Unknown table 'local' in field list
|
||||
SET global innodb_purge_batch_size = 1;
|
||||
@@ -112,4 +112,4 @@ SELECT @@global.innodb_purge_batch_size;
|
||||
SET @@global.innodb_purge_batch_size = @global_start_value;
|
||||
SELECT @@global.innodb_purge_batch_size;
|
||||
@@global.innodb_purge_batch_size
|
||||
300
|
||||
1000
|
||||
|
@@ -307,7 +307,7 @@
|
||||
NUMERIC_MAX_VALUE 65536
|
||||
@@ -1345,7 +1345,7 @@
|
||||
SESSION_VALUE NULL
|
||||
DEFAULT_VALUE 300
|
||||
DEFAULT_VALUE 1000
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
-VARIABLE_TYPE BIGINT UNSIGNED
|
||||
+VARIABLE_TYPE INT UNSIGNED
|
||||
|
@@ -1293,7 +1293,7 @@ READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME INNODB_PURGE_BATCH_SIZE
|
||||
SESSION_VALUE NULL
|
||||
DEFAULT_VALUE 300
|
||||
DEFAULT_VALUE 1000
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
|
||||
|
Reference in New Issue
Block a user