Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d5bd704f
Commit
d5bd704f
authored
Sep 24, 2021
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
9c2d9236
4bfdba2e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
37 deletions
+34
-37
mysql-test/suite/innodb/r/undo_truncate.result
mysql-test/suite/innodb/r/undo_truncate.result
+2
-11
mysql-test/suite/innodb/t/undo_truncate.test
mysql-test/suite/innodb/t/undo_truncate.test
+14
-22
storage/innobase/include/trx0rseg.h
storage/innobase/include/trx0rseg.h
+2
-0
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+2
-0
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0purge.cc
+2
-1
storage/innobase/trx/trx0rseg.cc
storage/innobase/trx/trx0rseg.cc
+11
-2
storage/innobase/trx/trx0sys.cc
storage/innobase/trx/trx0sys.cc
+1
-1
No files found.
mysql-test/suite/innodb/r/undo_truncate.result
View file @
d5bd704f
SET @save_undo_logs = @@GLOBAL.innodb_undo_logs;
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_logs = 4;
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 t2(keyc int primary key, c char(100)) engine = innodb;
connect con1,localhost,root,,;
...
...
@@ -35,8 +28,6 @@ connection con2;
commit;
disconnect con2;
connection default;
set global innodb_fast_shutdown=0;
# restart
drop table t1, t2;
InnoDB 0 transactions not purged
SET GLOBAL innodb_undo_logs = @save_undo_logs;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
SET GLOBAL innodb_undo_log_truncate = @save_truncate;
mysql-test/suite/innodb/t/undo_truncate.test
View file @
d5bd704f
--
source
include
/
have_innodb
.
inc
--
source
include
/
innodb_page_size
.
inc
--
source
include
/
have_undo_tablespaces
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_sequence
.
inc
SET
@
save_undo_logs
=
@@
GLOBAL
.
innodb_undo_logs
;
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_logs
=
4
;
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.
...
...
@@ -44,21 +37,20 @@ commit; disconnect con1;
connection
con2
;
commit
;
disconnect
con2
;
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)`
;
# Truncation will normally not occur with innodb_page_size=64k,
# and occasionally not with innodb_page_size=32k,
# because the undo log will not grow enough.
if
(
`select @@innodb_page_size IN (4096,8192,16384)`
)
drop
table
t1
,
t2
;
if
(
$trx_before
!=
$trx_after
)
{
let
$wait_condition
=
(
SELECT
variable_value
!=@
trunc_start
FROM
information_schema
.
global_status
WHERE
variable_name
=
'innodb_undo_truncations'
);
source
include
/
wait_condition
.
inc
;
echo
Transaction
sequence
mismatch
:
$trx_before
!=
$trx_after
;
}
SET
GLOBAL
innodb_undo_logs
=
@
save_undo_logs
;
SET
GLOBAL
innodb_purge_rseg_truncate_frequency
=
@
save_frequency
;
SET
GLOBAL
innodb_undo_log_truncate
=
@
save_truncate
;
storage/innobase/include/trx0rseg.h
View file @
d5bd704f
...
...
@@ -71,6 +71,7 @@ trx_rsegf_undo_find_free(const trx_rsegf_t* rsegf);
/** Create a rollback segment header.
@param[in,out] space system, undo, or temporary tablespace
@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] mtr mini-transaction
@return the created rollback segment
...
...
@@ -79,6 +80,7 @@ buf_block_t*
trx_rseg_header_create
(
fil_space_t
*
space
,
ulint
rseg_id
,
trx_id_t
max_trx_id
,
buf_block_t
*
sys_header
,
mtr_t
*
mtr
);
...
...
storage/innobase/srv/srv0srv.cc
View file @
d5bd704f
...
...
@@ -2614,6 +2614,8 @@ static uint32_t srv_do_purge(ulint* n_total_purged
n_use_threads
,
!
(
++
count
%
srv_purge_rseg_truncate_frequency
)
||
purge_sys
.
truncate
.
current
||
(
srv_shutdown_state
!=
SRV_SHUTDOWN_NONE
&&
srv_fast_shutdown
==
0
)
#ifdef UNIV_DEBUG
,
slot
#endif
...
...
storage/innobase/trx/trx0purge.cc
View file @
d5bd704f
...
...
@@ -715,7 +715,8 @@ static void trx_purge_truncate_history()
buf_block_t
*
rblock
=
trx_rseg_header_create
(
purge_sys
.
truncate
.
current
,
rseg
->
id
,
sys_header
,
&
mtr
);
rseg
->
id
,
trx_sys
.
get_max_trx_id
(),
sys_header
,
&
mtr
);
ut_ad
(
rblock
);
rseg
->
page_no
=
rblock
?
rblock
->
page
.
id
.
page_no
()
:
FIL_NULL
;
...
...
storage/innobase/trx/trx0rseg.cc
View file @
d5bd704f
...
...
@@ -295,6 +295,7 @@ void trx_rseg_format_upgrade(trx_rsegf_t* rseg_header, mtr_t* mtr)
/** Create a rollback segment header.
@param[in,out] space system, undo, or temporary tablespace
@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] mtr mini-transaction
@return the created rollback segment
...
...
@@ -303,6 +304,7 @@ buf_block_t*
trx_rseg_header_create
(
fil_space_t
*
space
,
ulint
rseg_id
,
trx_id_t
max_trx_id
,
buf_block_t
*
sys_header
,
mtr_t
*
mtr
)
{
...
...
@@ -325,8 +327,15 @@ trx_rseg_header_create(
+
block
->
frame
));
ut_ad
(
0
==
mach_read_from_4
(
TRX_RSEG_HISTORY_SIZE
+
TRX_RSEG
+
block
->
frame
));
ut_ad
(
0
==
mach_read_from_4
(
TRX_RSEG_MAX_TRX_ID
+
TRX_RSEG
+
block
->
frame
));
/* Initialize the history list */
if
(
max_trx_id
)
{
mlog_write_ull
(
TRX_RSEG
+
TRX_RSEG_MAX_TRX_ID
+
block
->
frame
,
max_trx_id
,
mtr
);
}
flst_init
(
block
,
TRX_RSEG_HISTORY
+
TRX_RSEG
,
mtr
);
/* Reset the undo log slots */
...
...
@@ -685,7 +694,7 @@ trx_rseg_create(ulint space_id)
ulint
rseg_id
=
trx_sys_rseg_find_free
(
sys_header
);
if
(
buf_block_t
*
rblock
=
rseg_id
==
ULINT_UNDEFINED
?
NULL
:
trx_rseg_header_create
(
space
,
rseg_id
,
sys_header
,
:
trx_rseg_header_create
(
space
,
rseg_id
,
0
,
sys_header
,
&
mtr
))
{
ut_ad
(
trx_sysf_rseg_get_space
(
sys_header
,
rseg_id
)
==
space_id
);
...
...
@@ -715,7 +724,7 @@ trx_temp_rseg_create()
mtr_x_lock_space
(
fil_system
.
temp_space
,
&
mtr
);
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
(
i
,
fil_system
.
temp_space
,
rblock
->
page
.
id
.
page_no
());
ut_ad
(
!
rseg
->
is_persistent
());
...
...
storage/innobase/trx/trx0sys.cc
View file @
d5bd704f
...
...
@@ -196,7 +196,7 @@ trx_sysf_create(
/* Create the first rollback segment in the SYSTEM tablespace */
slot_no
=
trx_sys_rseg_find_free
(
block
);
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
(
rblock
->
page
.
id
.
page_no
()
==
FSP_FIRST_RSEG_PAGE_NO
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment