Commit 600c85e8 authored by Marko Mäkelä's avatar Marko Mäkelä

Allocate the singleton fil_system statically

fil_system_t::create(): Replaces fil_init(), fsp_init().

fil_system_t::close(): Replaces fil_close().

fil_system_t::max_n_open: Remove. Use srv_max_n_open_files directly.
parent 1f0f7d59
...@@ -89,7 +89,7 @@ xb_fil_node_close_file( ...@@ -89,7 +89,7 @@ xb_fil_node_close_file(
{ {
ibool ret; ibool ret;
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
ut_ad(node); ut_ad(node);
ut_a(node->n_pending == 0); ut_a(node->n_pending == 0);
...@@ -98,7 +98,7 @@ xb_fil_node_close_file( ...@@ -98,7 +98,7 @@ xb_fil_node_close_file(
if (!node->is_open()) { if (!node->is_open()) {
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
return; return;
} }
...@@ -108,20 +108,20 @@ xb_fil_node_close_file( ...@@ -108,20 +108,20 @@ xb_fil_node_close_file(
node->handle = OS_FILE_CLOSED; node->handle = OS_FILE_CLOSED;
ut_a(fil_system->n_open > 0); ut_a(fil_system.n_open > 0);
fil_system->n_open--; fil_system.n_open--;
fil_n_file_opened--; fil_n_file_opened--;
if (node->space->purpose == FIL_TYPE_TABLESPACE && if (node->space->purpose == FIL_TYPE_TABLESPACE &&
fil_is_user_tablespace_id(node->space->id)) { fil_is_user_tablespace_id(node->space->id)) {
ut_a(UT_LIST_GET_LEN(fil_system->LRU) > 0); ut_a(UT_LIST_GET_LEN(fil_system.LRU) > 0);
/* The node is in the LRU list, remove it */ /* The node is in the LRU list, remove it */
UT_LIST_REMOVE(fil_system->LRU, node); UT_LIST_REMOVE(fil_system.LRU, node);
} }
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
} }
/************************************************************************ /************************************************************************
...@@ -175,19 +175,19 @@ xb_fil_cur_open( ...@@ -175,19 +175,19 @@ xb_fil_cur_open(
return(XB_FIL_CUR_ERROR); return(XB_FIL_CUR_ERROR);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
fil_system->n_open++; fil_system.n_open++;
fil_n_file_opened++; fil_n_file_opened++;
if (node->space->purpose == FIL_TYPE_TABLESPACE && if (node->space->purpose == FIL_TYPE_TABLESPACE &&
fil_is_user_tablespace_id(node->space->id)) { fil_is_user_tablespace_id(node->space->id)) {
/* Put the node to the LRU list */ /* Put the node to the LRU list */
UT_LIST_ADD_FIRST(fil_system->LRU, node); UT_LIST_ADD_FIRST(fil_system.LRU, node);
} }
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
} }
ut_ad(node->is_open()); ut_ad(node->is_open());
......
...@@ -224,7 +224,6 @@ long innobase_file_io_threads = 4; ...@@ -224,7 +224,6 @@ long innobase_file_io_threads = 4;
long innobase_read_io_threads = 4; long innobase_read_io_threads = 4;
long innobase_write_io_threads = 4; long innobase_write_io_threads = 4;
long innobase_log_buffer_size = 1024*1024L; long innobase_log_buffer_size = 1024*1024L;
long innobase_open_files = 300L;
longlong innobase_page_size = (1LL << 14); /* 16KB */ longlong innobase_page_size = (1LL << 14); /* 16KB */
char* innobase_buffer_pool_filename = NULL; char* innobase_buffer_pool_filename = NULL;
...@@ -365,7 +364,6 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback); ...@@ -365,7 +364,6 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback);
/* ======== Datafiles iterator ======== */ /* ======== Datafiles iterator ======== */
struct datafiles_iter_t { struct datafiles_iter_t {
fil_system_t *system;
fil_space_t *space; fil_space_t *space;
fil_node_t *node; fil_node_t *node;
ibool started; ibool started;
...@@ -375,14 +373,13 @@ struct datafiles_iter_t { ...@@ -375,14 +373,13 @@ struct datafiles_iter_t {
/* ======== Datafiles iterator ======== */ /* ======== Datafiles iterator ======== */
static static
datafiles_iter_t * datafiles_iter_t *
datafiles_iter_new(fil_system_t *f_system) datafiles_iter_new()
{ {
datafiles_iter_t *it; datafiles_iter_t *it;
it = static_cast<datafiles_iter_t *>(malloc(sizeof(datafiles_iter_t))); it = static_cast<datafiles_iter_t *>(malloc(sizeof(datafiles_iter_t)));
pthread_mutex_init(&it->mutex, NULL); pthread_mutex_init(&it->mutex, NULL);
it->system = f_system;
it->space = NULL; it->space = NULL;
it->node = NULL; it->node = NULL;
it->started = FALSE; it->started = FALSE;
...@@ -409,7 +406,7 @@ datafiles_iter_next(datafiles_iter_t *it) ...@@ -409,7 +406,7 @@ datafiles_iter_next(datafiles_iter_t *it)
} }
it->space = (it->space == NULL) ? it->space = (it->space == NULL) ?
UT_LIST_GET_FIRST(it->system->space_list) : UT_LIST_GET_FIRST(fil_system.space_list) :
UT_LIST_GET_NEXT(space_list, it->space); UT_LIST_GET_NEXT(space_list, it->space);
while (it->space != NULL && while (it->space != NULL &&
...@@ -439,7 +436,7 @@ datafiles_iter_free(datafiles_iter_t *it) ...@@ -439,7 +436,7 @@ datafiles_iter_free(datafiles_iter_t *it)
void mdl_lock_all() void mdl_lock_all()
{ {
mdl_lock_init(); mdl_lock_init();
datafiles_iter_t *it = datafiles_iter_new(fil_system); datafiles_iter_t *it = datafiles_iter_new();
if (!it) if (!it)
return; return;
...@@ -460,7 +457,7 @@ options. ...@@ -460,7 +457,7 @@ options.
@return true if the space id belongs to skip table/database list. */ @return true if the space id belongs to skip table/database list. */
static bool backup_includes(space_id_t space_id) static bool backup_includes(space_id_t space_id)
{ {
datafiles_iter_t *it = datafiles_iter_new(fil_system); datafiles_iter_t *it = datafiles_iter_new();
if (!it) if (!it)
return true; return true;
...@@ -1064,10 +1061,6 @@ struct my_option xb_server_options[] = ...@@ -1064,10 +1061,6 @@ struct my_option xb_server_options[] =
{"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT, {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
"Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct, "Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct,
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, (G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
{"innodb_open_files", OPT_INNODB_OPEN_FILES,
"How many files at the maximum InnoDB keeps open at the same time.",
(G_PTR*) &innobase_open_files, (G_PTR*) &innobase_open_files, 0,
GET_LONG, REQUIRED_ARG, 300L, 10L, LONG_MAX, 0, 1L, 0},
{"innodb_use_native_aio", OPT_INNODB_USE_NATIVE_AIO, {"innodb_use_native_aio", OPT_INNODB_USE_NATIVE_AIO,
"Use native AIO if supported on this platform.", "Use native AIO if supported on this platform.",
(G_PTR*) &srv_use_native_aio, (G_PTR*) &srv_use_native_aio,
...@@ -1649,7 +1642,7 @@ innodb_init_param(void) ...@@ -1649,7 +1642,7 @@ innodb_init_param(void)
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog; srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
srv_max_n_open_files = (ulint) innobase_open_files; srv_max_n_open_files = ULINT_UNDEFINED;
srv_innodb_status = (ibool) innobase_create_status_file; srv_innodb_status = (ibool) innobase_create_status_file;
srv_print_verbose_log = 1; srv_print_verbose_log = 1;
...@@ -2698,8 +2691,7 @@ static ...@@ -2698,8 +2691,7 @@ static
void void
xb_fil_io_init() xb_fil_io_init()
{ {
fil_init(srv_file_per_table ? 50000 : 5000, LONG_MAX); fil_system.create(srv_file_per_table ? 50000 : 5000);
fsp_init();
} }
static static
...@@ -3717,7 +3709,7 @@ xtrabackup_backup_func() ...@@ -3717,7 +3709,7 @@ xtrabackup_backup_func()
if(innodb_init_param()) { if(innodb_init_param()) {
fail: fail:
stop_backup_threads(); stop_backup_threads();
if (fil_system) { if (fil_system.is_initialised()) {
innodb_shutdown(); innodb_shutdown();
} }
return(false); return(false);
...@@ -4030,7 +4022,7 @@ xtrabackup_backup_func() ...@@ -4030,7 +4022,7 @@ xtrabackup_backup_func()
mdl_lock_all(); mdl_lock_all();
} }
it = datafiles_iter_new(fil_system); it = datafiles_iter_new();
if (it == NULL) { if (it == NULL) {
msg("mariabackup: Error: datafiles_iter_new() failed.\n"); msg("mariabackup: Error: datafiles_iter_new() failed.\n");
goto fail; goto fail;
...@@ -4302,9 +4294,9 @@ xb_delta_open_matching_space( ...@@ -4302,9 +4294,9 @@ xb_delta_open_matching_space(
HASH_INSERT(xb_filter_entry_t, name_hash, inc_dir_tables_hash, HASH_INSERT(xb_filter_entry_t, name_hash, inc_dir_tables_hash,
ut_fold_string(table->name), table); ut_fold_string(table->name), table);
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
fil_space = fil_space_get_by_name(dest_space_name); fil_space = fil_space_get_by_name(dest_space_name);
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
if (fil_space != NULL) { if (fil_space != NULL) {
if (fil_space->id == info.space_id if (fil_space->id == info.space_id
...@@ -4339,9 +4331,9 @@ xb_delta_open_matching_space( ...@@ -4339,9 +4331,9 @@ xb_delta_open_matching_space(
"%s\n", dest_space_name); "%s\n", dest_space_name);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
fil_space = fil_space_get_by_id(info.space_id); fil_space = fil_space_get_by_id(info.space_id);
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
if (fil_space != NULL) { if (fil_space != NULL) {
char tmpname[FN_REFLEN]; char tmpname[FN_REFLEN];
...@@ -4944,7 +4936,7 @@ xtrabackup_prepare_func(char** argv) ...@@ -4944,7 +4936,7 @@ xtrabackup_prepare_func(char** argv)
xb_filter_hash_free(inc_dir_tables_hash); xb_filter_hash_free(inc_dir_tables_hash);
fil_close(); fil_system.close();
#ifdef WITH_INNODB_DISALLOW_WRITES #ifdef WITH_INNODB_DISALLOW_WRITES
os_event_destroy(srv_allow_writes_event); os_event_destroy(srv_allow_writes_event);
#endif #endif
......
...@@ -961,12 +961,12 @@ fil_crypt_read_crypt_data(fil_space_t* space) ...@@ -961,12 +961,12 @@ fil_crypt_read_crypt_data(fil_space_t* space)
mtr.start(); mtr.start();
if (buf_block_t* block = buf_page_get(page_id_t(space->id, 0), if (buf_block_t* block = buf_page_get(page_id_t(space->id, 0),
page_size, RW_S_LATCH, &mtr)) { page_size, RW_S_LATCH, &mtr)) {
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
if (!space->crypt_data) { if (!space->crypt_data) {
space->crypt_data = fil_space_read_crypt_data( space->crypt_data = fil_space_read_crypt_data(
page_size, block->frame); page_size, block->frame);
} }
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
} }
mtr.commit(); mtr.commit();
} }
......
This diff is collapsed.
...@@ -699,26 +699,6 @@ fsp_parse_init_file_page( ...@@ -699,26 +699,6 @@ fsp_parse_init_file_page(
return(ptr); return(ptr);
} }
/**********************************************************************//**
Initializes the fsp system. */
void
fsp_init(void)
/*==========*/
{
/* FSP_EXTENT_SIZE must be a multiple of page & zip size */
ut_a(0 == (UNIV_PAGE_SIZE % FSP_EXTENT_SIZE));
ut_a(UNIV_PAGE_SIZE);
#if UNIV_PAGE_SIZE_MAX % FSP_EXTENT_SIZE_MAX
# error "UNIV_PAGE_SIZE_MAX % FSP_EXTENT_SIZE_MAX != 0"
#endif
#if UNIV_ZIP_SIZE_MIN % FSP_EXTENT_SIZE_MIN
# error "UNIV_ZIP_SIZE_MIN % FSP_EXTENT_SIZE_MIN != 0"
#endif
/* Does nothing at the moment */
}
/**********************************************************************//** /**********************************************************************//**
Writes the space id and flags to a tablespace header. The flags contain Writes the space id and flags to a tablespace header. The flags contain
row type, physical/compressed page size, and logical/uncompressed page row type, physical/compressed page size, and logical/uncompressed page
......
...@@ -7172,9 +7172,9 @@ fts_drop_orphaned_tables(void) ...@@ -7172,9 +7172,9 @@ fts_drop_orphaned_tables(void)
users can't map them back to table names and this will create users can't map them back to table names and this will create
unnecessary clutter. */ unnecessary clutter. */
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system->space_list); for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.space_list);
space != NULL; space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) { space = UT_LIST_GET_NEXT(space_list, space)) {
...@@ -7196,7 +7196,7 @@ fts_drop_orphaned_tables(void) ...@@ -7196,7 +7196,7 @@ fts_drop_orphaned_tables(void)
ib_vector_push(tables, &fts_aux_table); ib_vector_push(tables, &fts_aux_table);
} }
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
trx = trx_allocate_for_background(); trx = trx_allocate_for_background();
trx->op_info = "dropping orphaned FTS tables"; trx->op_info = "dropping orphaned FTS tables";
......
...@@ -8626,24 +8626,24 @@ i_s_tablespaces_encryption_fill_table( ...@@ -8626,24 +8626,24 @@ i_s_tablespaces_encryption_fill_table(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system->space_list); for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.space_list);
space; space = UT_LIST_GET_NEXT(space_list, space)) { space; space = UT_LIST_GET_NEXT(space_list, space)) {
if (space->purpose == FIL_TYPE_TABLESPACE) { if (space->purpose == FIL_TYPE_TABLESPACE) {
space->n_pending_ops++; space->n_pending_ops++;
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
if (int err = i_s_dict_fill_tablespaces_encryption( if (int err = i_s_dict_fill_tablespaces_encryption(
thd, space, tables->table)) { thd, space, tables->table)) {
fil_space_release(space); fil_space_release(space);
DBUG_RETURN(err); DBUG_RETURN(err);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
space->n_pending_ops--; space->n_pending_ops--;
} }
} }
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*******************************************************************//** /*******************************************************************//**
...@@ -8897,24 +8897,24 @@ i_s_tablespaces_scrubbing_fill_table( ...@@ -8897,24 +8897,24 @@ i_s_tablespaces_scrubbing_fill_table(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system->space_list); for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.space_list);
space; space = UT_LIST_GET_NEXT(space_list, space)) { space; space = UT_LIST_GET_NEXT(space_list, space)) {
if (space->purpose == FIL_TYPE_TABLESPACE) { if (space->purpose == FIL_TYPE_TABLESPACE) {
space->n_pending_ops++; space->n_pending_ops++;
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
if (int err = i_s_dict_fill_tablespaces_scrubbing( if (int err = i_s_dict_fill_tablespaces_scrubbing(
thd, space, tables->table)) { thd, space, tables->table)) {
fil_space_release(space); fil_space_release(space);
DBUG_RETURN(err); DBUG_RETURN(err);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
space->n_pending_ops--; space->n_pending_ops--;
} }
} }
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*******************************************************************//** /*******************************************************************//**
......
...@@ -143,14 +143,14 @@ struct fil_space_t { ...@@ -143,14 +143,14 @@ struct fil_space_t {
dropped. An example is change buffer merge. dropped. An example is change buffer merge.
The tablespace cannot be dropped while this is nonzero, The tablespace cannot be dropped while this is nonzero,
or while fil_node_t::n_pending is nonzero. or while fil_node_t::n_pending is nonzero.
Protected by fil_system->mutex. */ Protected by fil_system.mutex. */
ulint n_pending_ops; ulint n_pending_ops;
/** Number of pending block read or write operations /** Number of pending block read or write operations
(when a write is imminent or a read has recently completed). (when a write is imminent or a read has recently completed).
The tablespace object cannot be freed while this is nonzero, The tablespace object cannot be freed while this is nonzero,
but it can be detached from fil_system. but it can be detached from fil_system.
Note that fil_node_t::n_pending tracks actual pending I/O requests. Note that fil_node_t::n_pending tracks actual pending I/O requests.
Protected by fil_system->mutex. */ Protected by fil_system.mutex. */
ulint n_pending_ios; ulint n_pending_ios;
hash_node_t hash; /*!< hash chain node */ hash_node_t hash; /*!< hash chain node */
hash_node_t name_hash;/*!< hash chain the name_hash table */ hash_node_t name_hash;/*!< hash chain the name_hash table */
...@@ -213,13 +213,13 @@ struct fil_space_t { ...@@ -213,13 +213,13 @@ struct fil_space_t {
struct fil_node_t { struct fil_node_t {
/** tablespace containing this file */ /** tablespace containing this file */
fil_space_t* space; fil_space_t* space;
/** file name; protected by fil_system->mutex and log_sys->mutex. */ /** file name; protected by fil_system.mutex and log_sys->mutex. */
char* name; char* name;
/** file handle (valid if is_open) */ /** file handle (valid if is_open) */
pfs_os_file_t handle; pfs_os_file_t handle;
/** event that groups and serializes calls to fsync; /** event that groups and serializes calls to fsync;
os_event_set() and os_event_reset() are protected by os_event_set() and os_event_reset() are protected by
fil_system_t::mutex */ fil_system.mutex */
os_event_t sync_event; os_event_t sync_event;
/** whether the file actually is a raw device or disk partition */ /** whether the file actually is a raw device or disk partition */
bool is_raw_disk; bool is_raw_disk;
...@@ -244,7 +244,7 @@ struct fil_node_t { ...@@ -244,7 +244,7 @@ struct fil_node_t {
int64_t flush_counter; int64_t flush_counter;
/** link to other files in this tablespace */ /** link to other files in this tablespace */
UT_LIST_NODE_T(fil_node_t) chain; UT_LIST_NODE_T(fil_node_t) chain;
/** link to the fil_system->LRU list (keeping track of open files) */ /** link to the fil_system.LRU list (keeping track of open files) */
UT_LIST_NODE_T(fil_node_t) LRU; UT_LIST_NODE_T(fil_node_t) LRU;
/** whether this file could use atomic write (data file) */ /** whether this file could use atomic write (data file) */
...@@ -311,7 +311,7 @@ struct fil_addr_t { ...@@ -311,7 +311,7 @@ struct fil_addr_t {
}; };
/** The null file address */ /** The null file address */
extern fil_addr_t fil_addr_null; extern const fil_addr_t fil_addr_null;
#endif /* !UNIV_INNOCHECKSUM */ #endif /* !UNIV_INNOCHECKSUM */
...@@ -486,6 +486,36 @@ fil_space_get( ...@@ -486,6 +486,36 @@ fil_space_get(
data space) is stored here; below we talk about tablespaces, but also data space) is stored here; below we talk about tablespaces, but also
the ib_logfiles form a 'space' and it is handled here */ the ib_logfiles form a 'space' and it is handled here */
struct fil_system_t { struct fil_system_t {
/**
Constructor.
Some members may require late initialisation, thus we just mark object as
uninitialised. Real initialisation happens in create().
*/
fil_system_t(): m_initialised(false)
{
UT_LIST_INIT(LRU, &fil_node_t::LRU);
UT_LIST_INIT(space_list, &fil_space_t::space_list);
UT_LIST_INIT(rotation_list, &fil_space_t::rotation_list);
UT_LIST_INIT(unflushed_spaces, &fil_space_t::unflushed_spaces);
UT_LIST_INIT(named_spaces, &fil_space_t::named_spaces);
}
bool is_initialised() const { return m_initialised; }
/**
Create the file system interface at database start.
@param[in] hash_size hash table size
*/
void create(ulint hash_size);
/** Close the file system interface at shutdown */
void close();
private:
bool m_initialised;
public:
ib_mutex_t mutex; /*!< The mutex protecting the cache */ ib_mutex_t mutex; /*!< The mutex protecting the cache */
hash_table_t* spaces; /*!< The hash table of spaces in the hash_table_t* spaces; /*!< The hash table of spaces in the
system; they are hashed on the space system; they are hashed on the space
...@@ -510,8 +540,6 @@ struct fil_system_t { ...@@ -510,8 +540,6 @@ struct fil_system_t {
at least one file node where at least one file node where
modification_counter > flush_counter */ modification_counter > flush_counter */
ulint n_open; /*!< number of files currently open */ ulint n_open; /*!< number of files currently open */
ulint max_n_open; /*!< n_open is not allowed to exceed
this */
int64_t modification_counter;/*!< when we write to a file we int64_t modification_counter;/*!< when we write to a file we
increment this by one */ increment this by one */
ulint max_assigned_id;/*!< maximum space id in the existing ulint max_assigned_id;/*!< maximum space id in the existing
...@@ -532,15 +560,14 @@ struct fil_system_t { ...@@ -532,15 +560,14 @@ struct fil_system_t {
/*!< list of all file spaces needing /*!< list of all file spaces needing
key rotation.*/ key rotation.*/
ibool space_id_reuse_warned; bool space_id_reuse_warned;
/* !< TRUE if fil_space_create() /*!< whether fil_space_create()
has issued a warning about has issued a warning about
potential space_id reuse */ potential space_id reuse */
}; };
/** The tablespace memory cache. This variable is NULL before the module is /** The tablespace memory cache. */
initialized. */ extern fil_system_t fil_system;
extern fil_system_t* fil_system;
#include "fil0crypt.h" #include "fil0crypt.h"
...@@ -687,18 +714,6 @@ fil_space_get_page_size( ...@@ -687,18 +714,6 @@ fil_space_get_page_size(
ulint id, ulint id,
bool* found); bool* found);
/****************************************************************//**
Initializes the tablespace memory cache. */
void
fil_init(
/*=====*/
ulint hash_size, /*!< in: hash table size */
ulint max_n_open); /*!< in: max number of open files */
/*******************************************************************//**
Initializes the tablespace memory cache. */
void
fil_close(void);
/*===========*/
/*******************************************************************//** /*******************************************************************//**
Opens all log files and system tablespace data files. They stay open until the Opens all log files and system tablespace data files. They stay open until the
database server shutdown. This should be called at a server startup after the database server shutdown. This should be called at a server startup after the
...@@ -799,7 +814,7 @@ Once started, the caller must keep calling this until it returns NULL. ...@@ -799,7 +814,7 @@ Once started, the caller must keep calling this until it returns NULL.
fil_space_acquire() and fil_space_release() are invoked here which fil_space_acquire() and fil_space_release() are invoked here which
blocks a concurrent operation from dropping the tablespace. blocks a concurrent operation from dropping the tablespace.
@param[in,out] prev_space Pointer to the previous fil_space_t. @param[in,out] prev_space Pointer to the previous fil_space_t.
If NULL, use the first fil_space_t on fil_system->space_list. If NULL, use the first fil_space_t on fil_system.space_list.
@return pointer to the next fil_space_t. @return pointer to the next fil_space_t.
@retval NULL if this was the last */ @retval NULL if this was the last */
fil_space_t* fil_space_t*
...@@ -812,7 +827,7 @@ Once started, the caller must keep calling this until it returns NULL. ...@@ -812,7 +827,7 @@ Once started, the caller must keep calling this until it returns NULL.
fil_space_acquire() and fil_space_release() are invoked here which fil_space_acquire() and fil_space_release() are invoked here which
blocks a concurrent operation from dropping the tablespace. blocks a concurrent operation from dropping the tablespace.
@param[in,out] prev_space Pointer to the previous fil_space_t. @param[in,out] prev_space Pointer to the previous fil_space_t.
If NULL, use the first fil_space_t on fil_system->space_list. If NULL, use the first fil_space_t on fil_system.space_list.
@return pointer to the next fil_space_t. @return pointer to the next fil_space_t.
@retval NULL if this was the last*/ @retval NULL if this was the last*/
fil_space_t* fil_space_t*
...@@ -1439,9 +1454,9 @@ fil_mtr_rename_log( ...@@ -1439,9 +1454,9 @@ fil_mtr_rename_log(
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Acquire the fil_system mutex. */ /** Acquire the fil_system mutex. */
#define fil_system_enter() mutex_enter(&fil_system->mutex) #define fil_system_enter() mutex_enter(&fil_system.mutex)
/** Release the fil_system mutex. */ /** Release the fil_system mutex. */
#define fil_system_exit() mutex_exit(&fil_system->mutex) #define fil_system_exit() mutex_exit(&fil_system.mutex)
/*******************************************************************//** /*******************************************************************//**
Returns the table space by a given id, NULL if not found. */ Returns the table space by a given id, NULL if not found. */
......
...@@ -294,12 +294,6 @@ the extent are free and which contain old tuple version to clean. */ ...@@ -294,12 +294,6 @@ the extent are free and which contain old tuple version to clean. */
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
/* @} */ /* @} */
/**********************************************************************//**
Initializes the file space system. */
void
fsp_init(void);
/*==========*/
/**********************************************************************//** /**********************************************************************//**
Gets the size of the system tablespace from the tablespace header. If Gets the size of the system tablespace from the tablespace header. If
we do not have an auto-extending data file, this should be equal to we do not have an auto-extending data file, this should be equal to
......
...@@ -1883,7 +1883,7 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -1883,7 +1883,7 @@ logs_empty_and_mark_files_at_shutdown(void)
loop: loop:
ut_ad(lock_sys.is_initialised() || !srv_was_started); ut_ad(lock_sys.is_initialised() || !srv_was_started);
ut_ad(log_sys || !srv_was_started); ut_ad(log_sys || !srv_was_started);
ut_ad(fil_system || !srv_was_started); ut_ad(fil_system.is_initialised() || !srv_was_started);
os_event_set(srv_buf_resize_event); os_event_set(srv_buf_resize_event);
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
...@@ -2060,7 +2060,7 @@ logs_empty_and_mark_files_at_shutdown(void) ...@@ -2060,7 +2060,7 @@ logs_empty_and_mark_files_at_shutdown(void)
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE; srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
if (fil_system) { if (fil_system.is_initialised()) {
fil_close_all_files(); fil_close_all_files();
} }
return; return;
......
...@@ -303,12 +303,12 @@ row_upd_check_references_constraints( ...@@ -303,12 +303,12 @@ row_upd_check_references_constraints(
undergoing a truncate, ignore the FK check. */ undergoing a truncate, ignore the FK check. */
if (foreign_table) { if (foreign_table) {
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system.mutex);
const fil_space_t* space = fil_space_get_by_id( const fil_space_t* space = fil_space_get_by_id(
foreign_table->space); foreign_table->space);
const bool being_truncated = space const bool being_truncated = space
&& space->is_being_truncated; && space->is_being_truncated;
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system.mutex);
if (being_truncated) { if (being_truncated) {
continue; continue;
} }
......
...@@ -1798,7 +1798,7 @@ innobase_start_or_create_for_mysql() ...@@ -1798,7 +1798,7 @@ innobase_start_or_create_for_mysql()
return(srv_init_abort(DB_ERROR)); return(srv_init_abort(DB_ERROR));
} }
fil_init(srv_file_per_table ? 50000 : 5000, srv_max_n_open_files); fil_system.create(srv_file_per_table ? 50000 : 5000);
double size; double size;
char unit; char unit;
...@@ -1849,7 +1849,6 @@ innobase_start_or_create_for_mysql() ...@@ -1849,7 +1849,6 @@ innobase_start_or_create_for_mysql()
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
fsp_init();
log_sys_init(); log_sys_init();
recv_sys_init(); recv_sys_init();
...@@ -2903,7 +2902,7 @@ innodb_shutdown() ...@@ -2903,7 +2902,7 @@ innodb_shutdown()
os_aio_free(); os_aio_free();
row_mysql_close(); row_mysql_close();
srv_free(); srv_free();
fil_close(); fil_system.close();
/* 4. Free all allocated memory */ /* 4. Free all allocated memory */
......
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