MySQL  8.0.17
Source Code Documentation
srv0start.cc File Reference

Starts the InnoDB database server. More...

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <zlib.h>
#include "my_dbug.h"
#include "btr0btr.h"
#include "btr0cur.h"
#include "buf0buf.h"
#include "buf0dump.h"
#include "current_thd.h"
#include "data0data.h"
#include "data0type.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
#include "fsp0sysspace.h"
#include "ha_prototypes.h"
#include "ibuf0ibuf.h"
#include "log0log.h"
#include "log0recv.h"
#include "mem0mem.h"
#include "mtr0mtr.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "mysql/psi/mysql_stage.h"
#include "mysqld.h"
#include "os0file.h"
#include "os0thread-create.h"
#include "os0thread.h"
#include "page0cur.h"
#include "page0page.h"
#include "rem0rec.h"
#include "row0ftsort.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "trx0sys.h"
#include "trx0trx.h"
#include "ut0mem.h"
#include "arch0arch.h"
#include "arch0recv.h"
#include "btr0pcur.h"
#include "btr0sea.h"
#include "buf0flu.h"
#include "buf0rea.h"
#include "clone0api.h"
#include "clone0clone.h"
#include "dict0boot.h"
#include "dict0crea.h"
#include "dict0load.h"
#include "dict0stats_bg.h"
#include "lock0lock.h"
#include "os0event.h"
#include "os0proc.h"
#include "pars0pars.h"
#include "que0que.h"
#include "rem0cmp.h"
#include "row0ins.h"
#include "row0mysql.h"
#include "row0row.h"
#include "row0sel.h"
#include "row0upd.h"
#include "srv0tmp.h"
#include "trx0purge.h"
#include "trx0roll.h"
#include "trx0rseg.h"
#include "usr0sess.h"
#include "ut0crc32.h"
#include "ut0new.h"

Classes

struct  metadata_applier
 Applier of dynamic metadata. More...
 

Macros

#define SRV_MAX_N_PENDING_SYNC_IOS   100
 
#define INIT_LOG_FILE0   (SRV_N_LOG_FILES_MAX + 1)
 Initial number of the first redo log file. More...
 
#define srv_init_abort(_db_err)   srv_init_abort_low(create_new_db, __FILE__, __LINE__, _db_err)
 

Enumerations

enum  srv_start_state_t {
  SRV_START_STATE_NONE = 0, SRV_START_STATE_LOCK_SYS = 1, SRV_START_STATE_IO = 2, SRV_START_STATE_MONITOR = 4,
  SRV_START_STATE_MASTER = 8, SRV_START_STATE_PURGE = 16, SRV_START_STATE_STAT = 32
}
 Bit flags for tracking background thread creation. More...
 

Functions

static bool srv_file_check_mode (const char *name)
 Check if a file can be opened in read-write mode. More...
 
static void io_handler_thread (ulint segment)
 I/o-handler thread function. More...
 
static dberr_t create_log_file (pfs_os_file_t *file, const char *name)
 Creates a log file. More...
 
static dberr_t create_log_files (char *logfilename, size_t dirnamelen, lsn_t lsn, uint32_t num_old_files, char *&logfile0, lsn_t &checkpoint_lsn)
 Creates all log files. More...
 
static void create_log_files_rename (char *logfilename, size_t dirnamelen, lsn_t lsn, char *logfile0)
 Renames the first log file. More...
 
static dberr_t open_log_file (pfs_os_file_t *file, const char *name, os_offset_t *size)
 Opens a log file. More...
 
static dberr_t srv_undo_tablespace_create (undo::Tablespace &undo_space)
 Create undo tablespace. More...
 
static dberr_t srv_undo_tablespace_enable_encryption (space_id_t space_id)
 Try to enable encryption of an undo log tablespace. More...
 
static dberr_t srv_undo_tablespace_read_encryption (pfs_os_file_t fh, fil_space_t *space)
 Try to read encryption metadata from an undo tablespace. More...
 
static dberr_t srv_undo_tablespace_fixup_57 (space_id_t space_id)
 Fix up a v5.7 type undo tablespace that was being truncated. More...
 
static dberr_t srv_undo_tablespace_fixup_num (space_id_t space_num)
 Start the fix-up process on an undo tablespace if it was in the process of being truncated when the server crashed. More...
 
