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
332e805e
Commit
332e805e
authored
Mar 26, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12266: Refactor trx_rseg_header_create()
parent
428e0289
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
27 deletions
+22
-27
storage/innobase/include/trx0rseg.h
storage/innobase/include/trx0rseg.h
+3
-5
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+4
-2
storage/innobase/trx/trx0rseg.cc
storage/innobase/trx/trx0rseg.cc
+12
-18
storage/innobase/trx/trx0sys.cc
storage/innobase/trx/trx0sys.cc
+2
-1
storage/innobase/trx/trx0undo.cc
storage/innobase/trx/trx0undo.cc
+1
-1
No files found.
storage/innobase/include/trx0rseg.h
View file @
332e805e
...
@@ -71,17 +71,15 @@ UNIV_INLINE
...
@@ -71,17 +71,15 @@ UNIV_INLINE
ulint
ulint
trx_rsegf_undo_find_free
(
const
trx_rsegf_t
*
rsegf
);
trx_rsegf_undo_find_free
(
const
trx_rsegf_t
*
rsegf
);
/** Creates a rollback segment header.
/** Create a rollback segment header.
This function is called only when a new rollback segment is created in
@param[in] space system, undo, or temporary tablespace
the database.
@param[in] space space id
@param[in] rseg_id rollback segment identifier
@param[in] rseg_id rollback segment identifier
@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 page number of the created segment, FIL_NULL if fail */
@return page number of the created segment, FIL_NULL if fail */
ulint
ulint
trx_rseg_header_create
(
trx_rseg_header_create
(
ulint
space
,
const
fil_space_t
*
space
,
ulint
rseg_id
,
ulint
rseg_id
,
buf_block_t
*
sys_header
,
buf_block_t
*
sys_header
,
mtr_t
*
mtr
);
mtr_t
*
mtr
);
...
...
storage/innobase/srv/srv0start.cc
View file @
332e805e
...
@@ -1073,7 +1073,9 @@ srv_undo_tablespaces_init(bool create_new_db)
...
@@ -1073,7 +1073,9 @@ srv_undo_tablespaces_init(bool create_new_db)
undo
::
Truncate
::
add_space_to_trunc_list
(
*
it
);
undo
::
Truncate
::
add_space_to_trunc_list
(
*
it
);
fsp_header_init
(
fil_space_get
(
*
it
),
fil_space_t
*
space
=
fil_space_get
(
*
it
);
fsp_header_init
(
space
,
SRV_UNDO_TABLESPACE_SIZE_IN_PAGES
,
SRV_UNDO_TABLESPACE_SIZE_IN_PAGES
,
&
mtr
);
&
mtr
);
...
@@ -1081,7 +1083,7 @@ srv_undo_tablespaces_init(bool create_new_db)
...
@@ -1081,7 +1083,7 @@ srv_undo_tablespaces_init(bool create_new_db)
if
(
trx_sysf_rseg_get_space
(
sys_header
,
i
)
if
(
trx_sysf_rseg_get_space
(
sys_header
,
i
)
==
*
it
)
{
==
*
it
)
{
trx_rseg_header_create
(
trx_rseg_header_create
(
*
it
,
i
,
sys_header
,
&
mtr
);
space
,
i
,
sys_header
,
&
mtr
);
}
}
}
}
...
...
storage/innobase/trx/trx0rseg.cc
View file @
332e805e
...
@@ -261,17 +261,15 @@ void trx_rseg_format_upgrade(trx_rsegf_t* rseg_header, mtr_t* mtr)
...
@@ -261,17 +261,15 @@ void trx_rseg_format_upgrade(trx_rsegf_t* rseg_header, mtr_t* mtr)
mlog_log_string
(
b
,
len
,
mtr
);
mlog_log_string
(
b
,
len
,
mtr
);
}
}
/** Creates a rollback segment header.
/** Create a rollback segment header.
This function is called only when a new rollback segment is created in
@param[in] space system, undo, or temporary tablespace
the database.
@param[in] space space id
@param[in] rseg_id rollback segment identifier
@param[in] rseg_id rollback segment identifier
@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 page number of the created segment, FIL_NULL if fail */
@return page number of the created segment, FIL_NULL if fail */
ulint
ulint
trx_rseg_header_create
(
trx_rseg_header_create
(
ulint
space
,
const
fil_space_t
*
space
,
ulint
rseg_id
,
ulint
rseg_id
,
buf_block_t
*
sys_header
,
buf_block_t
*
sys_header
,
mtr_t
*
mtr
)
mtr_t
*
mtr
)
...
@@ -280,13 +278,12 @@ trx_rseg_header_create(
...
@@ -280,13 +278,12 @@ trx_rseg_header_create(
trx_rsegf_t
*
rsegf
;
trx_rsegf_t
*
rsegf
;
buf_block_t
*
block
;
buf_block_t
*
block
;
ut_ad
(
mtr
);
ut_ad
(
mtr_memo_contains
(
mtr
,
&
space
->
latch
,
MTR_MEMO_X_LOCK
));
ut_ad
(
mtr_memo_contains
(
mtr
,
fil_space_get_latch
(
space
,
NULL
),
ut_ad
(
!
sys_header
==
(
space
==
fil_system
.
temp_space
));
MTR_MEMO_X_LOCK
));
ut_ad
(
!
sys_header
==
(
space
==
SRV_TMP_SPACE_ID
));
/* Allocate a new file segment for the rollback segment */
/* Allocate a new file segment for the rollback segment */
block
=
fseg_create
(
space
,
0
,
TRX_RSEG
+
TRX_RSEG_FSEG_HEADER
,
mtr
);
block
=
fseg_create
(
space
->
id
,
0
,
TRX_RSEG
+
TRX_RSEG_FSEG_HEADER
,
mtr
);
if
(
block
==
NULL
)
{
if
(
block
==
NULL
)
{
/* No space left */
/* No space left */
...
@@ -299,7 +296,7 @@ trx_rseg_header_create(
...
@@ -299,7 +296,7 @@ trx_rseg_header_create(
page_no
=
block
->
page
.
id
.
page_no
();
page_no
=
block
->
page
.
id
.
page_no
();
/* Get the rollback segment file page */
/* Get the rollback segment file page */
rsegf
=
trx_rsegf_get_new
(
space
,
page_no
,
mtr
);
rsegf
=
trx_rsegf_get_new
(
space
->
id
,
page_no
,
mtr
);
mlog_write_ulint
(
rsegf
+
TRX_RSEG_FORMAT
,
0
,
MLOG_4BYTES
,
mtr
);
mlog_write_ulint
(
rsegf
+
TRX_RSEG_FORMAT
,
0
,
MLOG_4BYTES
,
mtr
);
...
@@ -322,7 +319,7 @@ trx_rseg_header_create(
...
@@ -322,7 +319,7 @@ trx_rseg_header_create(
+
TRX_SYS_RSEG_SPACE
+
TRX_SYS_RSEG_SPACE
+
rseg_id
*
TRX_SYS_RSEG_SLOT_SIZE
+
rseg_id
*
TRX_SYS_RSEG_SLOT_SIZE
+
sys_header
->
frame
,
+
sys_header
->
frame
,
space
,
MLOG_4BYTES
,
mtr
);
space
->
id
,
MLOG_4BYTES
,
mtr
);
mlog_write_ulint
(
TRX_SYS
+
TRX_SYS_RSEGS
mlog_write_ulint
(
TRX_SYS
+
TRX_SYS_RSEGS
+
TRX_SYS_RSEG_PAGE_NO
+
TRX_SYS_RSEG_PAGE_NO
+
rseg_id
*
TRX_SYS_RSEG_SLOT_SIZE
+
rseg_id
*
TRX_SYS_RSEG_SLOT_SIZE
...
@@ -603,17 +600,14 @@ trx_rseg_create(ulint space_id)
...
@@ -603,17 +600,14 @@ trx_rseg_create(ulint space_id)
/* To obey the latching order, acquire the file space
/* To obey the latching order, acquire the file space
x-latch before the trx_sys.mutex. */
x-latch before the trx_sys.mutex. */
#ifdef UNIV_DEBUG
const
fil_space_t
*
space
=
mtr_x_lock_space
(
space_id
,
&
mtr
);
const
fil_space_t
*
space
=
#endif
/* UNIV_DEBUG */
mtr_x_lock_space
(
space_id
,
&
mtr
);
ut_ad
(
space
->
purpose
==
FIL_TYPE_TABLESPACE
);
ut_ad
(
space
->
purpose
==
FIL_TYPE_TABLESPACE
);
if
(
buf_block_t
*
sys_header
=
trx_sysf_get
(
&
mtr
))
{
if
(
buf_block_t
*
sys_header
=
trx_sysf_get
(
&
mtr
))
{
ulint
rseg_id
=
trx_sys_rseg_find_free
(
sys_header
);
ulint
rseg_id
=
trx_sys_rseg_find_free
(
sys_header
);
ulint
page_no
=
rseg_id
==
ULINT_UNDEFINED
ulint
page_no
=
rseg_id
==
ULINT_UNDEFINED
?
FIL_NULL
?
FIL_NULL
:
trx_rseg_header_create
(
space
_id
,
rseg_id
,
sys_header
,
:
trx_rseg_header_create
(
space
,
rseg_id
,
sys_header
,
&
mtr
);
&
mtr
);
if
(
page_no
!=
FIL_NULL
)
{
if
(
page_no
!=
FIL_NULL
)
{
ut_ad
(
trx_sysf_rseg_get_space
(
sys_header
,
rseg_id
)
ut_ad
(
trx_sysf_rseg_get_space
(
sys_header
,
rseg_id
)
...
@@ -643,7 +637,7 @@ trx_temp_rseg_create()
...
@@ -643,7 +637,7 @@ trx_temp_rseg_create()
mtr_x_lock
(
&
fil_system
.
temp_space
->
latch
,
&
mtr
);
mtr_x_lock
(
&
fil_system
.
temp_space
->
latch
,
&
mtr
);
ulint
page_no
=
trx_rseg_header_create
(
ulint
page_no
=
trx_rseg_header_create
(
SRV_TMP_SPACE_ID
,
i
,
NULL
,
&
mtr
);
fil_system
.
temp_space
,
i
,
NULL
,
&
mtr
);
trx_rseg_t
*
rseg
=
trx_rseg_mem_create
(
trx_rseg_t
*
rseg
=
trx_rseg_mem_create
(
i
,
SRV_TMP_SPACE_ID
,
page_no
);
i
,
SRV_TMP_SPACE_ID
,
page_no
);
ut_ad
(
!
rseg
->
is_persistent
());
ut_ad
(
!
rseg
->
is_persistent
());
...
...
storage/innobase/trx/trx0sys.cc
View file @
332e805e
...
@@ -200,7 +200,8 @@ trx_sysf_create(
...
@@ -200,7 +200,8 @@ 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
);
page_no
=
trx_rseg_header_create
(
TRX_SYS_SPACE
,
slot_no
,
block
,
mtr
);
page_no
=
trx_rseg_header_create
(
fil_system
.
sys_space
,
slot_no
,
block
,
mtr
);
ut_a
(
slot_no
==
TRX_SYS_SYSTEM_RSEG_ID
);
ut_a
(
slot_no
==
TRX_SYS_SYSTEM_RSEG_ID
);
ut_a
(
page_no
==
FSP_FIRST_RSEG_PAGE_NO
);
ut_a
(
page_no
==
FSP_FIRST_RSEG_PAGE_NO
);
...
...
storage/innobase/trx/trx0undo.cc
View file @
332e805e
...
@@ -1728,7 +1728,7 @@ trx_undo_truncate_tablespace(
...
@@ -1728,7 +1728,7 @@ trx_undo_truncate_tablespace(
trx_rseg_t
*
rseg
=
undo_trunc
->
get_ith_rseg
(
i
);
trx_rseg_t
*
rseg
=
undo_trunc
->
get_ith_rseg
(
i
);
rseg
->
page_no
=
trx_rseg_header_create
(
rseg
->
page_no
=
trx_rseg_header_create
(
space
->
id
,
rseg
->
id
,
sys_header
,
&
mtr
);
space
,
rseg
->
id
,
sys_header
,
&
mtr
);
rseg_header
=
trx_rsegf_get_new
(
space
->
id
,
rseg
->
page_no
,
rseg_header
=
trx_rsegf_get_new
(
space
->
id
,
rseg
->
page_no
,
&
mtr
);
&
mtr
);
...
...
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