mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-11585 Hard-code the shared InnoDB temporary tablespace ID at -1
MySQL 5.7 supports only one shared temporary tablespace. MariaDB 10.2 does not support any other shared InnoDB tablespaces than the two predefined tablespaces: the persistent InnoDB system tablespace (default file name ibdata1) and the temporary tablespace (default file name ibtmp1). InnoDB is unnecessarily allocating a tablespace ID for the predefined temporary tablespace on every startup, and it is in several places testing whether a tablespace ID matches this dynamically generated ID. We should use a compile-time constant to reduce code size and to avoid unnecessary updates to the DICT_HDR page at every startup. Using a hard-coded tablespace ID will should make it easier to remove the TEMPORARY flag from FSP_SPACE_FLAGS in MDEV-11202.
This commit is contained in:
@@ -9,13 +9,13 @@ innodb_encryption_threads 4
|
|||||||
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
||||||
space name current_key_version
|
space name current_key_version
|
||||||
0 NULL 1
|
0 NULL 1
|
||||||
2 mysql/innodb_table_stats 1
|
1 mysql/innodb_table_stats 1
|
||||||
3 mysql/innodb_index_stats 1
|
2 mysql/innodb_index_stats 1
|
||||||
set global debug_key_management_version=10;
|
set global debug_key_management_version=10;
|
||||||
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
select space,name,current_key_version from information_schema.innodb_tablespaces_encryption order by space;
|
||||||
space name current_key_version
|
space name current_key_version
|
||||||
0 NULL 10
|
0 NULL 10
|
||||||
2 mysql/innodb_table_stats 10
|
1 mysql/innodb_table_stats 10
|
||||||
3 mysql/innodb_index_stats 10
|
2 mysql/innodb_index_stats 10
|
||||||
set global innodb_encrypt_tables=OFF;
|
set global innodb_encrypt_tables=OFF;
|
||||||
set global debug_key_management_version=1;
|
set global debug_key_management_version=1;
|
||||||
|
@@ -16,7 +16,7 @@ Warning 131 Using innodb_file_format is deprecated and the parameter may be remo
|
|||||||
SET GLOBAL innodb_file_per_table = ON;
|
SET GLOBAL innodb_file_per_table = ON;
|
||||||
CHECK TABLE t1;
|
CHECK TABLE t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 check Warning Table test/t1 in tablespace 7 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
|
test.t1 check Warning Table test/t1 in tablespace # is encrypted but encryption service or used key_id is not available. Can't continue reading table.
|
||||||
test.t1 check Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
|
test.t1 check Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
|
||||||
test.t1 check error Corrupt
|
test.t1 check error Corrupt
|
||||||
SHOW WARNINGS;
|
SHOW WARNINGS;
|
||||||
|
@@ -59,6 +59,7 @@ EOF
|
|||||||
SET GLOBAL innodb_file_format = `Barracuda`;
|
SET GLOBAL innodb_file_format = `Barracuda`;
|
||||||
SET GLOBAL innodb_file_per_table = ON;
|
SET GLOBAL innodb_file_per_table = ON;
|
||||||
|
|
||||||
|
--replace_regex /tablespace [0-9]*/tablespace #/
|
||||||
CHECK TABLE t1;
|
CHECK TABLE t1;
|
||||||
SHOW WARNINGS;
|
SHOW WARNINGS;
|
||||||
|
|
||||||
|
@@ -1097,7 +1097,7 @@ btr_free_root_check(
|
|||||||
index_id_t index_id,
|
index_id_t index_id,
|
||||||
mtr_t* mtr)
|
mtr_t* mtr)
|
||||||
{
|
{
|
||||||
ut_ad(page_id.space() != srv_tmp_space.space_id());
|
ut_ad(page_id.space() != SRV_TMP_SPACE_ID);
|
||||||
ut_ad(index_id != BTR_FREED_INDEX_ID);
|
ut_ad(index_id != BTR_FREED_INDEX_ID);
|
||||||
|
|
||||||
buf_block_t* block = buf_page_get(
|
buf_block_t* block = buf_page_get(
|
||||||
|
@@ -6092,7 +6092,7 @@ corrupt:
|
|||||||
#endif /* MYSQL_COMPRESSION */
|
#endif /* MYSQL_COMPRESSION */
|
||||||
&& !recv_no_ibuf_operations
|
&& !recv_no_ibuf_operations
|
||||||
&& !Tablespace::is_undo_tablespace(bpage->id.space())
|
&& !Tablespace::is_undo_tablespace(bpage->id.space())
|
||||||
&& bpage->id.space() != srv_tmp_space.space_id()
|
&& 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)) {
|
||||||
|
@@ -571,8 +571,7 @@ dict_build_tablespace_for_table(
|
|||||||
supports Redundant and Compact */
|
supports Redundant and Compact */
|
||||||
ut_ad(dict_tf_get_rec_format(table->flags)
|
ut_ad(dict_tf_get_rec_format(table->flags)
|
||||||
!= REC_FORMAT_COMPRESSED);
|
!= REC_FORMAT_COMPRESSED);
|
||||||
table->space = static_cast<uint32_t>(
|
table->space = SRV_TMP_SPACE_ID;
|
||||||
srv_tmp_space.space_id());
|
|
||||||
} else {
|
} else {
|
||||||
/* Create in the system tablespace. */
|
/* Create in the system tablespace. */
|
||||||
ut_ad(table->space == srv_sys_space.space_id());
|
ut_ad(table->space == srv_sys_space.space_id());
|
||||||
|
@@ -185,7 +185,7 @@ fil_is_user_tablespace_id(
|
|||||||
ulint space_id)
|
ulint space_id)
|
||||||
{
|
{
|
||||||
return(space_id > srv_undo_tablespaces_open
|
return(space_id > srv_undo_tablespaces_open
|
||||||
&& space_id != srv_tmp_space.space_id());
|
&& space_id != SRV_TMP_SPACE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
@@ -1313,7 +1313,7 @@ fil_space_create(
|
|||||||
|
|
||||||
/* This warning is not applicable while MEB scanning the redo logs */
|
/* This warning is not applicable while MEB scanning the redo logs */
|
||||||
#ifndef UNIV_HOTBACKUP
|
#ifndef UNIV_HOTBACKUP
|
||||||
if (fil_type_is_data(purpose)
|
if ((purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_IMPORT)
|
||||||
&& !recv_recovery_on
|
&& !recv_recovery_on
|
||||||
&& id > fil_system->max_assigned_id) {
|
&& id > fil_system->max_assigned_id) {
|
||||||
|
|
||||||
@@ -5104,10 +5104,13 @@ retry:
|
|||||||
ulint pages_per_mb = (1024 * 1024) / page_size;
|
ulint pages_per_mb = (1024 * 1024) / page_size;
|
||||||
ulint size_in_pages = ((node->size / pages_per_mb) * pages_per_mb);
|
ulint size_in_pages = ((node->size / pages_per_mb) * pages_per_mb);
|
||||||
|
|
||||||
if (space->id == srv_sys_space.space_id()) {
|
switch (space->id) {
|
||||||
|
case TRX_SYS_SPACE:
|
||||||
srv_sys_space.set_last_file_size(size_in_pages);
|
srv_sys_space.set_last_file_size(size_in_pages);
|
||||||
} else if (space->id == srv_tmp_space.space_id()) {
|
break;
|
||||||
|
case SRV_TMP_SPACE_ID:
|
||||||
srv_tmp_space.set_last_file_size(size_in_pages);
|
srv_tmp_space.set_last_file_size(size_in_pages);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ib::trace() << "extended space : " << space->name << " from "
|
ib::trace() << "extended space : " << space->name << " from "
|
||||||
|
@@ -338,16 +338,6 @@ err_exit:
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if tablespace is system temporary.
|
|
||||||
@param[in] space_id tablespace ID
|
|
||||||
@return true if tablespace is system temporary. */
|
|
||||||
bool
|
|
||||||
fsp_is_system_temporary(
|
|
||||||
ulint space_id)
|
|
||||||
{
|
|
||||||
return(space_id == srv_tmp_space.space_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check if checksum is disabled for the given space.
|
/** Check if checksum is disabled for the given space.
|
||||||
@param[in] space_id tablespace ID
|
@param[in] space_id tablespace ID
|
||||||
@return true if checksum is disabled for given space. */
|
@return true if checksum is disabled for given space. */
|
||||||
@@ -803,8 +793,7 @@ fsp_space_modify_check(
|
|||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
{
|
{
|
||||||
const fil_type_t type = fil_space_get_type(id);
|
const fil_type_t type = fil_space_get_type(id);
|
||||||
ut_a(id == srv_tmp_space.space_id()
|
ut_a(srv_is_tablespace_truncated(id)
|
||||||
|| srv_is_tablespace_truncated(id)
|
|
||||||
|| fil_space_is_being_truncated(id)
|
|| fil_space_is_being_truncated(id)
|
||||||
|| fil_space_get_flags(id) == ULINT_UNDEFINED
|
|| fil_space_get_flags(id) == ULINT_UNDEFINED
|
||||||
|| type == FIL_TYPE_TEMPORARY
|
|| type == FIL_TYPE_TEMPORARY
|
||||||
@@ -814,10 +803,7 @@ fsp_space_modify_check(
|
|||||||
#endif /* UNIV_DEBUG */
|
#endif /* UNIV_DEBUG */
|
||||||
return;
|
return;
|
||||||
case MTR_LOG_ALL:
|
case MTR_LOG_ALL:
|
||||||
/* We must not write redo log for the shared temporary
|
/* We may only write redo log for a persistent tablespace. */
|
||||||
tablespace. */
|
|
||||||
ut_ad(id != srv_tmp_space.space_id());
|
|
||||||
/* If we write redo log, the tablespace must exist. */
|
|
||||||
ut_ad(fil_space_get_type(id) == FIL_TYPE_TABLESPACE);
|
ut_ad(fil_space_get_type(id) == FIL_TYPE_TABLESPACE);
|
||||||
ut_ad(mtr->is_named_space(id));
|
ut_ad(mtr->is_named_space(id));
|
||||||
return;
|
return;
|
||||||
@@ -1549,15 +1535,14 @@ fsp_try_extend_data_file(
|
|||||||
const page_size_t page_size(
|
const page_size_t page_size(
|
||||||
mach_read_from_4(header + FSP_SPACE_FLAGS));
|
mach_read_from_4(header + FSP_SPACE_FLAGS));
|
||||||
|
|
||||||
if (space->id == srv_sys_space.space_id()) {
|
switch (space->id) {
|
||||||
|
case TRX_SYS_SPACE:
|
||||||
size_increase = srv_sys_space.get_increment();
|
size_increase = srv_sys_space.get_increment();
|
||||||
|
break;
|
||||||
} else if (space->id == srv_tmp_space.space_id()) {
|
case SRV_TMP_SPACE_ID:
|
||||||
|
|
||||||
size_increase = srv_tmp_space.get_increment();
|
size_increase = srv_tmp_space.get_increment();
|
||||||
|
break;
|
||||||
} else {
|
default:
|
||||||
ulint extent_pages
|
ulint extent_pages
|
||||||
= fsp_get_extent_size_in_pages(page_size);
|
= fsp_get_extent_size_in_pages(page_size);
|
||||||
if (size < extent_pages) {
|
if (size < extent_pages) {
|
||||||
@@ -1679,11 +1664,17 @@ fsp_fill_free_list(
|
|||||||
const page_size_t page_size(flags);
|
const page_size_t page_size(flags);
|
||||||
|
|
||||||
if (size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
|
if (size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
|
||||||
if ((!init_space && !is_system_tablespace(space->id))
|
bool skip_resize = init_space;
|
||||||
|| (space->id == srv_sys_space.space_id()
|
switch (space->id) {
|
||||||
&& srv_sys_space.can_auto_extend_last_file())
|
case TRX_SYS_SPACE:
|
||||||
|| (space->id == srv_tmp_space.space_id()
|
skip_resize = !srv_sys_space.can_auto_extend_last_file();
|
||||||
&& srv_tmp_space.can_auto_extend_last_file())) {
|
break;
|
||||||
|
case SRV_TMP_SPACE_ID:
|
||||||
|
skip_resize = srv_tmp_space.can_auto_extend_last_file();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skip_resize) {
|
||||||
ulint n_pages = 0;
|
ulint n_pages = 0;
|
||||||
fsp_try_extend_data_file(space, header, mtr, &n_pages);
|
fsp_try_extend_data_file(space, header, mtr, &n_pages);
|
||||||
size = space->size_in_header;
|
size = space->size_in_header;
|
||||||
@@ -1733,7 +1724,7 @@ fsp_fill_free_list(
|
|||||||
order, and we must be able to release its latch.
|
order, and we must be able to release its latch.
|
||||||
Note: Insert-Buffering is disabled for tables that
|
Note: Insert-Buffering is disabled for tables that
|
||||||
reside in the temp-tablespace. */
|
reside in the temp-tablespace. */
|
||||||
if (space->id != srv_tmp_space.space_id()) {
|
if (space->purpose != FIL_TYPE_TEMPORARY) {
|
||||||
mtr_t ibuf_mtr;
|
mtr_t ibuf_mtr;
|
||||||
|
|
||||||
mtr_start(&ibuf_mtr);
|
mtr_start(&ibuf_mtr);
|
||||||
@@ -1741,9 +1732,7 @@ fsp_fill_free_list(
|
|||||||
|
|
||||||
/* Avoid logging while truncate table
|
/* Avoid logging while truncate table
|
||||||
fix-up is active. */
|
fix-up is active. */
|
||||||
if (space->purpose == FIL_TYPE_TEMPORARY
|
if (srv_is_tablespace_truncated(space->id)) {
|
||||||
|| srv_is_tablespace_truncated(
|
|
||||||
space->id)) {
|
|
||||||
mtr_set_log_mode(
|
mtr_set_log_mode(
|
||||||
&ibuf_mtr, MTR_LOG_NO_REDO);
|
&ibuf_mtr, MTR_LOG_NO_REDO);
|
||||||
}
|
}
|
||||||
|
@@ -207,17 +207,6 @@ Tablespace::delete_files()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if undo tablespace.
|
|
||||||
@return true if undo tablespace */
|
|
||||||
bool
|
|
||||||
Tablespace::is_undo_tablespace(
|
|
||||||
ulint id)
|
|
||||||
{
|
|
||||||
return(id <= srv_undo_tablespaces_open
|
|
||||||
&& id != srv_sys_space.space_id()
|
|
||||||
&& id != srv_tmp_space.space_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Use the ADD DATAFILE path to create a Datafile object and add it to the
|
/** Use the ADD DATAFILE path to create a Datafile object and add it to the
|
||||||
front of m_files.
|
front of m_files.
|
||||||
Parse the datafile path into a path and a filename with extension 'ibd'.
|
Parse the datafile path into a path and a filename with extension 'ibd'.
|
||||||
|
@@ -3727,9 +3727,10 @@ ibuf_insert(
|
|||||||
op, page_id.space(), page_id.page_no()));
|
op, page_id.space(), page_id.page_no()));
|
||||||
|
|
||||||
ut_ad(dtuple_check_typed(entry));
|
ut_ad(dtuple_check_typed(entry));
|
||||||
ut_ad(page_id.space() != srv_tmp_space.space_id());
|
ut_ad(page_id.space() != SRV_TMP_SPACE_ID);
|
||||||
|
|
||||||
ut_a(!dict_index_is_clust(index));
|
ut_a(!dict_index_is_clust(index));
|
||||||
|
ut_ad(!dict_table_is_temporary(index->table));
|
||||||
|
|
||||||
no_counter = use <= IBUF_USE_INSERT;
|
no_counter = use <= IBUF_USE_INSERT;
|
||||||
|
|
||||||
|
@@ -219,7 +219,10 @@ public:
|
|||||||
|
|
||||||
/** Check if undo tablespace.
|
/** Check if undo tablespace.
|
||||||
@return true if undo tablespace */
|
@return true if undo tablespace */
|
||||||
static bool is_undo_tablespace(ulint id);
|
static bool is_undo_tablespace(ulint id)
|
||||||
|
{
|
||||||
|
return(id <= srv_undo_tablespaces_open);
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@param[in] filename Name to lookup in the data files.
|
@param[in] filename Name to lookup in the data files.
|
||||||
|
@@ -291,11 +291,9 @@ extern SysTablespace srv_tmp_space;
|
|||||||
@return true if id is a system tablespace, false if not. */
|
@return true if id is a system tablespace, false if not. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
bool
|
bool
|
||||||
is_system_tablespace(
|
is_system_tablespace(ulint id)
|
||||||
ulint id)
|
|
||||||
{
|
{
|
||||||
return(id == srv_sys_space.space_id()
|
return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID);
|
||||||
|| id == srv_tmp_space.space_id());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if shared-system or undo tablespace.
|
/** Check if shared-system or undo tablespace.
|
||||||
@@ -305,8 +303,7 @@ bool
|
|||||||
is_system_or_undo_tablespace(
|
is_system_or_undo_tablespace(
|
||||||
ulint id)
|
ulint id)
|
||||||
{
|
{
|
||||||
return(id == srv_sys_space.space_id()
|
return(id <= srv_undo_tablespaces_open);
|
||||||
|| id <= srv_undo_tablespaces_open);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if predefined shared tablespace.
|
/** Check if predefined shared tablespace.
|
||||||
@@ -319,6 +316,6 @@ 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 <= srv_undo_tablespaces_open
|
||||||
|| id == srv_tmp_space.space_id());
|
|| id == SRV_TMP_SPACE_ID);
|
||||||
}
|
}
|
||||||
#endif /* fsp0sysspace_h */
|
#endif /* fsp0sysspace_h */
|
||||||
|
@@ -29,6 +29,12 @@ Created May 26, 2009 Vasil Dimov
|
|||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
#ifndef UNIV_INNOCHECKSUM
|
||||||
|
|
||||||
|
/** The fil_space_t::id of the redo log. All persistent tablespaces
|
||||||
|
have a smaller fil_space_t::id. */
|
||||||
|
#define SRV_LOG_SPACE_FIRST_ID 0xFFFFFFF0U
|
||||||
|
/** The fil_space_t::id of the innodb_temporary tablespace. */
|
||||||
|
#define SRV_TMP_SPACE_ID 0xFFFFFFFFU
|
||||||
|
|
||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include "ut0byte.h"
|
#include "ut0byte.h"
|
||||||
|
|
||||||
@@ -196,9 +202,12 @@ fsp_flags_is_valid(
|
|||||||
/** Check if tablespace is system temporary.
|
/** Check if tablespace is system temporary.
|
||||||
@param[in] space_id verify is checksum is enabled for given space.
|
@param[in] space_id verify is checksum is enabled for given space.
|
||||||
@return true if tablespace is system temporary. */
|
@return true if tablespace is system temporary. */
|
||||||
|
inline
|
||||||
bool
|
bool
|
||||||
fsp_is_system_temporary(
|
fsp_is_system_temporary(ulint space_id)
|
||||||
ulint space_id);
|
{
|
||||||
|
return(space_id == SRV_TMP_SPACE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
/** Check if checksum is disabled for the given space.
|
/** Check if checksum is disabled for the given space.
|
||||||
@param[in] space_id verify is checksum is enabled for given space.
|
@param[in] space_id verify is checksum is enabled for given space.
|
||||||
|
@@ -46,9 +46,6 @@ struct dict_table_t;
|
|||||||
} while (0)
|
} while (0)
|
||||||
#endif /* DBUG_OFF */
|
#endif /* DBUG_OFF */
|
||||||
|
|
||||||
/** Log 'spaces' have id's >= this */
|
|
||||||
#define SRV_LOG_SPACE_FIRST_ID 0xFFFFFFF0UL
|
|
||||||
|
|
||||||
/** If buffer pool is less than the size,
|
/** If buffer pool is less than the size,
|
||||||
only one buffer pool instance is used. */
|
only one buffer pool instance is used. */
|
||||||
#define BUF_POOL_SIZE_THRESHOLD (1024 * 1024 * 1024)
|
#define BUF_POOL_SIZE_THRESHOLD (1024 * 1024 * 1024)
|
||||||
|
@@ -2278,7 +2278,7 @@ truncate_t::fixup_tables_in_non_system_tablespace()
|
|||||||
"id (" << (*it)->m_space_id << ")";
|
"id (" << (*it)->m_space_id << ")";
|
||||||
|
|
||||||
/* Temp-tables in temp-tablespace are never restored.*/
|
/* Temp-tables in temp-tablespace are never restored.*/
|
||||||
ut_ad((*it)->m_space_id != srv_tmp_space.space_id());
|
ut_ad((*it)->m_space_id != SRV_TMP_SPACE_ID);
|
||||||
|
|
||||||
err = fil_recreate_table(
|
err = fil_recreate_table(
|
||||||
(*it)->m_space_id,
|
(*it)->m_space_id,
|
||||||
|
@@ -1123,76 +1123,67 @@ srv_start_wait_for_purge_to_start()
|
|||||||
|
|
||||||
/** Create the temporary file tablespace.
|
/** Create the temporary file tablespace.
|
||||||
@param[in] create_new_db whether we are creating a new database
|
@param[in] create_new_db whether we are creating a new database
|
||||||
@param[in,out] tmp_space Shared Temporary SysTablespace
|
|
||||||
@return DB_SUCCESS or error code. */
|
@return DB_SUCCESS or error code. */
|
||||||
static
|
static
|
||||||
dberr_t
|
dberr_t
|
||||||
srv_open_tmp_tablespace(
|
srv_open_tmp_tablespace(bool create_new_db)
|
||||||
bool create_new_db,
|
|
||||||
SysTablespace* tmp_space)
|
|
||||||
{
|
{
|
||||||
ulint sum_of_new_sizes;
|
ulint sum_of_new_sizes;
|
||||||
|
|
||||||
/* Will try to remove if there is existing file left-over by last
|
/* Will try to remove if there is existing file left-over by last
|
||||||
unclean shutdown */
|
unclean shutdown */
|
||||||
tmp_space->set_sanity_check_status(true);
|
srv_tmp_space.set_sanity_check_status(true);
|
||||||
tmp_space->delete_files();
|
srv_tmp_space.delete_files();
|
||||||
tmp_space->set_ignore_read_only(true);
|
srv_tmp_space.set_ignore_read_only(true);
|
||||||
|
|
||||||
ib::info() << "Creating shared tablespace for temporary tables";
|
ib::info() << "Creating shared tablespace for temporary tables";
|
||||||
|
|
||||||
bool create_new_temp_space;
|
bool create_new_temp_space;
|
||||||
ulint temp_space_id = ULINT_UNDEFINED;
|
|
||||||
|
|
||||||
dict_hdr_get_new_id(NULL, NULL, &temp_space_id, NULL, true);
|
srv_tmp_space.set_space_id(SRV_TMP_SPACE_ID);
|
||||||
|
|
||||||
tmp_space->set_space_id(temp_space_id);
|
|
||||||
|
|
||||||
RECOVERY_CRASH(100);
|
RECOVERY_CRASH(100);
|
||||||
|
|
||||||
dberr_t err = tmp_space->check_file_spec(
|
dberr_t err = srv_tmp_space.check_file_spec(
|
||||||
&create_new_temp_space, 12 * 1024 * 1024);
|
&create_new_temp_space, 12 * 1024 * 1024);
|
||||||
|
|
||||||
if (err == DB_FAIL) {
|
if (err == DB_FAIL) {
|
||||||
|
|
||||||
ib::error() << "The " << tmp_space->name()
|
ib::error() << "The " << srv_tmp_space.name()
|
||||||
<< " data file must be writable!";
|
<< " data file must be writable!";
|
||||||
|
|
||||||
err = DB_ERROR;
|
err = DB_ERROR;
|
||||||
|
|
||||||
} else if (err != DB_SUCCESS) {
|
} else if (err != DB_SUCCESS) {
|
||||||
ib::error() << "Could not create the shared "
|
ib::error() << "Could not create the shared "
|
||||||
<< tmp_space->name() << ".";
|
<< srv_tmp_space.name() << ".";
|
||||||
|
|
||||||
} else if ((err = tmp_space->open_or_create(
|
} else if ((err = srv_tmp_space.open_or_create(
|
||||||
true, create_new_db, &sum_of_new_sizes, NULL))
|
true, create_new_db, &sum_of_new_sizes, NULL))
|
||||||
!= DB_SUCCESS) {
|
!= DB_SUCCESS) {
|
||||||
|
|
||||||
ib::error() << "Unable to create the shared "
|
ib::error() << "Unable to create the shared "
|
||||||
<< tmp_space->name();
|
<< srv_tmp_space.name();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
ulint size = tmp_space->get_sum_of_sizes();
|
ulint size = srv_tmp_space.get_sum_of_sizes();
|
||||||
|
|
||||||
ut_a(temp_space_id != ULINT_UNDEFINED);
|
|
||||||
ut_a(tmp_space->space_id() == temp_space_id);
|
|
||||||
|
|
||||||
/* Open this shared temp tablespace in the fil_system so that
|
/* Open this shared temp tablespace in the fil_system so that
|
||||||
it stays open until shutdown. */
|
it stays open until shutdown. */
|
||||||
if (fil_space_open(tmp_space->name())) {
|
if (fil_space_open(srv_tmp_space.name())) {
|
||||||
|
|
||||||
/* Initialize the header page */
|
/* Initialize the header page */
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
|
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
|
||||||
|
|
||||||
fsp_header_init(tmp_space->space_id(), size, &mtr);
|
fsp_header_init(SRV_TMP_SPACE_ID, size, &mtr);
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
} else {
|
} else {
|
||||||
/* This file was just opened in the code above! */
|
/* This file was just opened in the code above! */
|
||||||
ib::error() << "The " << tmp_space->name()
|
ib::error() << "The " << srv_tmp_space.name()
|
||||||
<< " data file cannot be re-opened"
|
<< " data file cannot be re-opened"
|
||||||
" after check_file_spec() succeeded!";
|
" after check_file_spec() succeeded!";
|
||||||
|
|
||||||
@@ -2439,7 +2430,7 @@ files_checked:
|
|||||||
|
|
||||||
/* Open temp-tablespace and keep it open until shutdown. */
|
/* Open temp-tablespace and keep it open until shutdown. */
|
||||||
|
|
||||||
err = srv_open_tmp_tablespace(create_new_db, &srv_tmp_space);
|
err = srv_open_tmp_tablespace(create_new_db);
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
return(srv_init_abort(err));
|
return(srv_init_abort(err));
|
||||||
|
@@ -983,8 +983,7 @@ trx_sys_create_noredo_rsegs(
|
|||||||
Slot-1....Slot-N: reserved for temp-tablespace.
|
Slot-1....Slot-N: reserved for temp-tablespace.
|
||||||
Slot-N+1....Slot-127: reserved for system/undo-tablespace. */
|
Slot-N+1....Slot-127: reserved for system/undo-tablespace. */
|
||||||
for (ulint i = 0; i < n_nonredo_rseg; i++) {
|
for (ulint i = 0; i < n_nonredo_rseg; i++) {
|
||||||
ulint space = srv_tmp_space.space_id();
|
if (trx_rseg_create(SRV_TMP_SPACE_ID, i) == NULL) {
|
||||||
if (trx_rseg_create(space, i) == NULL) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++n_created;
|
++n_created;
|
||||||
|
Reference in New Issue
Block a user