 |
MySQL
8.0.23
Source Code Documentation
|
Go to the documentation of this file.
42 #ifndef UNIV_HOTBACKUP
89 #include <unordered_set>
90 using Dir_set = std::unordered_set<std::string>;
91 extern Dir_set rem_gen_ts_dirs;
92 extern bool replay_in_datadir;
99 using Filenames = std::vector<std::string, ut_allocator<std::string>>;
100 using Space_ids = std::vector<space_id_t, ut_allocator<space_id_t>>;
222 using Files = std::vector<fil_node_t, ut_allocator<fil_node_t>>;
241 #ifndef UNIV_HOTBACKUP
269 ut_a(o != std::numeric_limits<size_t>::max());
314 #ifndef UNIV_HOTBACKUP
327 #ifndef UNIV_HOTBACKUP
466 #ifndef UNIV_HOTBACKUP
516 bool is_encrypted() const noexcept MY_ATTRIBUTE((warn_unused_result)) {
523 bool can_encrypt() const noexcept MY_ATTRIBUTE((warn_unused_result)) {
546 MY_ATTRIBUTE((warn_unused_result));
568 #define DOT_IBD dot_ext[IBD]
569 #define DOT_CFG dot_ext[CFG]
570 #define DOT_CFP dot_ext[CFP]
571 #define DOT_IBT dot_ext[IBT]
572 #define DOT_IBU dot_ext[IBU]
573 #define DOT_DWR dot_ext[DWR]
579 #pragma warning(disable : 4351)
630 operator const char *()
const MY_ATTRIBUTE((warn_unused_result)) {
636 const char *
operator()() const MY_ATTRIBUTE((warn_unused_result)) {
641 const std::string &
path() const MY_ATTRIBUTE((warn_unused_result)) {
646 size_t len() const MY_ATTRIBUTE((warn_unused_result)) {
655 const std::string
abs_path() const MY_ATTRIBUTE((warn_unused_result)) {
664 size_t abs_len() const MY_ATTRIBUTE((warn_unused_result)) {
677 MY_ATTRIBUTE((warn_unused_result));
682 bool is_same_as(
const std::string &other)
const
683 MY_ATTRIBUTE((warn_unused_result));
690 static bool is_same_as(
const std::string &first,
const std::string &second)
691 MY_ATTRIBUTE((warn_unused_result)) {
692 if (first.empty() || second.empty()) {
697 std::string first_abs = first_path.
abs_path();
701 std::string second_abs = second_path.
abs_path();
704 return (first_abs == second_abs);
711 MY_ATTRIBUTE((warn_unused_result));
717 MY_ATTRIBUTE((warn_unused_result));
726 static bool is_ancestor(
const std::string &first,
const std::string &second)
727 MY_ATTRIBUTE((warn_unused_result)) {
728 if (first.empty() || second.empty()) {
746 bool is_valid() const MY_ATTRIBUTE((warn_unused_result));
751 bool is_circular() const MY_ATTRIBUTE((warn_unused_result));
770 static bool is_hidden(WIN32_FIND_DATA &dirent);
779 std::string
path(pathspec);
783 if (
path.size() >= 2 && ((
path.front() ==
'\'' &&
path.back() ==
'\'') ||
784 (
path.front() ==
'"' &&
path.back() ==
'"'))) {
797 MY_ATTRIBUTE((warn_unused_result)) {
811 MY_ATTRIBUTE((warn_unused_result)) {
820 MY_ATTRIBUTE((warn_unused_result)) {
827 if (first_separator == std::string::npos) {
834 if (first_separator == 0) {
840 if (
path.length() >= 3 && isalpha(
path.at(0)) &&
path.at(1) ==
':' &&
841 (
path.at(2) ==
'\\' ||
path.at(2) ==
'/')) {
854 MY_ATTRIBUTE((warn_unused_result)) {
855 return (
path.size() >= prefix.size() &&
863 for (
auto &c :
path) {
864 if (c == OS_PATH_SEPARATOR_ALT) {
874 for (
auto ptr =
path; *ptr; ++ptr) {
875 if (*ptr == OS_PATH_SEPARATOR_ALT) {
884 for (
auto &c :
path) {
891 MY_ATTRIBUTE((warn_unused_result));
915 MY_ATTRIBUTE((warn_unused_result));
921 MY_ATTRIBUTE((warn_unused_result));
930 MY_ATTRIBUTE((warn_unused_result));
936 MY_ATTRIBUTE((warn_unused_result));
943 const auto suffix =
dot_ext[sfx];
944 size_t len = strlen(suffix);
955 const auto suffix =
dot_ext[sfx];
956 size_t len = strlen(suffix);
1003 static char *
make(
const std::string &path_in,
const std::string &name_in,
1005 MY_ATTRIBUTE((warn_unused_result));
1011 MY_ATTRIBUTE((warn_unused_result)) {
1012 return (
make(path_in,
"",
CFG));
1019 MY_ATTRIBUTE((warn_unused_result)) {
1020 return (
make(path_in,
"",
CFP));
1030 static char *
make_ibd(
const std::string &path_in,
const std::string &name_in)
1031 MY_ATTRIBUTE((warn_unused_result)) {
1032 return (
make(path_in, name_in,
IBD));
1040 MY_ATTRIBUTE((warn_unused_result)) {
1041 return (
make(
"", name_in,
IBD));
1051 static std::string
make_new_path(
const std::string &path_in,
1052 const std::string &name_in,
1054 MY_ATTRIBUTE((warn_unused_result));
1078 #ifndef UNIV_HOTBACKUP
1090 uint32_t fsp_flags,
const std::string &
path);
1098 const std::string &
path);
1176 std::ostream &
print(std::ostream &out)
const {
1177 out <<
"[fil_addr_t: page=" <<
page <<
", boffset=" <<
boffset <<
"]";
1193 return (obj.
print(out));
1305 #define fil_page_type_is_index(page_type) \
1306 (page_type == FIL_PAGE_INDEX || page_type == FIL_PAGE_SDI || \
1307 page_type == FIL_PAGE_RTREE)
1311 #define fil_page_index_page_check(page) \
1312 fil_page_type_is_index(fil_page_get_type(page))
1337 MY_ATTRIBUTE((warn_unused_result));
1339 #ifndef UNIV_HOTBACKUP
1344 MY_ATTRIBUTE((warn_unused_result));
1351 MY_ATTRIBUTE((warn_unused_result));
1374 bool is_raw,
bool atomic_write,
1376 MY_ATTRIBUTE((warn_unused_result));
1389 MY_ATTRIBUTE((warn_unused_result));
1397 MY_ATTRIBUTE((warn_unused_result));
1406 MY_ATTRIBUTE((warn_unused_result));
1413 MY_ATTRIBUTE((warn_unused_result));
1420 MY_ATTRIBUTE((warn_unused_result));
1444 MY_ATTRIBUTE((warn_unused_result));
1478 template <
typename F>
1496 #ifndef UNIV_HOTBACKUP
1510 bool meb_fil_space_free(
space_id_t space_id);
1516 void meb_extend_tablespaces_to_stored_len();
1521 void meb_fil_name_process(
const char *
name,
space_id_t space_id);
1531 MY_ATTRIBUTE((warn_unused_result));
1539 MY_ATTRIBUTE((warn_unused_result));
1566 MY_ATTRIBUTE((warn_unused_result));
1575 MY_ATTRIBUTE((warn_unused_result));
1583 MY_ATTRIBUTE((warn_unused_result));
1600 MY_ATTRIBUTE((warn_unused_result));
1610 const char *new_path,
bool is_discarded)
1611 MY_ATTRIBUTE((warn_unused_result));
1622 const char *new_name,
const char *new_path_in)
1623 MY_ATTRIBUTE((warn_unused_result));
1637 MY_ATTRIBUTE((warn_unused_result));
1649 MY_ATTRIBUTE((warn_unused_result));
1659 MY_ATTRIBUTE((warn_unused_result));
1688 uint32_t
flags,
const char *space_name,
1689 const char *
table_name,
const char *path_in,
bool strict,
1690 bool old_space) MY_ATTRIBUTE((warn_unused_result));
1704 bool print_err,
bool adjust_space,
1706 MY_ATTRIBUTE((warn_unused_result));
1719 MY_ATTRIBUTE((warn_unused_result));
1728 MY_ATTRIBUTE((warn_unused_result));
1740 MY_ATTRIBUTE((warn_unused_result));
1752 const page_size_t &page_size, ulint byte_offset, ulint len,
1753 void *
buf) MY_ATTRIBUTE((warn_unused_result));
1773 const page_size_t &page_size, ulint byte_offset, ulint len,
1774 void *
buf,
void *message) MY_ATTRIBUTE((warn_unused_result));
1810 MY_ATTRIBUTE((warn_unused_result));
1816 MY_ATTRIBUTE((warn_unused_result));
1822 MY_ATTRIBUTE((warn_unused_result));
1859 if (page_type !=
type) {
1872 #define fil_block_check_type(block, type, mtr) \
1873 fil_page_check_type(block->page.id, block->frame, type, mtr)
1888 MY_ATTRIBUTE((warn_unused_result));
1909 MY_ATTRIBUTE((warn_unused_result)) UNIV_NOTHROW = 0;
1919 MY_ATTRIBUTE((warn_unused_result)) UNIV_NOTHROW = 0;
1932 MY_ATTRIBUTE((warn_unused_result)) UNIV_NOTHROW = 0;
1937 MY_ATTRIBUTE((warn_unused_result)) UNIV_NOTHROW = 0;
1974 MY_ATTRIBUTE((warn_unused_result));
1986 MY_ATTRIBUTE((warn_unused_result));
1993 MY_ATTRIBUTE((warn_unused_result));
2001 MY_ATTRIBUTE((warn_unused_result));
2010 MY_ATTRIBUTE((warn_unused_result));
2017 MY_ATTRIBUTE((warn_unused_result));
2023 MY_ATTRIBUTE((warn_unused_result));
2039 byte *
key,
byte *iv)
2040 MY_ATTRIBUTE((warn_unused_result));
2052 MY_ATTRIBUTE((warn_unused_result));
2062 if (space->size == 0) {
2069 ut_a(size == space->size);
2073 #if !defined(NO_FALLOCATE) && defined(UNIV_LINUX)
2079 MY_ATTRIBUTE((warn_unused_result));
2087 #ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH
2088 void test_make_filepath();
2092 #define fil_space_get_sys_space() (fil_space_t::s_sys_space)
2103 const page_id_t &page_id, ulint parsed_bytes,
2105 MY_ATTRIBUTE((warn_unused_result));
2116 const page_id_t &page_id, ulint parsed_bytes,
2118 MY_ATTRIBUTE((warn_unused_result));
2130 const page_id_t &page_id, ulint parsed_bytes,
2132 MY_ATTRIBUTE((warn_unused_result));
2143 const page_id_t &page_id, ulint parsed_bytes,
2145 MY_ATTRIBUTE((warn_unused_result));
2155 MY_ATTRIBUTE((warn_unused_result));
2165 MY_ATTRIBUTE((warn_unused_result));
2176 bool update_space, std::string &space_name,
2177 std::string &dd_path);
2186 const char *space_name,
const std::string &old_path,
2187 const std::string &new_path);
2201 const char *space_name, ulint fsp_flags,
2202 std::string old_path,
2203 std::string *new_path)
2204 MY_ATTRIBUTE((warn_unused_result));
2232 MY_ATTRIBUTE((warn_unused_result));
2242 const
char *old_name, const
char *new_name);
2248 MY_ATTRIBUTE((warn_unused_result));
2255 MY_ATTRIBUTE((warn_unused_result));
2267 const
char *new_name)
2268 MY_ATTRIBUTE((warn_unused_result));
2287 #ifndef UNIV_HOTBACKUP
2304 MY_ATTRIBUTE((warn_unused_result));
2310 MY_ATTRIBUTE((warn_unused_result));
uint32 page_no_t
Page number.
Definition: api0api.h:57
Type
Algorithm types supported.
Definition: os0enc.h:42
dberr_t fil_set_autoextend_size(space_id_t space_id, uint64_t autoextend_size)
Set the autoextend_size attribute for the tablespace.
Definition: fil0fil.cc:9322
uint64_t lsn_t
Type used for all log sequence number storage and arithmetics.
Definition: log0types.h:60
constexpr page_type_t FIL_PAGE_ENCRYPTED_RTREE
Encrypted R-tree page.
Definition: fil0fil.h:1262
void fil_aio_wait(ulint segment)
Waits for an AIO operation to complete.
Definition: fil0fil.cc:8184
static bool is_hidden(std::string path)
Determine if the file or directory is considered HIDDEN.
Definition: fil0fil.cc:9630
dberr_t fil_rename_tablespace_by_id(space_id_t space_id, const char *old_name, const char *new_name)
Rename a tablespace.
Definition: fil0fil.cc:5468
static uint64_t lsn
Definition: xcom_base.cc:429
@ MOVED
Space ID matches but the paths don't match.
static bool is_absolute_path(const std::string &path)
Determine if a path is an absolute path or not.
Definition: fil0fil.h:810
ulint encryption_klen
Encrypt key length.
Definition: fil0fil.h:488
virtual ulint get_space_flags() const 1=0
bool operator==(const Fil_path &other) const
Determine if this path is equal to the other path.
Definition: fil0fil.h:671
char * name
file name; protected by Fil_shard::m_mutex and log_sys->mutex.
Definition: fil0fil.h:153
void fil_tablespace_open_init_for_recovery(bool recovery)
Read the tablespace id to path mapping from the file.
@ IBD
Definition: fil0fil.h:558
List_node LRU
link to the fil_system->LRU list (keeping track of open files)
Definition: fil0fil.h:201
static char * make_ibd_from_table_name(const std::string &name_in)
Allocate and build a file name from a path, a table or tablespace name and a suffix.
Definition: fil0fil.h:1039
bool fil_truncate_tablespace(space_id_t space_id, page_no_t size_in_pages)
Truncate the tablespace to needed size.
Definition: fil0fil.cc:4738
void get_encryption_info(Encryption &en) noexcept
Copy the encryption info from this object to the provided Encryption object.
Definition: fil0fil.h:530
static const char * filepath
Definition: myisamlog.cc:93
dberr_t fil_redo_io(const IORequest &type, const page_id_t &page_id, const page_size_t &page_size, ulint byte_offset, ulint len, void *buf)
Read or write redo log data (synchronous buffered IO).
Definition: fil0fil.cc:8160
pfs_os_file_t handle
file handle (valid if is_open)
Definition: fil0fil.h:161
static constexpr auto OS_SEPARATOR
OS specific path separator.
Definition: fil0fil.h:589
constexpr size_t FIL_IBD_FILE_INITIAL_SIZE_5_7
An empty tablespace (CREATE TABLESPACE) has minimum of 4 pages and an empty CREATE TABLE (file_per_ta...
Definition: fil0fil.h:1134
fil_type_t purpose
Purpose.
Definition: fil0fil.h:426
constexpr page_type_t FIL_PAGE_TYPE_LOB_INDEX
Index pages of uncompressed LOB.
Definition: fil0fil.h:1277
@ MATCHES
The path matches what was found during the scan.
const char * table_name
Definition: rules_table_service.cc:55
space_id_t fil_space_get_id_by_name(const char *name)
Returns the space ID based on the tablespace name.
Definition: fil0fil.cc:6518
uint32_t n_pending_flushes
This is positive when flushing the tablespace to disk; dropping of the tablespace is forbidden if thi...
Definition: fil0fil.h:458
@ ENCRYPTION
Definition: fil0fil.h:217
void fil_space_open_if_needed(fil_space_t *space)
During crash recovery, open a tablespace if it had not been opened yet, to get valid size and flags.
Definition: fil0fil.h:2061
static bool is_valid_location_within_db(const char *space_name, const std::string &path)
Check if the implicit filepath is immediately within a dir named for the schema.
Definition: fil0fil.cc:11918
char * fil_space_get_first_path(space_id_t space_id)
Returns the path from the first fil_node_t found with this space ID.
Definition: fil0fil.cc:3542
constexpr page_type_t FIL_PAGE_RTREE
R-tree node.
Definition: fil0fil.h:1206
bool is_equal(const fil_addr_t &rhs) const
Compare to instances.
Definition: fil0fil.h:1166
void fil_space_release_free_extents(space_id_t space_id, ulint n_reserved)
Releases free extents in a file space.
Definition: fil0fil.cc:7480
dberr_t fil_delete_tablespace(space_id_t space_id, buf_remove_t buf_remove)
Deletes an IBD or IBU tablespace.
Definition: fil0fil.cc:4662
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FRAG
Fragment pages of compressed LOB.
Definition: fil0fil.h:1296
char * name
Tablespace name.
Definition: fil0fil.h:303
bool is_compressed() const noexcept
Check if the tablespace is compressed.
Definition: fil0fil.h:510
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_DATA
Data pages of compressed LOB.
Definition: fil0fil.h:1289
constexpr size_t FIL_SCAN_MAX_THREADS
Maximum number of threads that will be used for scanning the tablespace files.
Definition: fil0fil.h:65
static bool is_same_as(const std::string &first, const std::string &second)
Check if two path strings are equal.
Definition: fil0fil.h:690
@ IBU
Definition: fil0fil.h:562
Fil_state
Result of comparing a path.
Definition: fil0fil.h:115
Type
Algorithm types supported.
Definition: file.h:52
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:54
const std::string & path() const
Definition: fil0fil.h:641
const char * fil_get_page_type_str(page_type_t type) noexcept
Get the page type as a string.
Definition: fil0fil.cc:12022
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:66
Iterate over the files in all the tablespaces.
Definition: fil0fil.h:1471
void fil_flush(space_id_t space_id)
Flushes to disk possible writes cached by the OS.
Definition: fil0fil.cc:8524
byte fil_faddr_t
'type' definition in C: an address stored in a file page is a string of bytes
Definition: fil0fil.h:1151
Compression::Type fil_get_compression(space_id_t space_id)
Get the compression algorithm for a tablespace.
Definition: fil0fil.cc:9312
bool MySQL_undo_path_is_unique
The undo path is different from any other known directory.
Definition: fil0fil.cc:283
constexpr page_type_t FIL_PAGE_SDI
Tablespace SDI Index page.
Definition: fil0fil.h:1209
void fil_flush_file_spaces(uint8_t purpose)
Flush to disk the writes in file spaces of the given type possibly cached by the OS.
Definition: fil0fil.cc:8593
bool has_no_references() const
Definition: fil0fil.cc:12172
@ relative
Definition: fil0fil.h:604
Encryption::Type encryption_type
Encryption algorithm.
Definition: fil0fil.h:482
dberr_t fil_close_tablespace(trx_t *trx, space_id_t space_id)
Closes a single-table tablespace.
Definition: fil0fil.cc:4375
ulint magic_n
FIL_SPACE_MAGIC_N.
Definition: fil0fil.h:500
constexpr page_type_t FIL_PAGE_IBUF_BITMAP
Insert buffer bitmap.
Definition: fil0fil.h:1225
virtual dberr_t operator()(os_offset_t offset, buf_block_t *block) 1=0
Called for every page in the tablespace.
void fil_set_max_space_id_if_bigger(space_id_t max_id)
Sets the max tablespace id counter if the given number is bigger than the previous value.
Definition: fil0fil.cc:3982
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:169
static constexpr char general_space_name[]
This tablespace name is used internally during file discovery to open a general tablespace before the...
Definition: fil0fil.h:79
void set_page_size(const buf_frame_t *page) 1
Set the tablespace table size.
Definition: fil0fil.cc:9133
InnoDB condition variable.
Definition: os0event.cc:66
ulint fil_space_get_n_reserved_extents(space_id_t space_id)
Gets the number of reserved extents.
Definition: fil0fil.cc:7499
constexpr page_no_t PAGE_NO_MAX
Maximum Page Number, one less than FIL_NULL.
Definition: fil0fil.h:1140
void fil_page_reset_type(const page_id_t &page_id, byte *page, ulint type, mtr_t *mtr)
Reset the page type.
Definition: fil0fil.cc:8637
constexpr page_type_t FIL_PAGE_TYPE_LAST
Used by i_s.cc to index into the text description.
Definition: fil0fil.h:1302
static bool is_undo_tablespace_name(const std::string &name)
Check if the name is an undo tablespace name.
Definition: fil0fil.cc:2202
bool fil_system_get_file_by_space_num(space_id_t space_num, space_id_t &space_id, std::string &name)
Fetch the file name opened for an undo space number from the file map.
Definition: fil0fil.cc:4504
bool fil_assign_new_space_id(space_id_t *space_id)
Assigns a new space id for a new single-table tablespace.
Definition: fil0fil.cc:3468
constexpr page_type_t FIL_PAGE_COMPRESSED
Compressed page.
Definition: fil0fil.h:1253
size_t fil_get_scan_threads(size_t num_files)
Calculate the number of threads that can be spawned to scan the given number of files taking into the...
Definition: fil0fil.cc:129
std::string m_abs_path
A full absolute path to the same file.
Definition: fil0fil.h:1115
path_type
Various types of file paths.
Definition: fil0fil.h:604
ib::Timer m_last_extended
When the tablespace was extended last.
Definition: fil0fil.h:297
std::vector< space_id_t, ut_allocator< space_id_t > > Space_ids
Definition: fil0fil.h:100
Fil_state fil_tablespace_path_equals(dd::Object_id dd_object_id, space_id_t space_id, const char *space_name, ulint fsp_flags, std::string old_path, std::string *new_path)
Lookup the tablespace ID and return the path to the file.
Definition: fil0fil.cc:10256
bool fil_space_reserve_free_extents(space_id_t space_id, ulint n_free_now, ulint n_to_reserve)
Tries to reserve free extents in a file space.
Definition: fil0fil.cc:7454
uint32_t n_reserved_extents
Number of reserved free extents for ongoing operations like B-tree page split.
Definition: fil0fil.h:454
bool is_deleted() const
Definition: fil0fil.cc:12149
@ IBT
Definition: fil0fil.h:561
size_t get_reference_count() const
Definition: fil0fil.cc:12176
void fil_space_dec_redo_skipped_count(space_id_t space_id)
Decrease redo skipped count for a tablespace.
Definition: fil0fil.cc:4763
constexpr page_type_t FIL_PAGE_TYPE_XDES
Extent descriptor page.
Definition: fil0fil.h:1237
page_no_t size
Tablespace file size in pages; 0 if not known yet.
Definition: fil0fil.h:433
void fil_space_update_name(fil_space_t *space, const char *name)
Update the tablespace name.
Definition: fil0fil.cc:11859
constexpr page_type_t FIL_PAGE_SDI_ZBLOB
Commpressed SDI BLOB page.
Definition: fil0fil.h:1268
dberr_t fil_ibd_open(bool validate, fil_type_t purpose, space_id_t space_id, uint32_t flags, const char *space_name, const char *table_name, const char *path_in, bool strict, bool old_space)
Open a single-table tablespace and optionally check the space id is right in it.
Definition: fil0fil.cc:5816
const char * operator()() const
Explicit type conversion.
Definition: fil0fil.h:636
virtual space_id_t get_space_id() const 1=0
The IO Context that is passed down to the low level IO code.
Definition: os0file.h:264
void set_file(const char *filename, pfs_os_file_t file) 1
Set the name of the physical file and the file handle that is used to open it for the file that is be...
Definition: fil0fil.h:1925
static void make_data_dir_path(char *data_dir_path)
This function reduces a null-terminated full remote path name into the path that is sent by MySQL for...
Definition: fil0fil.cc:5074
rw_lock_t * fil_space_get_latch(space_id_t space_id)
Returns the latch of a file space.
Definition: fil0fil.cc:2340
page_no_t fil_page_get_next(const byte *page)
Get the successor of a file page.
Definition: fil0fil.cc:8618
bool fil_space_extend(fil_space_t *space, page_no_t size)
Try to extend a tablespace if it is smaller than the specified size.
Definition: fil0fil.cc:6885
@ CFG
Definition: fil0fil.h:559
void fil_close_log_files(bool free_all)
Closes the redo log files.
Definition: fil0fil.cc:3915
ulint fil_n_file_opened
Number of files currently open.
Definition: fil0fil.cc:298
static duk_ret_t normalize_path(duk_context *ctx, duk_idx_t obj_idx)
Definition: duk_module_shim.c:75
dberr_t
Definition: db0err.h:38
dberr_t fil_rename_tablespace(space_id_t space_id, const char *old_path, const char *new_name, const char *new_path_in)
Rename a single-table tablespace.
Definition: fil0fil.cc:5387
constexpr size_t FIL_IBT_FILE_INITIAL_SIZE
Definition: fil0fil.h:1129
@ DWR
Definition: fil0fil.h:563
static void trim_separator(std::string &path)
If the last character of a directory path is a separator ('\' or '/') trim it off the string.
Definition: fil0fil.h:975
Data structure for a database table.
Definition: dict0mem.h:1525
bool fil_tablespace_open_for_recovery(space_id_t space_id)
Open the tabelspace and also get the tablespace filenames, space_id must already be known.
Definition: fil0fil.cc:10252
List_node unflushed_spaces
List of spaces with at least one unflushed file we have written to.
Definition: fil0fil.h:473
constexpr page_type_t FIL_PAGE_INDEX
File page types (values of FIL_PAGE_TYPE)
Definition: fil0fil.h:1203
rw_lock_t latch
Latch protecting the file space storage allocation.
Definition: fil0fil.h:468
case opt name
Definition: sslopt-case.h:32
The buffer control block structure.
Definition: buf0buf.h:1544
fil_type_t
File types.
Definition: fil0fil.h:103
bool fil_validate()
Checks the consistency of the tablespace cache.
Definition: fil0fil.cc:2016
bool fil_type_is_data(fil_type_t type)
Check if fil_type is any of FIL_TYPE_TEMPORARY, FIL_TYPE_IMPORT or FIL_TYPE_TABLESPACE.
Definition: fil0fil.h:138
bool is_ancestor(const Fil_path &other) const
Check if m_path is the parent of the other path.
Definition: fil0fil.cc:9599
static const char * get_file_type_string(const std::string &path)
Return a string to display the file type of a path.
Definition: fil0fil.cc:9667
UNIV_INLINE uint16_t mach_read_from_2(const byte *b)
The following function is used to fetch data from 2 consecutive bytes.
page_no_t init_size
initial size of the file in database pages; FIL_IBD_FILE_INITIAL_SIZE by default
Definition: fil0fil.h:180
uint32_t fil_space_get_flags(space_id_t space_id)
Returns the flags of the space.
Definition: fil0fil.cc:3584
static void append_separator(std::string &path)
If the last character of a directory path is NOT a separator, append a separator to the path.
Definition: fil0fil.h:987
bool punch_hole
whether the file system of this file supports PUNCH HOLE
Definition: fil0fil.h:204
std::ostream & print(std::ostream &out) const
Print a string representation.
Definition: fil0fil.h:1176
void fil_space_set_flags(fil_space_t *space, uint32_t flags)
Sets the flags of the tablespace.
Definition: fil0fil.cc:9766
static const char * key
Definition: suite_stubs.c:14
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FIRST
The first page of a compressed LOB.
Definition: fil0fil.h:1286
os_file_type_t
Definition: os0file.h:669
size_t fil_count_undo_deleted(space_id_t undo_num)
Count how many truncated undo space IDs are still tracked in the buffer pool and the file_system cach...
Definition: fil0fil.cc:12012
void fil_open_log_and_system_tablespace_files()
Opens all log files and system tablespace data files.
Definition: fil0fil.cc:3731
os_event_t sync_event
event that groups and serializes calls to fsync
Definition: fil0fil.h:164
static constexpr auto DB_SEPARATOR
schema '/' table separator
Definition: fil0fil.h:586
static bool is_ancestor(const std::string &first, const std::string &second)
Check if the first path is an ancestor of the second.
Definition: fil0fil.h:726
fil_space_t * fil_space_acquire_silent(space_id_t space_id)
Acquire a tablespace that may not exist.
Definition: fil0fil.cc:4072
For measuring time elapsed.
Definition: ut0ut.h:852
void fil_io_set_encryption(IORequest &req_type, const page_id_t &page_id, fil_space_t *space)
Set encryption information for IORequest.
Definition: fil0fil.cc:7664
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:343
static path_type type_of_path(const std::string &path)
Determine what type of path is provided.
Definition: fil0fil.h:819
bool is_file_and_exists() const
Definition: fil0fil.cc:9698
dberr_t fil_rename_tablespace_check(space_id_t space_id, const char *old_path, const char *new_path, bool is_discarded)
Test if a tablespace file can be renamed to a new filepath by checking if that the old filepath exist...
Definition: fil0fil.cc:5105
Tablespace or log data space.
Definition: fil0fil.h:220
constexpr page_type_t FIL_PAGE_TYPE_LOB_FIRST
The first page of an uncompressed LOB.
Definition: fil0fil.h:1283
static bool is_valid_location(const char *space_name, space_id_t space_id, uint32_t fsp_flags, const std::string &path)
Check if the filepath provided is in a valid placement.
Definition: fil0fil.cc:11874
std::atomic_bool m_deleted
true if the tablespace is marked for deletion.
Definition: fil0fil.h:403
byte encryption_iv[Encryption::KEY_LEN]
Encrypt initial vector.
Definition: fil0fil.h:491
ib_uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:83
bool fil_update_partition_name(space_id_t space_id, uint32_t fsp_flags, bool update_space, std::string &space_name, std::string &dd_path)
Compare and update space name and dd path for partitioned table.
Definition: fil0fil.cc:10379
bool fil_space_open(space_id_t space_id)
Open each file of a tablespace if not already open.
Definition: fil0fil.cc:3622
int64_t modification_counter
number of writes to the file since the system was started
Definition: fil0fil.h:195
void fil_page_check_type(const page_id_t &page_id, byte *page, ulint type, mtr_t *mtr)
Check (and if needed, reset) the page type.
Definition: fil0fil.h:1855
#define FSP_FLAGS_GET_ENCRYPTION(flags)
Return the contents of the ENCRYPTION field.
Definition: fsp0types.h:346
void fil_page_set_type(byte *page, ulint type)
Sets the file page type.
Definition: fil0fil.cc:8625
dberr_t fil_open_for_business(bool read_only_mode)
Free the Tablespace_files instance.
Definition: fil0fil.cc:10138
constexpr page_type_t FIL_PAGE_TYPE_BLOB
Uncompressed BLOB page.
Definition: fil0fil.h:1240
constexpr page_type_t FIL_PAGE_TYPE_FSP_HDR
File space header.
Definition: fil0fil.h:1234
static void convert_to_lower_case(std::string &path)
Convert to lower case using the file system charset.
Definition: fil0fil.cc:11998
constexpr page_type_t FIL_PAGE_INODE
Index node.
Definition: fil0fil.h:1215
static std::string remove_quotes(const char *pathspec)
Remove quotes e.g., 'a;b' or "a;b" -> a;b.
Definition: fil0fil.h:778
static char * make_ibd(const std::string &path_in, const std::string &name_in)
Allocate and build a file name from a path, a table or tablespace name and a suffix.
Definition: fil0fil.h:1030
Wrapper for a path to a directory that may or may not exist.
Definition: fil0fil.h:583
static std::string get_basename(const std::string &filepath)
Get the basename of the file path.
Definition: fil0fil.cc:4355
void inc_ref() noexcept
Increment the page reference count.
Definition: fil0fil.h:267
byte buf_frame_t
A buffer frame.
Definition: buf0types.h:59
bool fil_op_replay_rename_for_ddl(const page_id_t &page_id, const char *old_name, const char *new_name)
Replay a file rename operation for ddl replay.
Definition: fil0fil.cc:10149
dberr_t fil_tablespace_iterate(dict_table_t *table, ulint n_io_buffers, Compression::Type compression_type, PageCallback &callback)
Iterate over all the pages in the tablespace.
Definition: fil0fil.cc:8944
static bool has_prefix(const std::string &path, const std::string prefix)
Definition: fil0fil.h:853
uint32_t flags
Tablespace flags; see fsp_flags_is_valid() and page_size_t(ulint) (constructor).
Definition: fil0fil.h:450
space_id_t id
Tablespace ID.
Definition: fil0fil.h:306
Fil_path()
Default constructor.
Definition: fil0fil.cc:9572
@ CFP
Definition: fil0fil.h:560
constexpr size_t FIL_SCAN_MAX_TABLESPACES_PER_THREAD
Maximum number of tablespaces to be scanned by a thread while scanning for available tablespaces duri...
Definition: fil0fil.h:60
bool stop_new_ops
We set this true when we start deleting a single-table tablespace.
Definition: fil0fil.h:417
void fil_space_release(fil_space_t *space)
Release a tablespace acquired with fil_space_acquire().
Definition: fil0fil.cc:4078
@ NONE
Definition: fil0fil.h:217
virtual dberr_t init(os_offset_t file_size, const buf_block_t *block) 1=0
Called for page 0 in the tablespace file at the start.
constexpr page_type_t FIL_PAGE_COMPRESSED_AND_ENCRYPTED
Compressed and Encrypted page.
Definition: fil0fil.h:1259
fil_addr_t fil_addr_null
The null file address.
Definition: fil0fil.cc:329
fil_addr_t(page_no_t p, uint32_t boff)
Constructor.
Definition: fil0fil.h:1161
bool fil_check_missing_tablespaces()
This function should be called after recovery has completed.
Definition: fil0fil.cc:10491
uint64_t autoextend_size_in_bytes
Autoextend size.
Definition: fil0fil.h:439
bool is_raw_disk
whether the file actually is a raw device or disk partition
Definition: fil0fil.h:167
dberr_t fil_write_flushed_lsn(lsn_t lsn)
Write the flushed LSN to the page header of the first page in the system tablespace.
Definition: fil0fil.cc:3994
static std::string get_real_path(const std::string &path, bool force=true)
Get the real path for a directory or a file name.
Definition: fil0fil.cc:4245
std::vector< Observer *, ut_allocator< Observer * > > FlushObservers
Definition: fil0fil.h:294
constexpr page_type_t FIL_PAGE_TYPE_LOB_DATA
Data pages of uncompressed LOB.
Definition: fil0fil.h:1280
Page size descriptor.
Definition: page0size.h:49
static mysql_service_status_t validate(reference_caching_channel channel) noexcept
Definition: component.cc:66
static void to_lower(std::string &path)
Convert a path string to lower case using the CHARSET my_charset_filename.
Definition: fil0fil.h:883
Fil_path MySQL_datadir_path
The MySQL server –datadir value.
Definition: fil0fil.cc:277
bool fil_replace_tablespace(space_id_t old_space_id, space_id_t new_space_id, page_no_t size_in_pages)
Drop and create an UNDO tablespace.
Definition: fil0fil.cc:5764
static constexpr auto SLASH_DOT_DOT_SLASH
Definition: fil0fil.h:600
dberr_t fil_scan_for_tablespaces()
Discover tablespaces by reading the header from .ibd files.
Definition: fil0fil.cc:11837
bool is_open
whether this file is open.
Definition: fil0fil.h:158
dberr_t fil_reset_encryption(space_id_t space_id)
Reset the encryption type for the tablespace.
Definition: fil0fil.cc:9392
void fil_set_scan_dir(const std::string &directory, bool is_undo_dir=false)
Normalize and save a directory to scan for datafiles.
Definition: fil0fil.cc:11827
static constexpr auto SEPARATOR
Directory separators that are supported.
Definition: fil0fil.h:592
static dberr_t for_each_file(bool include_log, F &&f)
For each data file, exclude redo log files.
Definition: fil0fil.h:1479
fil_space_t * fil_space_create(const char *name, space_id_t space_id, uint32_t flags, fil_type_t purpose)
Create a space memory object and put it to the fil_system hash table.
Definition: fil0fil.cc:3359
byte * fil_tablespace_redo_create(byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only)
Redo a tablespace create.
Definition: fil0fil.cc:10503
constexpr page_type_t FIL_PAGE_IBUF_FREE_LIST
Insert buffer free list.
Definition: fil0fil.h:1218
lsn_t m_header_page_flush_lsn
Flush lsn of header page.
Definition: fil0fil.h:497
void fil_init(ulint max_n_open)
Initializes the tablespace memory cache.
Definition: fil0fil.cc:3666
pfs_os_file_t m_file
File handle to the tablespace.
Definition: fil0fil.h:1953
Callback functor.
Definition: fil0fil.h:1898
bool can_encrypt() const noexcept
Check if the encryption details, like the encryption key, type and other details, that are needed to ...
Definition: fil0fil.h:523
PageCallback(PageCallback &&)=delete
byte * fil_tablespace_redo_rename(byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only)
Redo a tablespace rename.
Definition: fil0fil.cc:10614
static constexpr auto DOT_DOT_SLASH
Definition: fil0fil.h:599
constexpr page_type_t FIL_PAGE_TYPE_LEGACY_DBLWR
Legacy doublewrite buffer page.
Definition: fil0fil.h:1271
page_no_t size
size of the file in database pages (0 if not known yet); the possible last incomplete megabyte may be...
Definition: fil0fil.h:172
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:215
static void normalize(std::string &path)
Normalize a directory path for the current OS: On Windows, we convert '/' to '\', else we convert '\'...
Definition: fil0fil.h:862
int page
Definition: ctype-mb.cc:1234
volatile bool recv_recovery_on
true when applying redo log records during crash recovery; false otherwise.
Definition: log0recv.cc:96
void fil_flush_file_redo()
Flush to disk the writes in file spaces of the given type possibly cached by the OS.
Definition: fil0fil.cc:8599
Common file descriptor for file IO instrumentation with PFS on windows and other platforms.
Definition: os0file.h:160
std::vector< fil_node_t, ut_allocator< fil_node_t > > Files
Definition: fil0fil.h:222
Encryption algorithm.
Definition: os0enc.h:39
page_type_t fil_page_get_type(const byte *page)
Get the file page type.
Definition: fil0fil.h:1843
UT_LIST_NODE_T(fil_node_t) List_node
Definition: fil0fil.h:147
fil_addr_t()
Definition: fil0fil.h:1156
uint32_t get_current_version() const
Returns current version of the space object.
Definition: fil0fil.cc:12162
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_INDEX
Index pages of compressed LOB.
Definition: fil0fil.h:1293
static void normalize(char *path)
Normalize a directory path for the current OS: On Windows, we convert '/' to '\', else we convert '\'...
Definition: fil0fil.h:873
dberr_t fil_ibt_create(space_id_t space_id, const char *name, const char *path, uint32_t flags, page_no_t size)
Create a session temporary tablespace (IBT) file.
Definition: fil0fil.cc:5757
constexpr size_t FIL_SCAN_THREADS_PER_CORE
Number of threads per core.
Definition: fil0fil.h:68
@ MISSING
No MLOG_FILE_DELETE record and the file could not be found.
buf_remove_t
Algorithm to remove the pages for a tablespace from the buffer pool.
Definition: buf0types.h:81
fil_node_t * get_file_node(page_no_t *page_no) noexcept
Get the file node corresponding to the given page number of the tablespace.
Definition: fil0fil.cc:12119
static char * make_cfp(const std::string &path_in)
Allocate and build a CFP file name from a path.
Definition: fil0fil.h:1018
dberr_t fil_io(const IORequest &type, bool sync, const page_id_t &page_id, const page_size_t &page_size, ulint byte_offset, ulint len, void *buf, void *message)
Read or write data from a file.
Definition: fil0fil.cc:8258
bool fil_addr_is_null(const fil_addr_t &addr)
Returns true if file address is undefined.
Definition: fil0fil.cc:8604
static constexpr size_t KEY_LEN
Encryption key length.
Definition: os0enc.h:83
constexpr page_type_t FIL_PAGE_TYPE_UNKNOWN
In old tablespaces, garbage in FIL_PAGE_TYPE is replaced with this value when flushing pages.
Definition: fil0fil.h:1250
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename
Definition: ctype-utf8.cc:7040
static fil_space_t * s_sys_space
System tablespace.
Definition: fil0fil.h:503
encryption_op_type
Definition: fil0fil.h:217
fil_space_t * space
tablespace containing this file
Definition: fil0fil.h:150
@ FIL_TYPE_LOG
redo log covering changes to files of FIL_TYPE_TABLESPACE
Definition: fil0fil.h:111
@ DELETED
A MLOG_FILE_DELETE was found, file was deleted.
@ RENAMED
Tablespace and/or filename was renamed.
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:188
std::vector< std::string, ut_allocator< std::string > > Filenames
Definition: fil0fil.h:99
void bump_version()
Bumps the space object version and cause all pages in buffer pool that reference the current space ob...
Definition: fil0fil.cc:12198
std::atomic_size_t m_n_ref_count
Number of buf_page_t entries that point to this instance.
Definition: fil0fil.h:399
uint32_t boffset
Byte offset within the page.
Definition: fil0fil.h:1186
char * fil_path_to_space_name(const char *filename)
Convert a file name to a tablespace name.
Definition: fil0fil.cc:6024
unsigned char byte
Blob class.
Definition: common.h:159
constexpr page_type_t FIL_PAGE_TYPE_RSEG_ARRAY
Rollback Segment Array page.
Definition: fil0fil.h:1274
size_t abs_len() const
Definition: fil0fil.h:664
fil_type_t fil_space_get_type(space_id_t space_id)
Gets the type of a file space.
Definition: fil0fil.cc:2357
static char * trim(char *ptr)
Definition: testapp.c:546
#define FIL_PAGE_TYPE
file page type: FIL_PAGE_INDEX,..., 2 bytes.
Definition: fil0types.h:75
static constexpr char undo_space_name[]
This tablespace name is used as the prefix for implicit undo tablespaces and during file discovery to...
Definition: fil0fil.h:84
ulint redo_skipped_count
Reference count for operations who want to skip redo log in the file space in order to make fsp_space...
Definition: fil0fil.h:422
void release_free_extents(ulint n_reserved)
Release the reserved free extents.
Definition: fil0fil.cc:9849
byte encryption_key[Encryption::KEY_LEN]
Encrypt key.
Definition: fil0fil.h:485
@ FIL_TYPE_IMPORT
a tablespace that is being imported (no logging until finished)
Definition: fil0fil.h:107
void initialize() noexcept
Initializes fields.
Definition: fil0fil.h:310
constexpr page_type_t FIL_PAGE_ENCRYPTED
Encrypted page.
Definition: fil0fil.h:1256
bool fil_space_is_redo_skipped(space_id_t space_id)
Check whether a single-table tablespace is redo skipped.
Definition: fil0fil.cc:4781
void fil_space_set_imported(space_id_t space_id)
Note that a tablespace has been imported.
Definition: fil0fil.cc:2377
std::ostream & operator<<(std::ostream &out, const fil_addr_t &obj)
Definition: fil0fil.h:1192
constexpr page_type_t FIL_PAGE_TYPE_ALLOCATED
Freshly allocated page.
Definition: fil0fil.h:1222
Files files
Files attached to this tablespace.
Definition: fil0fil.h:430
char * fil_node_create(const char *name, page_no_t size, fil_space_t *space, bool is_raw, bool atomic_write, page_no_t max_pages=PAGE_NO_MAX)
Attach a file to a tablespace.
Definition: fil0fil.cc:2535
@ FIL_TYPE_TABLESPACE
persistent tablespace (for system, undo log or tables)
Definition: fil0fil.h:109
page_no_t m_undo_extend
Extend undo tablespaces by so many pages.
Definition: fil0fil.h:300
@ FIL_TYPE_TEMPORARY
temporary tablespace (temporary undo log or tables)
Definition: fil0fil.h:105
page_no_t max_size
maximum size of the file in database pages
Definition: fil0fil.h:183
bool fil_tablespace_lookup_for_recovery(space_id_t space_id)
Lookup the tablespace ID.
Definition: fil0fil.cc:10201
void fil_extend_tablespaces_to_stored_len()
Extends all tablespaces to the size stored in the space header.
PageCallback & operator=(const PageCallback &)=delete
static dberr_t iterate(bool include_log, Function &&f)
Iterate through all persistent tablespace files (FIL_TYPE_TABLESPACE) returning the nodes via callbac...
Definition: fil0fil.cc:3975
Definition: buf0block_hint.cc:29
ulint fil_n_log_flushes
The number of fsyncs done to the log.
Definition: fil0fil.cc:289
ulint fil_n_pending_tablespace_flushes
Number of pending tablespace flushes.
Definition: fil0fil.cc:295
Page identifier.
Definition: buf0types.h:168
bool is_same_as(const Fil_path &other) const
Check if m_path is the same as this other path.
Definition: fil0fil.cc:9575
static bool parse_file_path(const std::string &file_path, ib_file_suffix extn, std::string &dict_name)
Parse file-per-table file name and build Innodb dictionary table name.
Definition: fil0fil.cc:5003
static char * path
Definition: mysqldump.cc:132
static bool truncate_suffix(ib_file_suffix sfx, std::string &path)
Check if the file has the the specified suffix and truncate.
Definition: fil0fil.h:954
Compression::Type compression_type
Compression algorithm.
Definition: fil0fil.h:479
bool fil_is_page_type_valid(page_type_t type) noexcept
Check if the given page type is valid.
Definition: fil0fil.cc:12061
@ NO_EXT
Definition: fil0fil.h:557
unsigned long long Object_id
Definition: object_id.h:30
void dec_ref() noexcept
Decrement the page reference count.
Definition: fil0fil.h:273
bool atomic_write
whether atomic write is enabled for this file
Definition: fil0fil.h:210
const char * m_filepath
Physical file path.
Definition: fil0fil.h:1956
uint16_t page_type_t
Definition: fil0fil.h:1199
void fil_add_moved_space(dd::Object_id dd_object_id, space_id_t space_id, const char *space_name, const std::string &old_path, const std::string &new_path)
Add tablespace to the set of tablespaces to be updated in DD.
Definition: fil0fil.cc:10372
Innodb data dictionary name.
Definition: dict0dd.cc:6419
bool is_null() const
Check if the file address is null.
Definition: fil0fil.h:1172
bool is_absolute_path() const
Definition: fil0fil.h:802
byte * fil_tablespace_redo_delete(byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only)
Redo a tablespace delete.
Definition: fil0fil.cc:10889
const char * dot_ext[]
Common InnoDB file extentions.
Definition: fil0fil.cc:286
bool fil_path_is_known(const std::string &path)
Check if a path is known to InnoDB meaning that it is in or under one of the four path settings scann...
Definition: fil0fil.cc:11843
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB
First compressed BLOB page.
Definition: fil0fil.h:1243
static bool is_separator(char c)
Check if a character is a path separator ('\' or '/')
Definition: fil0fil.h:970
void fil_free_scanned_files()
Free the data structures required for recovery.
Definition: fil0fil.cc:11852
std::string m_path
Path to a file or directory.
Definition: fil0fil.h:1112
static std::string make_new_path(const std::string &path_in, const std::string &name_in, ib_file_suffix extn)
Create an IBD path name after replacing the basename in an old path with a new basename.
Definition: fil0fil.cc:5035
std::function< dberr_t(fil_node_t *)> Function
Definition: fil0fil.h:1473
static bool has_suffix(ib_file_suffix sfx, const std::string &path)
Check if the file has the the specified suffix.
Definition: fil0fil.h:942
@ absolute
Definition: fil0fil.h:604
dberr_t fil_rename_precheck(const dict_table_t *old_table, const dict_table_t *new_table, const char *tmp_name)
Check if swapping two .ibd files can be done without failure.
Definition: fil0fil.cc:9172
bool is_valid() const
This validation is only for ':'.
Definition: fil0fil.cc:9709
page_size_t m_page_size
The tablespace page size.
Definition: fil0fil.h:1950
@ DECRYPTION
Definition: fil0fil.h:217
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY
Index pages of fragment pages (compressed LOB).
Definition: fil0fil.h:1299
int64_t flush_counter
the modification_counter of the latest flush to disk
Definition: fil0fil.h:198
@ file_name_only
Definition: fil0fil.h:604
const page_size_t & get_page_size() const
The compressed page size.
Definition: fil0fil.h:1945
static char * make_cfg(const std::string &path_in)
Allocate and build a CFG file name from a path.
Definition: fil0fil.h:1010
Definition: varlen_sort.h:182
PageCallback(const PageCallback &)=delete
size_t in_use
e.g., when a file is being extended or just opened.
Definition: fil0fil.h:192
fil_space_t * fil_space_acquire(space_id_t space_id)
Acquire a tablespace when it could be dropped concurrently.
Definition: fil0fil.cc:4063
uint32_t get_recent_version() const
Returns current version of the space object.
Definition: fil0fil.cc:12166
bool is_encrypted() const noexcept
Check if the tablespace is encrypted.
Definition: fil0fil.h:516
bool was_not_deleted() const
Definition: fil0fil.cc:12154
page_no_t fil_space_get_size(space_id_t space_id)
Returns the size of the space in pages.
Definition: fil0fil.cc:3566
ulint fil_n_pending_log_flushes
Number of pending redo log flushes.
Definition: fil0fil.cc:292
#define UT_LIST_NODE_T(t)
Macro used for legacy reasons.
Definition: ut0lst.h:62
page_no_t size_in_header
FSP_SIZE in the tablespace header; 0 if not known yet.
Definition: fil0fil.h:436
dberr_t fil_set_encryption(space_id_t space_id, Encryption::Type algorithm, byte *key, byte *iv)
Set the encryption type for the tablespace.
Definition: fil0fil.cc:9348
static bool equal(const Item *i1, const Item *i2, const Field *f2)
Definition: sql_select.cc:3668
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1137
constexpr page_type_t FIL_PAGE_SDI_BLOB
Uncompressed SDI BLOB page.
Definition: fil0fil.h:1265
static std::string get_existing_path(const std::string &path, std::string &ghost)
Separate the portion of a directory path that exists and the portion that does not exist.
Definition: fil0fil.cc:4215
constexpr size_t FIL_NODE_MAGIC_N
Value of fil_node_t::magic_n.
Definition: fil0fil.h:553
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
bool fil_system_get_file_by_space_id(space_id_t space_id, std::string &name)
Fetch the file name opened for a space_id from the file map.
Definition: fil0fil.cc:4498
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:568
bool is_directory_and_exists() const
Definition: fil0fil.cc:9703
page_no_t free_limit
Contents of FSP_FREE_LIMIT.
Definition: fil0fil.h:445
void fil_set_scan_dirs(const std::string &directories)
Normalize and save a list of directories to scan for datafiles.
Definition: fil0fil.cc:11831
bool fil_delete_file(const char *path)
Delete the tablespace file and any related files like .cfg.
Definition: fil0fil.cc:9141
constexpr space_id_t SPACE_UNKNOWN
Unknown space id.
Definition: fil0fil.h:1143
static size_t file_size
Definition: mysql_config_editor.cc:70
void fil_no_punch_hole(fil_node_t *file)
Note that the file system where the file resides doesn't support PUNCH HOLE.
Definition: fil0fil.cc:9253
void fil_space_inc_redo_skipped_count(space_id_t space_id)
Increase redo skipped count for a tablespace.
Definition: fil0fil.cc:4747
const std::string abs_path() const
Return the absolute path by value.
Definition: fil0fil.h:655
encryption_op_type encryption_op_in_progress
Encryption is in progress.
Definition: fil0fil.h:494
void fil_close_all_files()
Closes all open files.
Definition: fil0fil.cc:3860
page_no_t flush_size
Size of the file when last flushed, used to force the flush when file grows to keep the filesystem me...
Definition: fil0fil.h:176
dberr_t fil_discard_tablespace(space_id_t space_id)
Discards a single-table tablespace.
Definition: fil0fil.cc:4814
byte * fil_tablespace_redo_encryption(byte *ptr, const byte *end, space_id_t space_id, lsn_t lsn)
Parse and process an encryption redo record.
Definition: fil0fil.cc:10977
bool fil_space_read_name_and_filepath(space_id_t space_id, char **name, char **filepath)
Looks for a pre-existing fil_space_t with the given tablespace ID and, if found, returns the name and...
Definition: fil0fil.cc:5994
constexpr page_type_t FIL_PAGE_TYPE_TRX_SYS
Transaction system data.
Definition: fil0fil.h:1231
page_no_t page
Page number within a space.
Definition: fil0fil.h:1183
virtual ~PageCallback() 1
Definition: fil0fil.h:1902
constexpr size_t FIL_SPACE_MAGIC_N
Value of fil_space_t::magic_n.
Definition: fil0fil.h:550
void set_deleted()
Marks the space object for deletion.
Definition: fil0fil.cc:12184
void fil_close()
Initializes the tablespace memory cache.
Definition: fil0fil.cc:8645
static constexpr auto DOT_SLASH
Definition: fil0fil.h:598
std::ostream & print_xdes_pages(std::ostream &out) const
Print the extent descriptor pages of this tablespace into the given output stream.
Definition: fil0fil.cc:9876
byte * fil_tablespace_redo_extend(byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only)
Redo a tablespace extend.
Definition: fil0fil.cc:10724
void fil_adjust_name_import(dict_table_t *table, const char *path, ib_file_suffix extn)
Adjust file name for import for partition files in different letter case.
Definition: fil0fil.cc:8865
We use FlushObserver to track flushing of non-redo logged pages in bulk create index(BtrBulk....
Definition: buf0flu.h:266
bool is_in_unflushed_spaces
true if this space is currently in unflushed_spaces
Definition: fil0fil.h:476
static fil_space_t * s_redo_space
Redo log tablespace.
Definition: fil0fil.h:506
@ invalid
Definition: fil0fil.h:604
page_no_t fil_page_get_prev(const byte *page)
Get the predecessor of a file page.
Definition: fil0fil.cc:8611
uint32_t free_len
Length of the FSP_FREE list.
Definition: fil0fil.h:442
size_t n_pending_flushes
count of pending flushes; is_open must be true if nonzero
Definition: fil0fil.h:189
static void convert_to_filename_charset(std::string &name)
Convert filename to the file system charset format.
Definition: fil0fil.cc:11981
File space address.
Definition: fil0fil.h:1154
#define my_tolower(s, c)
Definition: m_ctype.h:648
type
Definition: base.h:36
void fil_space_close(space_id_t space_id)
Close each file of a tablespace if open.
Definition: fil0fil.cc:3636
fil_space_t * fil_space_get(space_id_t space_id)
Look up a tablespace.
Definition: fil0fil.cc:2323
uint32_t n_pending_ops
This is positive when we have pending operations against this tablespace.
Definition: fil0fil.h:464
const char * p
Definition: ctype-mb.cc:1235
std::atomic< uint32_t > m_version
All pages in the buffer pool that reference this fil_space_t instance with version before this versio...
Definition: fil0fil.h:359
size_t fil_encryption_rotate()
Rotate the tablespace keys by new master key.
Definition: fil0fil.cc:9528
bool fil_space_exists_in_mem(space_id_t space_id, const char *name, bool print_err, bool adjust_space, mem_heap_t *heap, table_id_t table_id)
Returns true if a matching tablespace exists in the InnoDB tablespace memory cache.
Definition: fil0fil.cc:6503
constexpr page_type_t FIL_PAGE_UNDO_LOG
Undo log page.
Definition: fil0fil.h:1212
UT_LIST_NODE_T(fil_space_t) List_node
Definition: fil0fil.h:221
PageCallback()
Default constructor.
Definition: fil0fil.h:1900
size_t block_size
block size to use for punching holes
Definition: fil0fil.h:207
std::string fil_get_dirs()
Get the list of directories that datafiles can reside in.
Definition: fil0fil.cc:11849
dberr_t fil_ibd_create(space_id_t space_id, const char *name, const char *path, uint32_t flags, page_no_t size)
Create an IBD tablespace file.
Definition: fil0fil.cc:5741
static char * make(const std::string &path_in, const std::string &name_in, ib_file_suffix ext, bool trim=false)
Allocate and build a file name from a path, a table or tablespace name and a suffix.
Definition: fil0fil.cc:4923
@ NONE
No compression.
Definition: file.h:58
File node of a tablespace or the log data space.
Definition: fil0fil.h:146
static bool is_relative_path(const std::string &path)
Determine if a path is a relative path or not.
Definition: fil0fil.h:796
void fil_purge()
Allows fil system to do periodical cleanup.
Definition: fil0fil.cc:12010
const page_size_t fil_space_get_page_size(space_id_t space_id, bool *found)
Returns the page size of the space and whether it is compressed or not.
Definition: fil0fil.cc:3651
static os_file_type_t get_file_type(const std::string &path)
Definition: fil0fil.cc:9656
Definition: trx0trx.h:836
constexpr size_t FIL_IBD_FILE_INITIAL_SIZE
Initial size of a single-table tablespace in pages.
Definition: fil0fil.h:1128
size_t n_pending
count of pending i/o's; is_open must be true if nonzero
Definition: fil0fil.h:186
dberr_t fil_set_compression(space_id_t space_id, const char *algorithm)
Set the compression type for the tablespace.
Definition: fil0fil.cc:9255
size_t len() const
Definition: fil0fil.h:646
constexpr page_type_t FIL_PAGE_TYPE_SYS
System page.
Definition: fil0fil.h:1228
bool is_circular() const
Determine if m_path contains a circular section like "/anydir/../" Fil_path::normalize() must be run ...
Definition: fil0fil.cc:9733
static int flags[50]
Definition: hp_test1.cc:39
const char * filename
Definition: pfs_example_component_population.cc:64
Fil_path MySQL_undo_path
The MySQL server –innodb-undo-directory value.
Definition: fil0fil.cc:280
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB2
Subsequent compressed BLOB page.
Definition: fil0fil.h:1246
ib_file_suffix
Common InnoDB file extentions.
Definition: fil0fil.h:556
size_t magic_n
FIL_NODE_MAGIC_N.
Definition: fil0fil.h:213
#define false
Definition: config_static.h:43
bool stop_ios
true if we want to rename the .ibd file of tablespace and want to stop temporarily posting of new i/o...
Definition: fil0fil.h:408