summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-04-25 09:26:01 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-04-26 23:03:28 +0300
commit206ecb79a5f208547ac30ddd3fa108d208198eb0 (patch)
tree7448bacfb4abc9d5ad2c0fcdcdc7f9d9b998ee7b /storage
parent23ea4360fd1e93fad3dc391dd94f2d1592eb7220 (diff)
downloadmariadb-git-206ecb79a5f208547ac30ddd3fa108d208198eb0.tar.gz
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.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc6
-rw-r--r--storage/innobase/include/srv0srv.h3
-rw-r--r--storage/innobase/include/srv0start.h2
-rw-r--r--storage/innobase/include/trx0rseg.h5
-rw-r--r--storage/innobase/include/trx0rseg.ic8
-rw-r--r--storage/innobase/include/trx0sys.h2
-rw-r--r--storage/innobase/srv/srv0start.cc20
-rw-r--r--storage/innobase/trx/trx0sys.cc2
8 files changed, 29 insertions, 19 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 12ea9af99d3..5a5af11ec92 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4487,7 +4487,7 @@ innobase_change_buffering_inited_ok:
os_thread_sleep(20);
}
- srv_was_started = TRUE;
+ srv_was_started = true;
/* Adjust the innodb_undo_logs config object */
innobase_undo_logs_init_default_max();
@@ -21477,11 +21477,11 @@ static MYSQL_SYSVAR_STR(undo_directory, srv_undo_dir,
static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Number of undo tablespaces to use. ",
+ "Number of undo tablespaces to use.",
NULL, NULL,
0L, /* Default seting */
0L, /* Minimum value */
- 95L, 0); /* Maximum value */
+ TRX_SYS_MAX_UNDO_SPACES, 0); /* Maximum value */
static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs,
PLUGIN_VAR_OPCMDARG,
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index c3c59cd93d4..8e3659a50e1 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -301,6 +301,9 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */
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. */
extern char* srv_undo_dir;
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index d7a5922c954..4f2f4a312ff 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -121,8 +121,6 @@ extern lsn_t srv_start_lsn;
extern bool srv_is_being_started;
/** TRUE if SYS_TABLESPACES is available for lookups */
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
incomplete transactions */
extern bool srv_startup_is_before_trx_rollback_phase;
diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h
index 95774cbf476..4c162526384 100644
--- a/storage/innobase/include/trx0rseg.h
+++ b/storage/innobase/include/trx0rseg.h
@@ -200,7 +200,10 @@ struct trx_rseg_t {
bool is_persistent() const
{
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);
}
};
diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic
index 0a33c747668..45ee3ef8d66 100644
--- a/storage/innobase/include/trx0rseg.ic
+++ b/storage/innobase/include/trx0rseg.ic
@@ -42,7 +42,9 @@ trx_rsegf_get(
buf_block_t* block;
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(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
@@ -69,7 +71,9 @@ trx_rsegf_get_new(
buf_block_t* block;
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(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index c361a9bac55..bf8cf2481eb 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -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
impose the 7 bit restriction. e.g., mach_write_to_3() */
#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. */
#define TRX_SYS_MYSQL_LOG_NAME_LEN 512
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 9e89dfda833..ef0d88b4316 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -121,22 +121,22 @@ lsn_t srv_start_lsn;
lsn_t srv_shutdown_lsn;
/** 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 */
-ulint srv_n_file_io_threads = 0;
+ulint srv_n_file_io_threads;
/** TRUE if the server is being started, before rolling back any
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 */
-bool srv_is_being_started = false;
+bool srv_is_being_started;
/** 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 */
-ibool srv_was_started = FALSE;
+bool srv_was_started;
/** 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
/** InnoDB system tablespace to set during recovery */
UNIV_INTERN uint srv_sys_space_size_debug;
@@ -1519,7 +1519,7 @@ innobase_start_or_create_for_mysql(void)
" once during the process lifetime.";
}
- srv_start_has_been_called = TRUE;
+ srv_start_has_been_called = true;
srv_is_being_started = true;
@@ -2889,8 +2889,8 @@ innodb_shutdown()
}
srv_start_state = SRV_START_STATE_NONE;
- srv_was_started = FALSE;
- srv_start_has_been_called = FALSE;
+ srv_was_started = false;
+ srv_start_has_been_called = false;
}
#if 0 // TODO: Enable this in WL#6608
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 80aab87edaf..1ce9f49ba30 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -879,7 +879,7 @@ trx_sys_create_rsegs()
srv_undo_logs determines how many of the
srv_available_undo_logs rollback segments may be used for
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);
if (srv_read_only_mode) {