Commit 3e1d0ff5 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix a merge error in commit 8f643e20

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().
parent 29624ea3
...@@ -5959,9 +5959,8 @@ buf_page_io_complete(buf_page_t* bpage, bool evict) ...@@ -5959,9 +5959,8 @@ buf_page_io_complete(buf_page_t* bpage, bool evict)
error injection */ error injection */
DBUG_EXECUTE_IF( DBUG_EXECUTE_IF(
"buf_page_import_corrupt_failure", "buf_page_import_corrupt_failure",
if (bpage->id.space() if (!is_predefined_tablespace(
> srv_undo_tablespaces_open bpage->id.space())) {
&& bpage->id.space() != SRV_TMP_SPACE_ID) {
buf_mark_space_corrupt(bpage); buf_mark_space_corrupt(bpage);
ib::info() << "Simulated IMPORT " ib::info() << "Simulated IMPORT "
"corruption"; "corruption";
...@@ -6027,8 +6026,7 @@ buf_page_io_complete(buf_page_t* bpage, bool evict) ...@@ -6027,8 +6026,7 @@ buf_page_io_complete(buf_page_t* bpage, bool evict)
if (uncompressed if (uncompressed
&& !recv_no_ibuf_operations && !recv_no_ibuf_operations
&& (bpage->id.space() == 0 && (bpage->id.space() == 0
|| (bpage->id.space() > srv_undo_tablespaces_open || !is_predefined_tablespace(bpage->id.space()))
&& bpage->id.space() != SRV_TMP_SPACE_ID))
&& !srv_is_tablespace_truncated(bpage->id.space()) && !srv_is_tablespace_truncated(bpage->id.space())
&& fil_page_get_type(frame) == FIL_PAGE_INDEX && fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) { && page_is_leaf(frame)) {
......
...@@ -287,16 +287,6 @@ is_system_tablespace(ulint id) ...@@ -287,16 +287,6 @@ is_system_tablespace(ulint id)
return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_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. /** Check if predefined shared tablespace.
@return true if predefined shared tablespace */ @return true if predefined shared tablespace */
UNIV_INLINE UNIV_INLINE
...@@ -306,7 +296,8 @@ is_predefined_tablespace( ...@@ -306,7 +296,8 @@ is_predefined_tablespace(
{ {
ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE); ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE);
ut_ad(TRX_SYS_SPACE == 0); ut_ad(TRX_SYS_SPACE == 0);
return(id <= srv_undo_tablespaces_open return(id == TRX_SYS_SPACE
|| id == SRV_TMP_SPACE_ID); || id == SRV_TMP_SPACE_ID
|| srv_is_undo_tablespace(id));
} }
#endif /* fsp0sysspace_h */ #endif /* fsp0sysspace_h */
...@@ -317,6 +317,22 @@ segment). It is quite possible that some of the tablespaces doesn't host ...@@ -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. */ any of the rollback-segment based on configuration used. */
extern ulint srv_undo_tablespaces_active; 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 */ /** The number of undo segments to use */
extern ulong srv_undo_logs; extern ulong srv_undo_logs;
......
...@@ -105,22 +105,6 @@ extern bool srv_startup_is_before_trx_rollback_phase; ...@@ -105,22 +105,6 @@ extern bool srv_startup_is_before_trx_rollback_phase;
/** TRUE if a raw partition is in use */ /** TRUE if a raw partition is in use */
extern ibool srv_start_raw_disk_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 */ /** Shutdown state */
enum srv_shutdown_t { enum srv_shutdown_t {
SRV_SHUTDOWN_NONE = 0, /*!< Database running normally */ SRV_SHUTDOWN_NONE = 0, /*!< Database running normally */
......
...@@ -829,7 +829,7 @@ mtr_t::Command::prepare_write() ...@@ -829,7 +829,7 @@ mtr_t::Command::prepare_write()
fil_space_t* space = m_impl->m_user_space; 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. */ /* Omit MLOG_FILE_NAME for predefined tablespaces. */
space = NULL; space = NULL;
} }
......
...@@ -959,8 +959,6 @@ srv_undo_tablespaces_init(bool create_new_db) ...@@ -959,8 +959,6 @@ srv_undo_tablespaces_init(bool create_new_db)
if (0 == srv_undo_tablespaces_open++) { if (0 == srv_undo_tablespaces_open++) {
srv_undo_space_id_start = undo_tablespace_ids[i]; srv_undo_space_id_start = undo_tablespace_ids[i];
} }
++srv_undo_tablespaces_open;
} }
/* Open any extra unused undo tablespaces. These must be contiguous. /* Open any extra unused undo tablespaces. These must be contiguous.
......
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