Commit 206ecb79 authored by Marko Mäkelä's avatar Marko Mäkelä

Follow-up to MDEV-12289: Support innodb_undo_tablespaces=127

MySQL 5.7 reduced the maximum number of innodb_undo_tablespaces
from 126 to 95 when it reserved 32 persistent rollback segments
for the temporary undo logs. Since MDEV-12289 restored all 128
persistent rollback segments for persistent undo logs, the
reasonable maximum value of innodb_undo_tablespaces is 127
(not 126 or 95). This is because out of the 128 rollback segments,
the first one will always be created in the system tablespace
and the remaining ones can be created in dedicated undo tablespaces.
parent 23ea4360
...@@ -571,9 +571,9 @@ ...@@ -571,9 +571,9 @@
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED +VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of undo tablespaces to use. VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 95 NUMERIC_MAX_VALUE 127
@@ -2630,7 +2630,7 @@ @@ -2630,7 +2630,7 @@
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4 DEFAULT_VALUE 4
......
...@@ -2505,9 +2505,9 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME ...@@ -2505,9 +2505,9 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of undo tablespaces to use. VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 95 NUMERIC_MAX_VALUE 127
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY YES READ_ONLY YES
......
...@@ -4487,7 +4487,7 @@ innobase_init( ...@@ -4487,7 +4487,7 @@ innobase_init(
os_thread_sleep(20); os_thread_sleep(20);
} }
srv_was_started = TRUE; srv_was_started = true;
/* Adjust the innodb_undo_logs config object */ /* Adjust the innodb_undo_logs config object */
innobase_undo_logs_init_default_max(); innobase_undo_logs_init_default_max();
...@@ -21477,11 +21477,11 @@ static MYSQL_SYSVAR_STR(undo_directory, srv_undo_dir, ...@@ -21477,11 +21477,11 @@ static MYSQL_SYSVAR_STR(undo_directory, srv_undo_dir,
static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces, static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of undo tablespaces to use. ", "Number of undo tablespaces to use.",
NULL, NULL, NULL, NULL,
0L, /* Default seting */ 0L, /* Default seting */
0L, /* Minimum value */ 0L, /* Minimum value */
95L, 0); /* Maximum value */ TRX_SYS_MAX_UNDO_SPACES, 0); /* Maximum value */
static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs, static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
......
...@@ -301,6 +301,9 @@ extern long srv_mtflush_threads; ...@@ -301,6 +301,9 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */ /* If this flag is TRUE, then we will use multi threaded flush. */
extern my_bool srv_use_mtflush; extern my_bool srv_use_mtflush;
/** TRUE if the server was successfully started */
extern bool srv_was_started;
/** Server undo tablespaces directory, can be absolute path. */ /** Server undo tablespaces directory, can be absolute path. */
extern char* srv_undo_dir; extern char* srv_undo_dir;
......
...@@ -121,8 +121,6 @@ extern lsn_t srv_start_lsn; ...@@ -121,8 +121,6 @@ extern lsn_t srv_start_lsn;
extern bool srv_is_being_started; extern bool srv_is_being_started;
/** TRUE if SYS_TABLESPACES is available for lookups */ /** TRUE if SYS_TABLESPACES is available for lookups */
extern bool srv_sys_tablespaces_open; extern bool srv_sys_tablespaces_open;
/** TRUE if the server was successfully started */
extern ibool srv_was_started;
/** TRUE if the server is being started, before rolling back any /** TRUE if the server is being started, before rolling back any
incomplete transactions */ incomplete transactions */
extern bool srv_startup_is_before_trx_rollback_phase; extern bool srv_startup_is_before_trx_rollback_phase;
......
...@@ -200,7 +200,10 @@ struct trx_rseg_t { ...@@ -200,7 +200,10 @@ struct trx_rseg_t {
bool is_persistent() const bool is_persistent() const
{ {
ut_ad(space == SRV_TMP_SPACE_ID ut_ad(space == SRV_TMP_SPACE_ID
|| space <= srv_undo_tablespaces); || space <= TRX_SYS_MAX_UNDO_SPACES);
ut_ad(space == SRV_TMP_SPACE_ID
|| space <= srv_undo_tablespaces_active
|| !srv_was_started);
return(space != SRV_TMP_SPACE_ID); return(space != SRV_TMP_SPACE_ID);
} }
}; };
......
...@@ -42,7 +42,9 @@ trx_rsegf_get( ...@@ -42,7 +42,9 @@ trx_rsegf_get(
buf_block_t* block; buf_block_t* block;
trx_rsegf_t* header; trx_rsegf_t* header;
ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID); ut_ad(space <= srv_undo_tablespaces_active || space == SRV_TMP_SPACE_ID
|| !srv_was_started);
ut_ad(space <= TRX_SYS_MAX_UNDO_SPACES || space == SRV_TMP_SPACE_ID);
block = buf_page_get( block = buf_page_get(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr); page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
...@@ -69,7 +71,9 @@ trx_rsegf_get_new( ...@@ -69,7 +71,9 @@ trx_rsegf_get_new(
buf_block_t* block; buf_block_t* block;
trx_rsegf_t* header; trx_rsegf_t* header;
ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID); ut_ad(space <= srv_undo_tablespaces_active || space == SRV_TMP_SPACE_ID
|| !srv_was_started);
ut_ad(space <= TRX_SYS_MAX_UNDO_SPACES || space == SRV_TMP_SPACE_ID);
block = buf_page_get( block = buf_page_get(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr); page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
......
...@@ -403,6 +403,8 @@ byte, therefore 128; each slot is currently 8 bytes in size. If you want ...@@ -403,6 +403,8 @@ byte, therefore 128; each slot is currently 8 bytes in size. If you want
to raise the level to 256 then you will need to fix some assertions that to raise the level to 256 then you will need to fix some assertions that
impose the 7 bit restriction. e.g., mach_write_to_3() */ impose the 7 bit restriction. e.g., mach_write_to_3() */
#define TRX_SYS_N_RSEGS 128 #define TRX_SYS_N_RSEGS 128
/** Maximum number of undo tablespaces (not counting the system tablespace) */
#define TRX_SYS_MAX_UNDO_SPACES (TRX_SYS_N_RSEGS - 1)
/** Maximum length of MySQL binlog file name, in bytes. */ /** Maximum length of MySQL binlog file name, in bytes. */
#define TRX_SYS_MYSQL_LOG_NAME_LEN 512 #define TRX_SYS_MYSQL_LOG_NAME_LEN 512
......
...@@ -121,22 +121,22 @@ lsn_t srv_start_lsn; ...@@ -121,22 +121,22 @@ lsn_t srv_start_lsn;
lsn_t srv_shutdown_lsn; lsn_t srv_shutdown_lsn;
/** TRUE if a raw partition is in use */ /** TRUE if a raw partition is in use */
ibool srv_start_raw_disk_in_use = FALSE; ibool srv_start_raw_disk_in_use;
/** Number of IO threads to use */ /** Number of IO threads to use */
ulint srv_n_file_io_threads = 0; ulint srv_n_file_io_threads;
/** TRUE if the server is being started, before rolling back any /** TRUE if the server is being started, before rolling back any
incomplete transactions */ incomplete transactions */
bool srv_startup_is_before_trx_rollback_phase = false; bool srv_startup_is_before_trx_rollback_phase;
/** TRUE if the server is being started */ /** TRUE if the server is being started */
bool srv_is_being_started = false; bool srv_is_being_started;
/** TRUE if SYS_TABLESPACES is available for lookups */ /** TRUE if SYS_TABLESPACES is available for lookups */
bool srv_sys_tablespaces_open = false; bool srv_sys_tablespaces_open;
/** TRUE if the server was successfully started */ /** TRUE if the server was successfully started */
ibool srv_was_started = FALSE; bool srv_was_started;
/** TRUE if innobase_start_or_create_for_mysql() has been called */ /** TRUE if innobase_start_or_create_for_mysql() has been called */
static ibool srv_start_has_been_called = FALSE; static bool srv_start_has_been_called;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** InnoDB system tablespace to set during recovery */ /** InnoDB system tablespace to set during recovery */
UNIV_INTERN uint srv_sys_space_size_debug; UNIV_INTERN uint srv_sys_space_size_debug;
...@@ -1519,7 +1519,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1519,7 +1519,7 @@ innobase_start_or_create_for_mysql(void)
" once during the process lifetime."; " once during the process lifetime.";
} }
srv_start_has_been_called = TRUE; srv_start_has_been_called = true;
srv_is_being_started = true; srv_is_being_started = true;
...@@ -2889,8 +2889,8 @@ innodb_shutdown() ...@@ -2889,8 +2889,8 @@ innodb_shutdown()
} }
srv_start_state = SRV_START_STATE_NONE; srv_start_state = SRV_START_STATE_NONE;
srv_was_started = FALSE; srv_was_started = false;
srv_start_has_been_called = FALSE; srv_start_has_been_called = false;
} }
#if 0 // TODO: Enable this in WL#6608 #if 0 // TODO: Enable this in WL#6608
......
...@@ -879,7 +879,7 @@ trx_sys_create_rsegs() ...@@ -879,7 +879,7 @@ trx_sys_create_rsegs()
srv_undo_logs determines how many of the srv_undo_logs determines how many of the
srv_available_undo_logs rollback segments may be used for srv_available_undo_logs rollback segments may be used for
logging new transactions. */ logging new transactions. */
ut_ad(srv_undo_tablespaces < TRX_SYS_N_RSEGS); ut_ad(srv_undo_tablespaces <= TRX_SYS_MAX_UNDO_SPACES);
ut_ad(srv_undo_logs <= TRX_SYS_N_RSEGS); ut_ad(srv_undo_logs <= TRX_SYS_N_RSEGS);
if (srv_read_only_mode) { if (srv_read_only_mode) {
......
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