Establish undo table space physical file

This procedure calls the function performed srv_undo_tablespaces_init, stack frames as follows:

Srv_undo_tablespaces_init 0 # (= create_new_db to true, n_conf_tablespaces =. 4, n_opened = 0x2ef55b0)
AT /root/mysqlc/percona-server-locks-detail-5.7.22/storage/innobase/srv/srv0start.cc:824
# 0x0000000001bbd7e0. 1 in innobase_start_or_create_for_mysql () AT /root/mysqlc/percona-server-locks-detail-5.7.22/storage/innobase/srv/srv0start.cc:2188
# 2 0x00000000019ca74e in innobase_init (P = 0x2f2a420) AT / the root / MySQLC / Server-Percona Detail-5.7.22--locks / Storage / Innobase / Handler / ha_innodb.cc: 4409
#. 3 0x0000000000f7ec2a in ha_initialize_handlerton (= plugin 0x2fca110) AT /root/mysqlc/percona-server-locks-detail-5.7.22/sql/ handler.cc:871
# 0x00000000015f9edf in plugin_initialize. 4 (= plugin 0x2fca110) AT /root/mysqlc/percona-server-locks-detail-5.7.22/sql/sql_plugin.cc:1252
present process have the following main steps:

According to the parameters innodb_undo_tablespaces configuration file by calling srv_undo_tablespace_create were established, the size of the default established for the 10M:

for (i = 0; create_new_db && i <n_conf_tablespaces; ++ i) // number of innodb_undo_tablespaces n_conf_tablespaces configuration

. / ** Use the undo TABLESPACE size in the Default UNIV_PAGEs COUNT (10MB) * /
const ULINT SRV_UNDO_TABLESPACE_SIZE_IN_PAGES =
((1024 * 1024) * 10) / UNIV_PAGE_SIZE_DEF;
...
ERR = srv_undo_tablespace_create (
name, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES); // build undo file
...
this step will have a comment as follows:

/* Create the undo spaces only if we are creating a new
instance. We don't allow creating of new undo tablespaces
in an existing instance (yet). This restriction exists because
we check in several places for SYSTEM tablespaces to be less than
the min of user defined tablespace ids. Once we implement saving
the location of the undo tablespaces and their space ids this
restriction will/should be lifted. */
简单的讲就是建立undo tablespace只能在初始化实例的时候,因为space id已经固定了。

Respectively 4 undo tablespace call srv_undo_tablespace_open its main call fil_space_create and fil_node_create will join the newly created undo tablespace Innodb file system.

for (I = 0; I <n_undo_tablespaces; I ++) {
....
ERR = srv_undo_tablespace_open (name, undo_tablespace_ids [I]); // open the file creation UNDO Node File
...
}
, respectively, for the four undo tablespace fsp header initialization

for (I = 0; I <n_undo_tablespaces; I ++) {

fsp_header_init (// initialize fsp header has been written to clear space id
undo_tablespace_ids [I],
SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, & MTR); // undo SRV_UNDO_TABLESPACE_SIZE_IN_PAGES default size of 10MB
}
wherein fsp_header_init portion code show as below:

mlog_write_ulint(header + FSP_SPACE_ID, space_id, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_NOT_USED, 0, MLOG_4BYTES, mtr);

mlog_write_ulint(header + FSP_SIZE, size, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FREE_LIMIT, 0, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_SPACE_FLAGS, space->flags,
MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FRAG_N_USED, 0, MLOG_4BYTES, mtr);

flst_init(header + FSP_FREE, mtr);
flst_init(header + FSP_FREE_FRAG, mtr);
flst_init(header + FSP_FULL_FRAG, mtr);
flst_init(header + FSP_SEG_INODES_FULL, mtr);
flst_init(header + FSP_SEG_INODES_FREE, mtr);
这些都是fsp的内容。

This step is done only generates four undo tablespace to 10MB file, and the file system has been added to Innodb, but there is no class content.

Guess you like

Origin www.cnblogs.com/liyanyan665/p/11311290.html