dberr_t srv_undo_tablespace_fixup (const char *space_name, const char *file_name, space_id_t space_id)
 Fix up an undo tablespace if it was in the process of being truncated when the server crashed. More...
 
static dberr_t srv_undo_tablespace_open (undo::Tablespace &undo_space)
 Open an undo tablespace. More...
 
static dberr_t srv_undo_tablespace_open_by_id (space_id_t space_id)
 Open an undo tablespace with a specified space_id. More...
 
static dberr_t srv_undo_tablespace_open_by_num (space_id_t space_num)
 Open an undo tablespace with a specified undo number. More...
 
static dberr_t srv_undo_tablespaces_open ()
 
static dberr_t srv_undo_tablespaces_create ()
 Create the implicit undo tablespaces if we are creating a new instance or if there was not enough implicit undo tablespaces previously existing. More...
 
static dberr_t srv_undo_tablespaces_construct (bool create_new_db)
 Finish building an undo tablespace. More...
 
static void srv_undo_tablespaces_mark_construction_done ()
 Mark the point in which the undo tablespaces in the construction list are fully constructed and ready to use. More...
 
dberr_t srv_undo_tablespaces_upgrade ()
 Upgrade undo tablespaces by deleting the old undo tablespaces referenced by the TRX_SYS page. More...
 
static void srv_undo_tablespaces_downgrade ()
 Downgrade undo tablespaces by deleting the new undo tablespaces which are not referenced by the TRX_SYS page. More...
 
dberr_t srv_undo_tablespace_create (const char *space_name, const char *file_name, space_id_t space_id)
 Create an undo tablespace with an explicit file name This is called during CREATE UNDO TABLESPACE. More...
 
void undo_spaces_init ()
 Initialize undo::spaces and trx_sys_undo_spaces, called once during srv_start(). More...
 
void undo_spaces_deinit ()
 Free the resources occupied by undo::spaces and trx_sys_undo_spaces, called once during thread de-initialization. More...
 
static dberr_t srv_undo_tablespaces_init (bool create_new_db)
 Open the configured number of implicit undo tablespaces. More...
 
static void srv_start_wait_for_purge_to_start ()
 
static dberr_t srv_open_tmp_tablespace (bool create_new_db, SysTablespace *tmp_space)
 Create the temporary file tablespace. More...
 
static void srv_create_sdi_indexes ()
 Create SDI Indexes in system tablespace. More...
 
UNIV_INLINE void srv_start_state_set (srv_start_state_t state)
 Set state to indicate start of particular group of threads in InnoDB. More...
 
UNIV_INLINE bool srv_start_state_is_set (srv_start_state_t state)
 Check if following group of threads is started. More...
 
void srv_shutdown_all_bg_threads ()
 Attempt to shutdown all background threads created by InnoDB. More...
 
static dberr_t srv_init_abort_low (bool create_new_db, const char *file, ulint line, dberr_t err)
 Innobase start-up aborted. More...
 
static lsn_t srv_prepare_to_delete_redo_log_files (ulint n_files)
 Prepare to delete the redo log files. More...
 
dberr_t srv_start (bool create_new_db, const std::string &scan_directories)
 Start InnoDB. More...
 
static void apply_dynamic_metadata ()
 Apply the dynamic metadata to all tables. More...
 
void srv_dict_recover_on_restart ()
 On a restart, initialize the remaining InnoDB subsystems so that any tables (including data dictionary tables) can be accessed. More...
 
bool is_early_redo_undo_encryption_done ()
 If early redo/undo log encryption processing is done. More...
 
void srv_start_purge_threads ()
 Start purge threads. More...
 
void srv_start_threads (bool bootstrap)
 Start up the remaining InnoDB service threads. More...
 
static void srv_shutdown_background_threads ()
 Shutdown background threads of InnoDB at the start of the shutdown phase. More...
 
void srv_pre_dd_shutdown ()
 Shut down all InnoDB background tasks that may look up objects in the data dictionary. More...
 
static void srv_shutdown_page_cleaners ()
 
static lsn_t srv_shutdown_log ()
 Closes redo log. More...
 
static void srv_shutdown_arch ()
 Copy all remaining data and shutdown archiver threads. More...
 
