diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-06-27 20:53:14 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-06-27 21:23:12 +0300 |
commit | 3e1d0ff5748db3881cca96f9d35bee179552c9f6 (patch) | |
tree | f5ff0f4594abf64573e559f5c4852aa6df2cdb69 | |
parent | 29624ea304b5893d3bc81670807285a89fce1a33 (diff) | |
download | mariadb-git-3e1d0ff5748db3881cca96f9d35bee179552c9f6.tar.gz |
Fix a merge error in commit 8f643e2063c9890a353149f39ef85b2cf3151fd0
A merge error caused InnoDB bootstrap to fail when
innodb_undo_tablespaces was set to more than 2.
This was because of a bug that was introduced to
srv_undo_tablespaces_init() by the merge.
Furthermore, some adjustments for Oracle Bug#25551311 aka
Bug#23517560 changes were forgotten. We must minimize direct
references to srv_undo_tablespaces_open and use predicates
instead.
srv_undo_tablespaces_init(): Increment srv_undo_tablespaces_open
once, not twice, per loop iteration.
is_system_or_undo_tablespace(): Remove (unused function).
is_predefined_tablespace(): Invoke srv_is_undo_tablespace().
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 8 | ||||
-rw-r--r-- | storage/innobase/include/fsp0sysspace.h | 15 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 16 | ||||
-rw-r--r-- | storage/innobase/include/srv0start.h | 16 | ||||
-rw-r--r-- | storage/innobase/mtr/mtr0mtr.cc | 2 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 2 |
6 files changed, 23 insertions, 36 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 8d6d95a020e..61006c8d89d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -5959,9 +5959,8 @@ database_corrupted: error injection */ DBUG_EXECUTE_IF( "buf_page_import_corrupt_failure", - if (bpage->id.space() - > srv_undo_tablespaces_open - && bpage->id.space() != SRV_TMP_SPACE_ID) { + if (!is_predefined_tablespace( + bpage->id.space())) { buf_mark_space_corrupt(bpage); ib::info() << "Simulated IMPORT " "corruption"; @@ -6027,8 +6026,7 @@ database_corrupted: if (uncompressed && !recv_no_ibuf_operations && (bpage->id.space() == 0 - || (bpage->id.space() > srv_undo_tablespaces_open - && bpage->id.space() != SRV_TMP_SPACE_ID)) + || !is_predefined_tablespace(bpage->id.space())) && !srv_is_tablespace_truncated(bpage->id.space()) && fil_page_get_type(frame) == FIL_PAGE_INDEX && page_is_leaf(frame)) { diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h index 4c88b268f34..b8890adad74 100644 --- a/storage/innobase/include/fsp0sysspace.h +++ b/storage/innobase/include/fsp0sysspace.h @@ -287,16 +287,6 @@ is_system_tablespace(ulint id) return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID); } -/** Check if shared-system or undo tablespace. -@return true if shared-system or undo tablespace */ -UNIV_INLINE -bool -is_system_or_undo_tablespace( - ulint id) -{ - return(id <= srv_undo_tablespaces_open); -} - /** Check if predefined shared tablespace. @return true if predefined shared tablespace */ UNIV_INLINE @@ -306,7 +296,8 @@ is_predefined_tablespace( { ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE); ut_ad(TRX_SYS_SPACE == 0); - return(id <= srv_undo_tablespaces_open - || id == SRV_TMP_SPACE_ID); + return(id == TRX_SYS_SPACE + || id == SRV_TMP_SPACE_ID + || srv_is_undo_tablespace(id)); } #endif /* fsp0sysspace_h */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 8f0df34af74..6afa1bf7e4e 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -317,6 +317,22 @@ segment). It is quite possible that some of the tablespaces doesn't host any of the rollback-segment based on configuration used. */ extern ulint srv_undo_tablespaces_active; +/** Undo tablespaces starts with space_id. */ +extern ulint srv_undo_space_id_start; + +/** Check whether given space id is undo tablespace id +@param[in] space_id space id to check +@return true if it is undo tablespace else false. */ +inline +bool +srv_is_undo_tablespace(ulint space_id) +{ + return srv_undo_space_id_start > 0 + && space_id >= srv_undo_space_id_start + && space_id < (srv_undo_space_id_start + + srv_undo_tablespaces_open); +} + /** The number of undo segments to use */ extern ulong srv_undo_logs; diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 47b42725541..93ea0be2662 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -105,22 +105,6 @@ extern bool srv_startup_is_before_trx_rollback_phase; /** TRUE if a raw partition is in use */ extern ibool srv_start_raw_disk_in_use; -/** Undo tablespaces starts with space_id. */ -extern ulint srv_undo_space_id_start; - -/** Check whether given space id is undo tablespace id -@param[in] space_id space id to check -@return true if it is undo tablespace else false. */ -inline -bool -srv_is_undo_tablespace(ulint space_id) -{ - return srv_undo_space_id_start > 0 - && space_id >= srv_undo_space_id_start - && space_id < (srv_undo_space_id_start - + srv_undo_tablespaces_open); -} - /** Shutdown state */ enum srv_shutdown_t { SRV_SHUTDOWN_NONE = 0, /*!< Database running normally */ diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d8c7d59fe27..54b9ff5d8d8 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -829,7 +829,7 @@ mtr_t::Command::prepare_write() fil_space_t* space = m_impl->m_user_space; - if (space != NULL && space->id <= srv_undo_tablespaces_open) { + if (space != NULL && is_predefined_tablespace(space->id)) { /* Omit MLOG_FILE_NAME for predefined tablespaces. */ space = NULL; } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 7fbf069257d..ee475d43e87 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -959,8 +959,6 @@ srv_undo_tablespaces_init(bool create_new_db) if (0 == srv_undo_tablespaces_open++) { srv_undo_space_id_start = undo_tablespace_ids[i]; } - - ++srv_undo_tablespaces_open; } /* Open any extra unused undo tablespaces. These must be contiguous. |