From 118e258aaac5da75a2ac4556201aaea3688fac67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 26 Oct 2020 16:04:12 +0200 Subject: MDEV-23855: Shrink fil_space_t Merge n_pending_ios, n_pending_ops to std::atomic n_pending. Change some more fil_space_t members to uint32_t to reduce the memory footprint. fil_space_t::add(), fil_ibd_create(): Attach the already opened handle to the tablespace, and enforce the fil_system.n_open limit. dict_boot(): Initialize fil_system.max_assigned_id. srv_boot(): Call srv_thread_pool_init() before anything else, so that files should be opened in the correct mode on Windows. fil_ibd_create(): Create the file in OS_FILE_AIO mode, just like fil_node_open_file_low() does it. dict_table_t::is_accessible(): Replaces fil_table_accessible(). Reviewed by: Vladislav Vaintroub --- extra/mariabackup/fil_cur.cc | 5 ++--- extra/mariabackup/xtrabackup.cc | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'extra/mariabackup') diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 7aa20b8700e..4f9e493b347 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -93,7 +93,6 @@ xb_fil_node_close_file( mutex_enter(&fil_system.mutex); ut_ad(node); - ut_a(node->n_pending_flushes == 0); ut_a(!node->being_extended); if (!node->is_open()) { @@ -406,7 +405,7 @@ xb_fil_cur_read( retry_count = 10; ret = XB_FIL_CUR_SUCCESS; - fil_space_t *space = fil_space_t::get_for_io(cursor->space_id); + fil_space_t *space = fil_space_t::get(cursor->space_id); if (!space) { return XB_FIL_CUR_ERROR; @@ -455,7 +454,7 @@ read_retry: posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED); func_exit: - space->release_for_io(); + space->release(); return(ret); } diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 39025862276..c05677b8810 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3094,10 +3094,10 @@ xb_load_single_table_tablespace( ut_a(space != NULL); - space->add(file->filepath(), OS_FILE_CLOSED, 0, false, false); - /* by opening the tablespace we forcing node and space objects - in the cache to be populated with fields from space header */ - space->get_size(); + space->add(file->filepath(), file->detach(), 0, false, false); + mutex_enter(&fil_system.mutex); + space->read_page0(); + mutex_exit(&fil_system.mutex); if (srv_operation == SRV_OPERATION_RESTORE_DELTA || xb_close_files) { @@ -3402,7 +3402,7 @@ xb_load_tablespaces() /** Destroy the tablespace memory cache. */ static void xb_data_files_close() { - fil_close_all_files(); + fil_space_t::close_all(); buf_dblwr.close(); } -- cgit v1.2.1