void srv_thread_delay_cleanup_if_needed (bool wait_for_signal)
 Delay the thread after it discovered that the shutdown_state is greater or equal to SRV_SHUTDOWN_CLEANUP, before it proceeds with further clean up. More...
 
void srv_shutdown ()
 Shut down the InnoDB database. More...
 
void srv_get_encryption_data_filename (dict_table_t *table, char *filename, ulint max_len)
 Get the encryption-data filename from the table name for a single-table tablespace. More...
 
void srv_fatal_error ()
 Call exit(3) More...
 

Variables

uint32_t predefined_flags
 fil_space_t::flags for hard-coded tablespaces More...
 
static MetadataRecoversrv_dict_metadata
 Recovered persistent metadata. More...
 
ibool srv_start_raw_disk_in_use = FALSE
 TRUE if a raw partition is in use. More...
 
ulint srv_n_file_io_threads = 0
 Number of IO threads to use. More...
 
bool srv_is_being_started = false
 true if the server is being started More...
 
bool srv_sys_tablespaces_open = false
 true if SYS_TABLESPACES is available for lookups More...
 
bool srv_startup_is_before_trx_rollback_phase = false
 true if the server is being started, before rolling back any incomplete transactions More...
 
bool srv_is_being_shutdown = false
 true if srv_pre_dd_shutdown() has been completed More...
 
static bool srv_start_has_been_called = false
 true if srv_start() has been called More...
 
static uint64_t srv_start_state = SRV_START_STATE_NONE
 Track server thrd starting phases. More...
 
std::atomic< enum srv_shutdown_tsrv_shutdown_state {SRV_SHUTDOWN_NONE}
 At a shutdown this value climbs from SRV_SHUTDOWN_NONE to SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE, and so on. More...
 
static pfs_os_file_t files [1000]
 Files comprising the system tablespace. More...
 
static char * srv_monitor_file_name
 Name of srv_monitor_file. More...
 
static PSI_stage_infosrv_stages []
 Array of all InnoDB stage events for monitoring activities via performance schema. More...
 
static constexpr uint32_t SHUTDOWN_SLEEP_TIME_US = 100
 Sleep time in loops which wait for pending tasks during shutdown. More...
 
static constexpr uint32_t SHUTDOWN_SLEEP_ROUNDS
 Number of wait rounds during shutdown, after which error is produced, or other policy for timed out wait is applied. More...
 

Detailed Description

Starts the InnoDB database server.

Created 2/16/1996 Heikki Tuuri

Macro Definition Documentation

◆ INIT_LOG_FILE0

#define INIT_LOG_FILE0   (SRV_N_LOG_FILES_MAX + 1)

Initial number of the first redo log file.

◆ srv_init_abort

#define srv_init_abort (   _db_err)    srv_init_abort_low(create_new_db, __FILE__, __LINE__, _db_err)

◆ SRV_MAX_N_PENDING_SYNC_IOS

#define SRV_MAX_N_PENDING_SYNC_IOS   100

Enumeration Type Documentation

◆ srv_start_state_t

Bit flags for tracking background thread creation.

They are used to determine which threads need to be stopped if we need to abort during the initialisation step.

Enumerator
SRV_START_STATE_NONE 

No thread started.

SRV_START_STATE_LOCK_SYS 

Started lock-timeout thread.

SRV_START_STATE_IO 

Started IO threads.

SRV_START_STATE_MONITOR 

Started montior thread.

SRV_START_STATE_MASTER 

Started master threadd.

SRV_START_STATE_PURGE 

Started purge thread(s)

SRV_START_STATE_STAT 

Started bufdump + dict stat and FTS optimize thread.

Function Documentation

◆ apply_dynamic_metadata()

static void apply_dynamic_metadata ( )
static

Apply the dynamic metadata to all tables.

◆ create_log_file()

static dberr_t create_log_file ( pfs_os_file_t file,
const char *  name 
)
static

Creates a log file.

Returns
DB_SUCCESS or error code
Parameters
fileout: file handle
namein: log file name

◆ create_log_files()

static dberr_t create_log_files ( char *  logfilename,
size_t  dirnamelen,
lsn_t  lsn,
uint32_t  num_old_files,
char *&  logfile0,
lsn_t checkpoint_lsn 
)
static

Creates all log files.

