Commit 88f38661 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.4 into 10.5

parents 7e2b4232 d5bd704f
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
SET GLOBAL innodb_undo_log_truncate = 0; SET GLOBAL innodb_undo_log_truncate = 0;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @trunc_start=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_undo_truncations');
create table t1(keyc int primary key, c char(100)) engine = innodb; create table t1(keyc int primary key, c char(100)) engine = innodb;
create table t2(keyc int primary key, c char(100)) engine = innodb; create table t2(keyc int primary key, c char(100)) engine = innodb;
connect con1,localhost,root,,; connect con1,localhost,root,,;
...@@ -33,7 +28,6 @@ connection con2; ...@@ -33,7 +28,6 @@ connection con2;
commit; commit;
disconnect con2; disconnect con2;
connection default; connection default;
set global innodb_fast_shutdown=0;
# restart
drop table t1, t2; drop table t1, t2;
InnoDB 0 transactions not purged
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
SET GLOBAL innodb_undo_log_truncate = @save_truncate;
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/innodb_page_size.inc --source include/innodb_page_size.inc
--source include/have_undo_tablespaces.inc --source include/have_undo_tablespaces.inc
--source include/not_embedded.inc
--source include/have_sequence.inc --source include/have_sequence.inc
--disable_query_log --disable_query_log
call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool"); call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool");
--enable_query_log --enable_query_log
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
SET GLOBAL innodb_undo_log_truncate = 0; SET GLOBAL innodb_undo_log_truncate = 0;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @trunc_start=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_undo_truncations');
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
# Perform DML action using multiple clients and multiple undo tablespace. # Perform DML action using multiple clients and multiple undo tablespace.
...@@ -46,9 +41,20 @@ commit; disconnect con1; ...@@ -46,9 +41,20 @@ commit; disconnect con1;
connection con2; commit; disconnect con2; connection con2; commit; disconnect con2;
connection default; connection default;
drop table t1, t2;
--source include/wait_all_purged.inc --replace_regex /.*Trx id counter ([0-9]+).*/\1/
let $trx_before= `SHOW ENGINE INNODB STATUS`;
let $trx_before= `select substr('$trx_before',9)+2`;
set global innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
--replace_regex /.*Trx id counter ([0-9]+).*/\1/
let $trx_after= `SHOW ENGINE INNODB STATUS`;
let $trx_after= `select substr('$trx_after',9)`;
drop table t1, t2;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; if ($trx_before != $trx_after)
SET GLOBAL innodb_undo_log_truncate = @save_truncate; {
echo Transaction sequence mismatch: $trx_before != $trx_after;
}
...@@ -54,6 +54,7 @@ trx_rsegf_get_new( ...@@ -54,6 +54,7 @@ trx_rsegf_get_new(
/** Create a rollback segment header. /** Create a rollback segment header.
@param[in,out] space system, undo, or temporary tablespace @param[in,out] space system, undo, or temporary tablespace
@param[in] rseg_id rollback segment identifier @param[in] rseg_id rollback segment identifier
@param[in] max_trx_id new value of TRX_RSEG_MAX_TRX_ID
@param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg) @param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg)
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return the created rollback segment @return the created rollback segment
...@@ -62,6 +63,7 @@ buf_block_t* ...@@ -62,6 +63,7 @@ buf_block_t*
trx_rseg_header_create( trx_rseg_header_create(
fil_space_t* space, fil_space_t* space,
ulint rseg_id, ulint rseg_id,
trx_id_t max_trx_id,
buf_block_t* sys_header, buf_block_t* sys_header,
mtr_t* mtr); mtr_t* mtr);
......
...@@ -1948,7 +1948,9 @@ static uint32_t srv_do_purge(ulint* n_total_purged) ...@@ -1948,7 +1948,9 @@ static uint32_t srv_do_purge(ulint* n_total_purged)
n_pages_purged = trx_purge( n_pages_purged = trx_purge(
n_use_threads, n_use_threads,
!(++count % srv_purge_rseg_truncate_frequency) !(++count % srv_purge_rseg_truncate_frequency)
|| purge_sys.truncate.current); || purge_sys.truncate.current
|| (srv_shutdown_state != SRV_SHUTDOWN_NONE
&& srv_fast_shutdown == 0));
*n_total_purged += n_pages_purged; *n_total_purged += n_pages_purged;
} while (n_pages_purged > 0 && !purge_sys.paused() } while (n_pages_purged > 0 && !purge_sys.paused()
......
...@@ -749,7 +749,9 @@ static void trx_purge_truncate_history() ...@@ -749,7 +749,9 @@ static void trx_purge_truncate_history()
ut_ad(rseg->is_persistent()); ut_ad(rseg->is_persistent());
ut_d(const auto old_page= rseg->page_no); ut_d(const auto old_page= rseg->page_no);
buf_block_t *rblock= trx_rseg_header_create(&space, i, sys_header, &mtr); buf_block_t *rblock= trx_rseg_header_create(&space, i,
trx_sys.get_max_trx_id(),
sys_header, &mtr);
ut_ad(rblock); ut_ad(rblock);
rseg->page_no= rblock ? rblock->page.id().page_no() : FIL_NULL; rseg->page_no= rblock ? rblock->page.id().page_no() : FIL_NULL;
ut_ad(old_page == rseg->page_no); ut_ad(old_page == rseg->page_no);
......
...@@ -299,6 +299,7 @@ void trx_rseg_format_upgrade(buf_block_t *rseg_header, mtr_t *mtr) ...@@ -299,6 +299,7 @@ void trx_rseg_format_upgrade(buf_block_t *rseg_header, mtr_t *mtr)
/** Create a rollback segment header. /** Create a rollback segment header.
@param[in,out] space system, undo, or temporary tablespace @param[in,out] space system, undo, or temporary tablespace
@param[in] rseg_id rollback segment identifier @param[in] rseg_id rollback segment identifier
@param[in] max_trx_id new value of TRX_RSEG_MAX_TRX_ID
@param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg) @param[in,out] sys_header the TRX_SYS page (NULL for temporary rseg)
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return the created rollback segment @return the created rollback segment
...@@ -307,6 +308,7 @@ buf_block_t* ...@@ -307,6 +308,7 @@ buf_block_t*
trx_rseg_header_create( trx_rseg_header_create(
fil_space_t* space, fil_space_t* space,
ulint rseg_id, ulint rseg_id,
trx_id_t max_trx_id,
buf_block_t* sys_header, buf_block_t* sys_header,
mtr_t* mtr) mtr_t* mtr)
{ {
...@@ -329,10 +331,16 @@ trx_rseg_header_create( ...@@ -329,10 +331,16 @@ trx_rseg_header_create(
+ block->frame)); + block->frame));
ut_ad(0 == mach_read_from_4(TRX_RSEG_HISTORY_SIZE + TRX_RSEG ut_ad(0 == mach_read_from_4(TRX_RSEG_HISTORY_SIZE + TRX_RSEG
+ block->frame)); + block->frame));
ut_ad(0 == mach_read_from_4(TRX_RSEG_MAX_TRX_ID + TRX_RSEG
+ block->frame));
/* Initialize the history list */ /* Initialize the history list */
flst_init(block, TRX_RSEG_HISTORY + TRX_RSEG, mtr); flst_init(block, TRX_RSEG_HISTORY + TRX_RSEG, mtr);
mtr->write<8,mtr_t::MAYBE_NOP>(*block,
TRX_RSEG + TRX_RSEG_MAX_TRX_ID
+ block->frame, max_trx_id);
/* Reset the undo log slots */ /* Reset the undo log slots */
mtr->memset(block, TRX_RSEG_UNDO_SLOTS + TRX_RSEG, mtr->memset(block, TRX_RSEG_UNDO_SLOTS + TRX_RSEG,
TRX_RSEG_N_SLOTS * 4, 0xff); TRX_RSEG_N_SLOTS * 4, 0xff);
...@@ -694,7 +702,7 @@ trx_rseg_create(ulint space_id) ...@@ -694,7 +702,7 @@ trx_rseg_create(ulint space_id)
ulint rseg_id = trx_sys_rseg_find_free(sys_header); ulint rseg_id = trx_sys_rseg_find_free(sys_header);
if (buf_block_t* rblock = rseg_id == ULINT_UNDEFINED if (buf_block_t* rblock = rseg_id == ULINT_UNDEFINED
? NULL ? NULL
: trx_rseg_header_create(space, rseg_id, sys_header, : trx_rseg_header_create(space, rseg_id, 0, sys_header,
&mtr)) { &mtr)) {
ut_ad(trx_sysf_rseg_get_space(sys_header, rseg_id) ut_ad(trx_sysf_rseg_get_space(sys_header, rseg_id)
== space_id); == space_id);
...@@ -725,7 +733,7 @@ trx_temp_rseg_create() ...@@ -725,7 +733,7 @@ trx_temp_rseg_create()
mtr_x_lock_space(fil_system.temp_space, &mtr); mtr_x_lock_space(fil_system.temp_space, &mtr);
buf_block_t* rblock = trx_rseg_header_create( buf_block_t* rblock = trx_rseg_header_create(
fil_system.temp_space, i, NULL, &mtr); fil_system.temp_space, i, 0, NULL, &mtr);
trx_rseg_t* rseg = trx_rseg_mem_create( trx_rseg_t* rseg = trx_rseg_mem_create(
i, fil_system.temp_space, rblock->page.id().page_no()); i, fil_system.temp_space, rblock->page.id().page_no());
ut_ad(!rseg->is_persistent()); ut_ad(!rseg->is_persistent());
......
...@@ -192,7 +192,7 @@ trx_sysf_create( ...@@ -192,7 +192,7 @@ trx_sysf_create(
/* Create the first rollback segment in the SYSTEM tablespace */ /* Create the first rollback segment in the SYSTEM tablespace */
slot_no = trx_sys_rseg_find_free(block); slot_no = trx_sys_rseg_find_free(block);
buf_block_t* rblock = trx_rseg_header_create(fil_system.sys_space, buf_block_t* rblock = trx_rseg_header_create(fil_system.sys_space,
slot_no, block, mtr); slot_no, 0, block, mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID); ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
ut_a(rblock->page.id() == page_id_t(0, FSP_FIRST_RSEG_PAGE_NO)); ut_a(rblock->page.id() == page_id_t(0, FSP_FIRST_RSEG_PAGE_NO));
......
Subproject commit 4f1c201c9d8ba96f9f43e9aafe8bb6a6c8aeceb7 Subproject commit efb4aab090cb9c1b57b9e7f9988ae1c41f48344f
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment