summaryrefslogtreecommitdiff
path: root/storage/innobase/fsp/fsp0sysspace.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/fsp/fsp0sysspace.cc')
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc53
1 files changed, 21 insertions, 32 deletions
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index 2e4b3678760..f8342157560 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -47,7 +47,7 @@ SysTablespace srv_tmp_space;
/** If the last data file is auto-extended, we add this many pages to it
at a time. We have to make this public because it is a config variable. */
-ulong sys_tablespace_auto_extend_increment;
+uint sys_tablespace_auto_extend_increment;
/** Convert a numeric string that optionally ends in G or M or K,
to a number containing megabytes.
@@ -275,7 +275,8 @@ SysTablespace::parse_params(
}
}
- m_files.push_back(Datafile(filepath, flags(), size, order));
+ m_files.push_back(Datafile(filepath, flags(), uint32_t(size),
+ order));
Datafile* datafile = &m_files.back();
datafile->make_filepath(path(), filepath, NO_EXT);
@@ -351,7 +352,7 @@ SysTablespace::check_size(
also the data file could contain an incomplete extent.
So we need to round the size downward to a megabyte.*/
- const ulint rounded_size_pages = static_cast<ulint>(
+ const uint32_t rounded_size_pages = static_cast<uint32_t>(
size >> srv_page_size_shift);
/* If last file */
@@ -904,7 +905,6 @@ SysTablespace::open_or_create(
if (it != begin) {
} else if (is_temp) {
- ut_ad(!fil_system.temp_space);
ut_ad(space_id() == SRV_TMP_SPACE_ID);
space = fil_space_create(
name(), SRV_TMP_SPACE_ID, flags(),
@@ -919,12 +919,10 @@ SysTablespace::open_or_create(
ut_ad(!space->is_compressed());
ut_ad(space->full_crc32());
} else {
- ut_ad(!fil_system.sys_space);
ut_ad(space_id() == TRX_SYS_SPACE);
space = fil_space_create(
name(), TRX_SYS_SPACE, it->flags(),
FIL_TYPE_TABLESPACE, NULL);
-
mutex_enter(&fil_system.mutex);
fil_system.sys_space = space;
mutex_exit(&fil_system.mutex);
@@ -935,10 +933,10 @@ SysTablespace::open_or_create(
ut_a(fil_validate());
- ulint max_size = (++node_counter == m_files.size()
+ uint32_t max_size = (++node_counter == m_files.size()
? (m_last_file_size_max == 0
- ? ULINT_MAX
- : m_last_file_size_max)
+ ? UINT32_MAX
+ : uint32_t(m_last_file_size_max))
: it->m_size);
space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size,
@@ -965,30 +963,21 @@ SysTablespace::normalize_size()
/**
@return next increment size */
-ulint
-SysTablespace::get_increment() const
+uint32_t SysTablespace::get_increment() const
{
- ulint increment;
-
- if (m_last_file_size_max == 0) {
- increment = get_autoextend_increment();
- } else {
-
- if (!is_valid_size()) {
- ib::error() << "The last data file in " << name()
- << " has a size of " << last_file_size()
- << " but the max size allowed is "
- << m_last_file_size_max;
- }
-
- increment = m_last_file_size_max - last_file_size();
- }
-
- if (increment > get_autoextend_increment()) {
- increment = get_autoextend_increment();
- }
-
- return(increment);
+ if (m_last_file_size_max == 0)
+ return get_autoextend_increment();
+
+ if (!is_valid_size())
+ {
+ ib::error() << "The last data file in " << name()
+ << " has a size of " << last_file_size()
+ << " but the max size allowed is "
+ << m_last_file_size_max;
+ }
+
+ return std::min(uint32_t(m_last_file_size_max) - last_file_size(),
+ get_autoextend_increment());
}