Parameters
[in,out]logfilenamebuffer for log file name
[in]dirnamelenlength of the directory path
[in]lsnFIL_PAGE_FILE_FLUSH_LSN value
[in]num_old_filesnumber of old redo log files to remove
[out]logfile0name of the first log file
[out]checkpoint_lsnlsn of the first created checkpoint
Returns
DB_SUCCESS or error code

◆ create_log_files_rename()

static void create_log_files_rename ( char *  logfilename,
size_t  dirnamelen,
lsn_t  lsn,
char *  logfile0 
)
static

Renames the first log file.

Parameters
logfilenamein/out: buffer for log file name
dirnamelenin: length of the directory path
lsnin: checkpoint lsn (and start lsn)
logfile0in/out: name of the first log file

◆ io_handler_thread()

static void io_handler_thread ( ulint  segment)
static

I/o-handler thread function.

Parameters
[in]segmentThe AIO segment the thread will work on

◆ is_early_redo_undo_encryption_done()

bool is_early_redo_undo_encryption_done ( )

If early redo/undo log encryption processing is done.

Returns
true if it's done.

◆ open_log_file()

static dberr_t open_log_file ( pfs_os_file_t file,
const char *  name,
os_offset_t size 
)
static

Opens a log file.

Returns
DB_SUCCESS or error code
Parameters
fileout: file handle
namein: log file name
sizeout: file size

◆ srv_create_sdi_indexes()

static void srv_create_sdi_indexes ( )
static

Create SDI Indexes in system tablespace.

◆ srv_dict_recover_on_restart()

void srv_dict_recover_on_restart ( )

On a restart, initialize the remaining InnoDB subsystems so that any tables (including data dictionary tables) can be accessed.

◆ srv_fatal_error()

void srv_fatal_error ( )

Call exit(3)

◆ srv_file_check_mode()

static bool srv_file_check_mode ( const char *  name)
static

Check if a file can be opened in read-write mode.

Returns
true if it doesn't exist or can be opened in rw mode.
Parameters
namein: filename to check

◆ srv_get_encryption_data_filename()

void srv_get_encryption_data_filename ( dict_table_t table,
char *  filename,
ulint  max_len 
)

Get the encryption-data filename from the table name for a single-table tablespace.

Parameters
[in]tabletable object
[out]filenamefilename
[in]max_lenfilename max length

◆ srv_init_abort_low()

static dberr_t srv_init_abort_low ( bool  create_new_db,
const char *  file,
ulint  line,
dberr_t  err 
)
static

Innobase start-up aborted.

Perform cleanup actions.

Parameters
[in]create_new_dbTRUE if new db is being created
[in]fileFile name
[in]lineLine number
[in]errReason for aborting InnoDB startup
Returns
DB_SUCCESS or error code.

◆ srv_open_tmp_tablespace()

static dberr_t srv_open_tmp_tablespace ( bool  create_new_db,
SysTablespace tmp_space 
)
static

Create the temporary file tablespace.

Parameters
[in]create_new_dbwhether we are creating a new database
[in,out]tmp_spaceShared Temporary SysTablespace
Returns
DB_SUCCESS or error code.

◆ srv_pre_dd_shutdown()

void srv_pre_dd_shutdown ( )

Shut down all InnoDB background tasks that may look up objects in the data dictionary.

◆ srv_prepare_to_delete_redo_log_files()

static lsn_t srv_prepare_to_delete_redo_log_files ( ulint  n_files)
static

Prepare to delete the redo log files.

Flush the dirty pages from all the buffer pools. Flush the redo log buffer to the redo log file.

Parameters
[in]n_filesnumber of old redo log files
Returns
lsn upto which data pages have been flushed.

◆ srv_shutdown()

void srv_shutdown ( )

Shut down the InnoDB database.

◆ srv_shutdown_all_bg_threads()

void srv_shutdown_all_bg_threads ( )

Attempt to shutdown all background threads created by InnoDB.

Shut down all InnoDB background threads.

NOTE: Does not guarantee they are actually shut down, only does the best effort. Changes state of shutdown to SHUTDOWN_EXIT_THREADS, wakes up the background threads and waits a little bit. It might be used within startup phase or when fatal error is discovered during some IO operation. Therefore you must not assume anything related to the state in which it might be used.

◆ srv_shutdown_arch()

static void srv_shutdown_arch ( )
static

Copy all remaining data and shutdown archiver threads.

◆ srv_shutdown_background_threads()

static void srv_shutdown_background_threads ( )
static

Shutdown background threads of InnoDB at the start of the shutdown phase.

This phase happens when plugins are asked to be shut down, in which case they are already marked as DELETED. Note: be careful not to leave any transaction in the THD, because the mechanism which cleans resources in THD would not be able to unregister those transactions from mysql_trx_list, because the handler of close_connection in InnoDB handlerton would not be called, because InnoDB has already been marked as DELETED. You should close your thread earlier, in the srv_pre_dd_shutdown if it might do lookups in DD objects. That phase happens earlier (ha_panic function) before the shutdown of plugins happens).

Name of the thread, printed to the error log if we waited too long (after 60 seconds and then every 60 seconds).


Future which allows to check if given task is completed.

Function which can be called any number of times to wake

the possibly waiting thread, so it could exit.

Shutdown state in which we are waiting until thread is exited

(earlier we keep notifying but we don't require it to exit before we may switch to the next state).

◆ srv_shutdown_log()

static lsn_t srv_shutdown_log ( )
static

Closes redo log.

If this is not fast shutdown, it forces to write a checkpoint which should be written for logically empty redo log. Note that we forced to flush all dirty pages in the last stages of page cleaners activity (unless it was fast shutdown). After checkpoint is written, the flushed_lsn is updated within header of the system tablespace. This is lsn of the last clean shutdown.

◆ srv_shutdown_page_cleaners()

static void srv_shutdown_page_cleaners ( )
static

◆ srv_start()

dberr_t srv_start ( bool  create_new_db,
const std::string &  scan_directories 
)

Start InnoDB.

Parameters
[in]create_new_dbWhether to create a new database
[in]scan_directoriesScan directories for .ibd files for recovery "dir1;dir2; ... dirN"
Returns
DB_SUCCESS or error code

◆ srv_start_purge_threads()

void srv_start_purge_threads ( )

Start purge threads.

During upgrade we start purge threads early to apply purge.

◆ srv_start_state_is_set()

UNIV_INLINE bool srv_start_state_is_set ( srv_start_state_t  state)

Check if following group of threads is started.

Returns
true if started
Parameters
statein: state to check for

◆ srv_start_state_set()

UNIV_INLINE void srv_start_state_set ( srv_start_state_t  state)

Set state to indicate start of particular group of threads in InnoDB.

Parameters
statein: indicate current state of thread startup

◆ srv_start_threads()

void srv_start_threads ( bool  bootstrap)

Start up the remaining InnoDB service threads.

Parameters
[in]bootstrapTrue if this is in bootstrap

◆ srv_start_wait_for_purge_to_start()

static void srv_start_wait_for_purge_to_start ( )
static

◆ srv_thread_delay_cleanup_if_needed()

void srv_thread_delay_cleanup_if_needed ( bool  wait_for_signal)

Delay the thread after it discovered that the shutdown_state is greater or equal to SRV_SHUTDOWN_CLEANUP, before it proceeds with further clean up.

This is used in the tests to see if such a possible delay does not have impact on the clean shutdown.

Parameters
[in]wait_for_signalwait until shutdown phase starts

◆ srv_undo_tablespace_create() [1/2]

static dberr_t srv_undo_tablespace_create ( undo::Tablespace undo_space)
static

Create undo tablespace.

Parameters
[in]undo_spaceUndo Tablespace
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespace_create() [2/2]

dberr_t srv_undo_tablespace_create ( const char *  space_name,
const char *  file_name,
space_id_t  space_id 
)

Create an undo tablespace with an explicit file name This is called during CREATE UNDO TABLESPACE.

Create an undo tablespace with an explicit file name.

Parameters
[in]space_nametablespace name
[in]file_namefile name
[in]space_idTablespace ID
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespace_enable_encryption()

static dberr_t srv_undo_tablespace_enable_encryption ( space_id_t  space_id)
static

Try to enable encryption of an undo log tablespace.

Parameters
[in]space_idundo tablespace id
Returns
DB_SUCCESS if success

◆ srv_undo_tablespace_fixup()

dberr_t srv_undo_tablespace_fixup ( const char *  space_name,
const char *  file_name,
space_id_t  space_id 
)

Fix up an undo tablespace if it was in the process of being truncated when the server crashed.

This is the second call and is done after the DD is available so now we know the space_name, file_name and previous space_id.

Parameters
[in]space_nameundo tablespace name
[in]file_nameundo tablespace file name
[in]space_idundo tablespace ID
Returns
error code

◆ srv_undo_tablespace_fixup_57()

static dberr_t srv_undo_tablespace_fixup_57 ( space_id_t  space_id)
static

Fix up a v5.7 type undo tablespace that was being truncated.

The space_id is not a reserved undo space_id. We will just delete the file since it will be replaced.

Parameters
[in]space_idTablespace ID
Returns
error code

◆ srv_undo_tablespace_fixup_num()

static dberr_t srv_undo_tablespace_fixup_num ( space_id_t  space_num)
static

Start the fix-up process on an undo tablespace if it was in the process of being truncated when the server crashed.

At this point, just delete the old file if it exists. We could do the whole reconstruction here for implicit undo spaces since we know the space_id, space_name, and file_name implicitly. But for explicit undo spaces, we must wait for the DD to be scanned in boot_tablespaces() in order to know the space_id, space_name, and file_name.

Parameters
[in]space_numundo tablespace number
Returns
error code

◆ srv_undo_tablespace_open()

static dberr_t srv_undo_tablespace_open ( undo::Tablespace undo_space)
static

Open an undo tablespace.

Parameters
[in]undo_spaceUndo tablespace
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespace_open_by_id()

static dberr_t srv_undo_tablespace_open_by_id ( space_id_t  space_id)
static

Open an undo tablespace with a specified space_id.

Parameters
[in]space_idtablespace ID
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespace_open_by_num()

static dberr_t srv_undo_tablespace_open_by_num ( space_id_t  space_num)
static

Open an undo tablespace with a specified undo number.

Parameters
[in]space_numundo tablespace number
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespace_read_encryption()

static dberr_t srv_undo_tablespace_read_encryption ( pfs_os_file_t  fh,
fil_space_t space 
)
static

Try to read encryption metadata from an undo tablespace.

Parameters
[in]fhfile handle of undo log file
[in]spaceundo tablespace
Returns
DB_SUCCESS if success

◆ srv_undo_tablespaces_construct()

static dberr_t srv_undo_tablespaces_construct ( bool  create_new_db)
static

Finish building an undo tablespace.

So far these tablespace files in the construction list should be created and filled with zeros.

Parameters
[in]create_new_dbwhether to create a new database
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespaces_create()

static dberr_t srv_undo_tablespaces_create ( )
static

Create the implicit undo tablespaces if we are creating a new instance or if there was not enough implicit undo tablespaces previously existing.

Returns
DB_SUCCESS or error code

◆ srv_undo_tablespaces_downgrade()

static void srv_undo_tablespaces_downgrade ( )
static

Downgrade undo tablespaces by deleting the new undo tablespaces which are not referenced by the TRX_SYS page.

Returns
error code

◆ srv_undo_tablespaces_init()

static dberr_t srv_undo_tablespaces_init ( bool  create_new_db)
static

Open the configured number of implicit undo tablespaces.

Parameters
[in]create_new_dbtrue if new db being created
Returns
DB_SUCCESS or error code

◆ srv_undo_tablespaces_mark_construction_done()

static void srv_undo_tablespaces_mark_construction_done ( )
static

Mark the point in which the undo tablespaces in the construction list are fully constructed and ready to use.

Returns
DB_SUCCESS or error code

◆ srv_undo_tablespaces_open()

static dberr_t srv_undo_tablespaces_open ( )
static

◆ srv_undo_tablespaces_upgrade()

dberr_t srv_undo_tablespaces_upgrade ( )

Upgrade undo tablespaces by deleting the old undo tablespaces referenced by the TRX_SYS page.

Returns
error code

◆ undo_spaces_deinit()

void undo_spaces_deinit ( )

Free the resources occupied by undo::spaces and trx_sys_undo_spaces, called once during thread de-initialization.

◆ undo_spaces_init()

void undo_spaces_init ( )

Initialize undo::spaces and trx_sys_undo_spaces, called once during srv_start().

Variable Documentation

◆ files

pfs_os_file_t files[1000]
static

Files comprising the system tablespace.

◆ predefined_flags

uint32_t predefined_flags

fil_space_t::flags for hard-coded tablespaces

◆ SHUTDOWN_SLEEP_ROUNDS

constexpr uint32_t SHUTDOWN_SLEEP_ROUNDS
static
Initial value:
=
60 * 1000 * 1000 / SHUTDOWN_SLEEP_TIME_US
static constexpr uint32_t SHUTDOWN_SLEEP_TIME_US
Sleep time in loops which wait for pending tasks during shutdown.
Definition: srv0start.cc:226

Number of wait rounds during shutdown, after which error is produced, or other policy for timed out wait is applied.

◆ SHUTDOWN_SLEEP_TIME_US

constexpr uint32_t SHUTDOWN_SLEEP_TIME_US = 100
static

Sleep time in loops which wait for pending tasks during shutdown.

◆ srv_dict_metadata

MetadataRecover* srv_dict_metadata
static

Recovered persistent metadata.

◆ srv_is_being_shutdown

bool srv_is_being_shutdown = false

true if srv_pre_dd_shutdown() has been completed

◆ srv_is_being_started

bool srv_is_being_started = false

true if the server is being started

◆ srv_monitor_file_name

char* srv_monitor_file_name
static

Name of srv_monitor_file.

◆ srv_n_file_io_threads

ulint srv_n_file_io_threads = 0

Number of IO threads to use.

◆ srv_shutdown_state

std::atomic<enum srv_shutdown_t> srv_shutdown_state {SRV_SHUTDOWN_NONE}

At a shutdown this value climbs from SRV_SHUTDOWN_NONE to SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE, and so on.

◆ srv_stages

PSI_stage_info* srv_stages[]
static
Initial value:
= {
}
PSI_stage_info srv_stage_clone_file_copy
Performance schema stage event for monitoring clone file copy progress.
Definition: srv0srv.cc:797
PSI_stage_info srv_stage_alter_table_log_table
Performance schema stage event for monitoring ALTER TABLE progress row_log_table_apply().
Definition: srv0srv.cc:770
PSI_stage_info srv_stage_alter_table_log_index
Performance schema stage event for monitoring ALTER TABLE progress row_log_apply().
Definition: srv0srv.cc:764
PSI_stage_info srv_stage_clone_page_copy
Performance schema stage event for monitoring clone page copy progress.
Definition: srv0srv.cc:805
PSI_stage_info srv_stage_alter_table_insert
Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples().
Definition: srv0srv.cc:759
PSI_stage_info srv_stage_alter_table_flush
Performance schema stage event for monitoring ALTER TABLE progress log_make_latest_checkpoint().
Definition: srv0srv.cc:754
PSI_stage_info srv_stage_buffer_pool_load
Performance schema stage event for monitoring buffer pool load progress.
Definition: srv0srv.cc:792
PSI_stage_info srv_stage_alter_table_end
Performance schema stage event for monitoring ALTER TABLE progress everything after flush log_make_la...
Definition: srv0srv.cc:749
PSI_stage_info srv_stage_alter_table_merge_sort
Performance schema stage event for monitoring ALTER TABLE progress row_merge_sort().
Definition: srv0srv.cc:776
PSI_stage_info srv_stage_alter_tablespace_encryption
Performance schema stage event for monitoring ALTER TABLESPACE ENCRYPTION progress.
Definition: srv0srv.cc:787
PSI_stage_info srv_stage_alter_table_read_pk_internal_sort
Performance schema stage event for monitoring ALTER TABLE progress row_merge_read_clustered_index().
Definition: srv0srv.cc:781
PSI_stage_info srv_stage_clone_redo_copy
Performance schema stage event for monitoring clone redo copy progress.
Definition: srv0srv.cc:801

Array of all InnoDB stage events for monitoring activities via performance schema.

◆ srv_start_has_been_called

bool srv_start_has_been_called = false
static

true if srv_start() has been called

◆ srv_start_raw_disk_in_use

ibool srv_start_raw_disk_in_use = FALSE

TRUE if a raw partition is in use.

◆ srv_start_state

uint64_t srv_start_state = SRV_START_STATE_NONE
static

Track server thrd starting phases.

◆ srv_startup_is_before_trx_rollback_phase

bool srv_startup_is_before_trx_rollback_phase = false

true if the server is being started, before rolling back any incomplete transactions

◆ srv_sys_tablespaces_open

bool srv_sys_tablespaces_open = false

true if SYS_TABLESPACES is available for lookups