61#include <unordered_set>
111#define UNDO_INITIAL_SIZE_IN_PAGES \
112 os_offset_t { UNDO_INITIAL_SIZE / srv_page_size }
115#include <unordered_set>
116using Dir_set = std::unordered_set<std::string>;
117extern Dir_set rem_gen_ts_dirs;
118extern bool replay_in_datadir;
125using Filenames = std::vector<std::string, ut::allocator<std::string>>;
126using Space_ids = std::vector<space_id_t, ut::allocator<space_id_t>>;
145 [[nodiscard]]
bool contains(
const std::string &discovered_dir)
const;
148 using Dirs = std::unordered_set<std::string>;
214 ut_a(!other.LRU.prev);
215 ut_a(!other.LRU.next);
216 other.name =
nullptr;
301 [[nodiscard]]
dberr_t write_pages(std::span<const byte *> buffers,
305#ifndef UNIV_HOTBACKUP
344 std::function<
void(
dberr_t)> callback)
const;
360 [[nodiscard]]
bool open();
509 using Files = std::vector<fil_node_t, ut::allocator<fil_node_t>>;
527#ifndef UNIV_HOTBACKUP
599#ifndef UNIV_HOTBACKUP
620 bool &needs_reencryption);
663#ifndef UNIV_HOTBACKUP
892#ifndef UNIV_HOTBACKUP
956#define DOT_IBD dot_ext[IBD]
957#define DOT_CFG dot_ext[CFG]
958#define DOT_CFP dot_ext[CFP]
959#define DOT_IBT dot_ext[IBT]
960#define DOT_IBU dot_ext[IBU]
961#define DOT_DWR dot_ext[DWR]
967#pragma warning(disable : 4351)
1018 [[nodiscard]]
operator const char *()
const {
return m_path.c_str(); }
1025 [[nodiscard]]
const std::string &
path()
const {
return (
m_path); }
1028 [[nodiscard]]
size_t len()
const {
return (
m_path.length()); }
1059 [[nodiscard]]
bool is_same_as(
const std::string &other)
const;
1075 const std::string &second) {
1076 if (first.empty() || second.empty()) {
1081 std::string first_abs = first_path.
abs_path();
1085 std::string second_abs = second_path.
abs_path();
1088 return (first_abs == second_abs);
1094 [[nodiscard]]
static std::pair<std::string, std::string>
split(
1095 const std::string &
path);
1105 [[nodiscard]]
bool is_ancestor(
const std::string &other)
const;
1115 const std::string &second) {
1116 if (first.empty() || second.empty()) {
1131 [[nodiscard]]
bool is_valid()
const;
1155 static bool is_hidden(WIN32_FIND_DATA &dirent);
1164 std::string
path(pathspec);
1168 if (
path.size() >= 2 && ((
path.front() ==
'\'' &&
path.back() ==
'\'') ||
1169 (
path.front() ==
'"' &&
path.back() ==
'"'))) {
1209 if (first_separator == std::string::npos) {
1216 if (first_separator == 0) {
1223 (
path.at(2) ==
'\\' ||
path.at(2) ==
'/')) {
1236 const std::string prefix) {
1237 return (
path.size() >= prefix.size() &&
1245 for (
auto &c :
path) {
1256 for (
auto ptr =
path; *ptr; ++ptr) {
1266 for (
auto &c :
path) {
1299 std::string &ghost);
1311 const auto suffix =
dot_ext[sfx];
1312 size_t len = strlen(suffix);
1323 const auto suffix =
dot_ext[sfx];
1324 size_t len = strlen(suffix);
1371 [[nodiscard]]
static char *
make(
const std::string &path_in,
1372 const std::string &name_in,
1378 [[nodiscard]]
static char *
make_cfg(
const std::string &path_in) {
1379 return (
make(path_in,
"",
CFG));
1385 [[nodiscard]]
static char *
make_cfp(
const std::string &path_in) {
1386 return (
make(path_in,
"",
CFP));
1396 [[nodiscard]]
static char *
make_ibd(
const std::string &path_in,
1397 const std::string &name_in) {
1398 return (
make(path_in, name_in,
IBD));
1406 const std::string &name_in) {
1407 return (
make(
"", name_in,
IBD));
1417 [[nodiscard]]
static std::string
make_new_path(
const std::string &path_in,
1418 const std::string &name_in,
1443#ifndef UNIV_HOTBACKUP
1455 uint32_t fsp_flags,
const std::string &
path);
1463 const std::string &
path);
1535 std::ostream &
print(std::ostream &out)
const {
1536 out <<
"[fil_addr_t: page=" <<
page <<
", boffset=" <<
boffset <<
"]";
1552 return (obj.
print(out));
1707#ifndef UNIV_HOTBACKUP
1844 template <
typename F>
1861#ifndef UNIV_HOTBACKUP
1882void meb_extend_tablespaces_to_stored_len();
1958 const char *old_path,
1959 const char *new_path,
1971 const char *old_path,
1972 const char *new_name,
1973 const char *new_path_in);
2051 const char *space_name,
const char *path_in,
2052 bool strict,
bool old_space);
2064 const char *
name,
bool print_err,
2086 ulint n_to_reserve);
2146 bool evict_after_write,
2216 if (page_type !=
type) {
2229#define fil_block_check_type(block, type, mtr) \
2230 fil_page_check_type(block->page.id, block->frame, type, mtr)
2365 const char *tmp_name);
2372 const char *algorithm);
2414#ifdef UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH
2415void test_make_filepath();
2546 const char *space_name,
const std::string &old_path,
2547 const std::string &new_path,
bool dd_flag_missing);
2561 const space_id_t space_id,
const char *space_name,
const ulint fsp_flags,
2563 std::string &new_path);
2579 const char *old_name,
2580 const char *new_name);
2593 const char *old_name,
2594 const char *new_name);
2606 const byte *encrypt_info,
2608 uint32_t space_flags);
2624#ifndef UNIV_HOTBACKUP
2635 const char *new_path, uint32_t
flags,
mtr_t *mtr);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:49
uint32_t page_no_t
Page number.
Definition: api0api.h:47
byte buf_frame_t
A buffer frame.
Definition: buf0types.h:62
Real paths of dirs directly under the MySQL datadir (symlinks resolved)
Definition: fil0fil.h:135
std::unordered_set< std::string > Dirs
Definition: fil0fil.h:148
static Dirs_in_datadir make()
Build the set of dirs directly under the MySQL datadir.
Definition: fil0fil.cc:9108
Dirs m_dirs
Normalized paths of all dirs directly under the MySQL datadir.
Definition: fil0fil.h:151
bool contains(const std::string &discovered_dir) const
Check whether a dir path matches with one of the dirs directly under the MySQL datadir.
Definition: fil0fil.cc:9131
Type
Algorithm types supported.
Definition: os0enc.h:57
Progress
Encryption progress type.
Definition: os0enc.h:80
Iterate over the files in all the tablespaces.
Definition: fil0fil.h:1838
std::function< dberr_t(fil_node_t *)> Function
Definition: fil0fil.h:1840
static dberr_t iterate(Function &&f)
Iterate through all persistent tablespace files (FIL_TYPE_TABLESPACE) returning the nodes via callbac...
Definition: fil0fil.cc:3645
static dberr_t for_each_file(F &&f)
For each data file.
Definition: fil0fil.h:1845
Wrapper for a path to a directory that may or may not exist.
Definition: fil0fil.h:971
bool is_ancestor(const Fil_path &other) const
Check if m_path is the parent of the other path.
Definition: fil0fil.cc:8475
size_t abs_len() const
Definition: fil0fil.h:1044
static void convert_to_filename_charset(std::string &name)
Convert filename to the file system charset format.
Definition: fil0fil.cc:10118
static bool is_same_as(const std::string &first, const std::string &second)
Check if two path strings are equal.
Definition: fil0fil.h:1074
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:1405
path_type
Various types of file paths.
Definition: fil0fil.h:992
@ absolute
Definition: fil0fil.h:992
@ invalid
Definition: fil0fil.h:992
@ relative
Definition: fil0fil.h:992
@ file_name_only
Definition: fil0fil.h:992
bool operator==(const Fil_path &other) const
Determine if this path is equal to the other path.
Definition: fil0fil.h:1049
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:4573
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:1114
static char * make_cfp(const std::string &path_in)
Allocate and build a CFP file name from a path.
Definition: fil0fil.h:1385
static constexpr auto SEPARATOR
Directory separators that are supported.
Definition: fil0fil.h:980
static constexpr auto DOT_SLASH
Definition: fil0fil.h:986
std::string m_path
Path to a file or directory.
Definition: fil0fil.h:1477
const char * operator()() const
Explicit type conversion.
Definition: fil0fil.h:1022
bool is_dir_same_as(const Fil_path &other) const
Check if the directory to path is same as directory as the other path.
Definition: fil0fil.cc:8465
static bool is_relative_path(const std::string &path)
Determine if a path is a relative path or not.
Definition: fil0fil.h:1181
static bool is_absolute_path(const std::string &path)
Determine if a path is an absolute path or not.
Definition: fil0fil.h:1194
static void convert_to_lower_case(std::string &path)
Convert to lower case using the file system charset.
Definition: fil0fil.cc:10135
static std::string get_basename(const std::string &filepath)
Get the basename of the file path.
Definition: fil0fil.cc:4045
bool is_same_as(const Fil_path &other) const
Check if m_path is the same as this other path.
Definition: fil0fil.cc:8435
const std::string abs_path() const
Return the absolute path by value.
Definition: fil0fil.h:1035
bool is_valid() const
This validation is only for ':'.
Definition: fil0fil.cc:8543
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:4685
std::string m_abs_path
A full absolute path to the same file.
Definition: fil0fil.h:1480
static bool is_separator(char c)
Check if a character is a path separator ('\' or '/')
Definition: fil0fil.h:1338
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:1355
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:10055
static constexpr auto SLASH_DOT_DOT_SLASH
Definition: fil0fil.h:988
static std::pair< std::string, std::string > split(const std::string &path)
Splits the path into directory and file name parts.
Definition: fil0fil.cc:8469
size_t len() const
Definition: fil0fil.h:1028
static char * make_cfg(const std::string &path_in)
Allocate and build a CFG file name from a path.
Definition: fil0fil.h:1378
static std::string remove_quotes(const char *pathspec)
Remove quotes e.g., 'a;b' or "a;b" -> a;b.
Definition: fil0fil.h:1163
Fil_path get_abs_directory() const
Get the absolute directory of this path.
Definition: fil0fil.cc:8459
static constexpr auto OS_SEPARATOR
OS specific path separator.
Definition: fil0fil.h:977
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:10011
static bool is_undo_tablespace_name(const std::string &name)
Check if the name is an undo tablespace name.
Definition: fil0fil.cc:2026
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:1396
const std::string & path() const
Definition: fil0fil.h:1025
bool is_circular() const
Determine if m_path contains a circular section like "/anydir/../" Fil_path::normalize() must be run ...
Definition: fil0fil.cc:8567
bool is_directory_and_exists() const
Definition: fil0fil.cc:8537
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:3937
static bool is_hidden(std::string path)
Determine if the file or directory is considered HIDDEN.
Definition: fil0fil.cc:8506
bool is_absolute_path() const
Definition: fil0fil.h:1186
static constexpr auto DB_SEPARATOR
schema '/' table separator
Definition: fil0fil.h:974
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:4724
static void normalize(char *path)
Normalize a directory path for the current OS: On Windows, we convert '/' to '\', else we convert '\'...
Definition: fil0fil.h:1255
Fil_path()
Default constructor.
Definition: fil0fil.cc:8432
static os_file_type_t get_file_type(const std::string &path)
Definition: fil0fil.cc:8532
static bool truncate_suffix(ib_file_suffix sfx, std::string &path)
Check if the file has the specified suffix and truncate.
Definition: fil0fil.h:1322
static void to_lower(std::string &path)
Convert a path string to lower case using the CHARSET my_charset_filename.
Definition: fil0fil.h:1265
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:4653
static path_type type_of_path(const std::string &path)
Determine what type of path is provided.
Definition: fil0fil.h:1202
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:1244
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:3907
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:1343
static constexpr auto DOT_DOT_SLASH
Definition: fil0fil.h:987
static bool has_prefix(const std::string &path, const std::string prefix)
Definition: fil0fil.h:1235
static bool has_suffix(ib_file_suffix sfx, const std::string &path)
Check if the file has the specified suffix.
Definition: fil0fil.h:1310
Definition: fil0fil.cc:402
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:283
Types for AIO operations.
Definition: os0file.h:262
Type
Flags that can be used to specify the IORequest mode and additional options, to be used as bitmask ty...
Definition: os0file.h:266
A RAII wrapper for os_event_t.
Definition: os0event.h:137
Definition: buf0buf.h:1156
Node of a tablespace encapsulating handle required for any IO operations on this node.
Definition: fil0fil.h:177
static dberr_t map_status_io_to_db_err(ib::fil::Tablespace_node_handle_interface::Status_IO err)
Map error code returned from read/write APIs to dberr_t code.
Definition: fil0fil.cc:1648
bool m_punch_hole
whether the file system of this node supports PUNCH HOLE
Definition: fil0fil.h:484
fil_node_t(fil_space_t *space, const char *name, uint32_t node_order, bool is_raw, page_no_t size_in_pages, page_no_t max_pages, uint32_t block_size)
Definition: fil0fil.h:179
fil_space_t *const space
tablespace containing this node
Definition: fil0fil.h:394
void pretend_is_flushed()
Sets node to flushed state without actually flushing it.
Definition: fil0fil.cc:1448
size_t get_block_size() const
Definition: fil0fil.h:386
size_t n_pending_ios
count of pending I/O's; is_open must be true if nonzero
Definition: fil0fil.h:426
void increment_modification_counter()
Increment modification counter for this node.
Definition: fil0fil.cc:1454
void wait_for_current_flush_to_finish(class Fil_shard &shard, modification_counter_t flush_upto)
Waits for the current flush (if any) to finish, unless the file is already flushed up to flush_upto.
Definition: fil0fil.cc:1485
bool is_flush_needed() const
Determine if flush is needed for the node.
Definition: fil0fil.cc:1481
~fil_node_t()
Definition: fil0fil.h:219
bool needs_flushes_for_durability() const
Definition: fil0fil.h:255
modification_counter_t m_modification_counter
number of writes to the node since the system was started
Definition: fil0fil.h:472
const size_t m_order
Number of the file in the tablespace's nodes list.
Definition: fil0fil.h:400
bool get_punch_hole() const
Check if punch_hole is supported by storage.
Definition: fil0fil.h:390
page_no_t get_cached_size_in_pages() const
Definition: fil0fil.h:406
page_no_t init_size
initial size of the node in database pages; FIL_IBD_FILE_INITIAL_SIZE by default
Definition: fil0fil.h:420
void set_punch_hole(bool value)
Definition: fil0fil.h:391
bool m_is_open
whether this node is open.
Definition: fil0fil.h:469
bool is_flushed() const
Returns true if the node is fully flushed, that is it is flushed up to the modification_counter.
Definition: fil0fil.cc:1443
fil_node_t(fil_node_t &&other)
Definition: fil0fil.h:192
size_t m_n_threads_waiting_for_flush
number of threads waiting for chance to flush
Definition: fil0fil.h:478
bool truncate(page_no_t new_size_in_pages)
Truncates the node.
Definition: fil0fil.cc:1604
modification_counter_t m_flush_counter
the m_modification_counter of the latest flush to disk
Definition: fil0fil.h:475
bool m_is_being_flushed
Set to true when the node is being flushed.
Definition: fil0fil.h:429
Os_event_t m_flush_finished_event
event that groups and serializes calls to fsync
Definition: fil0fil.h:466
void flush(class Fil_shard &shard)
Assures the node will be flushed at least to m_modification_counter.
Definition: fil0fil.cc:1518
const size_t magic_n
FIL_NODE_MAGIC_N.
Definition: fil0fil.h:438
page_no_t m_cached_size_in_pages
Size of the node in physical pages, excluding any partial last page.
Definition: fil0fil.h:502
const page_no_t m_max_size_in_pages
maximum size of the node in database pages
Definition: fil0fil.h:423
const bool is_raw_disk
whether the node actually is a raw device or disk partition
Definition: fil0fil.h:403
page_no_t flush_size
Size of the node when last flushed, used to force the flush when node grows to keep the filesystem me...
Definition: fil0fil.h:416
const size_t m_block_size
block size to use for punching holes
Definition: fil0fil.h:481
bool can_be_closed() const
Returns true if the node can be closed.
Definition: fil0fil.cc:1422
dberr_t fill_range_with_zeros(page_no_t first_page, page_no_t number_of_pages)
Makes the number_of_pages pages, starting with page number first_page contain all zeros.
Definition: fil0fil.cc:1626
dberr_t post_io_async(IORequest &type, byte *buf, size_t buffer_len, page_no_t page_no, std::function< void(dberr_t)> callback) const
Posts an asynchronous READ or WRITE IO operation on the node.
Definition: fil0fil.cc:1708
bool is_open() const
Returns true iff the node is currently opened and allows IO operations.
Definition: fil0fil.h:348
UT_LIST_NODE_T(fil_node_t) List_node
Definition: fil0fil.h:382
void set_cached_node_size(size_t new_pages_count_to_cache)
In addition to updating.
Definition: fil0fil.cc:1742
void close()
Closes the node, the IO operations will not be permitted.
Definition: fil0fil.cc:1736
void wait_for_all_flushes_to_finish(class Fil_shard &shard)
Waits for any pending flushes.
Definition: fil0fil.cc:1500
bool open()
Opens the node for incoming IO operations.
Definition: fil0fil.cc:1589
bool is_read_only() const
Must the node be opened only for read only mode? Files can be opened for read and write,...
Definition: fil0fil.cc:1585
int64_t modification_counter_t
Definition: fil0fil.h:224
dberr_t post_io_sync(IORequest &type, byte *buf, size_t buffer_len, page_no_t page_no) const
Posts a synchronous READ or WRITE IO operation on the node.
Definition: fil0fil.cc:1676
ut::unique_ptr< ib::fil::Tablespace_node_handle_interface > m_handle
file handle (not null iff is_open)
Definition: fil0fil.h:463
List_node LRU
link to the fil_system->LRU list (keeping track of open files)
Definition: fil0fil.h:435
char * name
file name; protected by Fil_shard::m_mutex and log_sys->mutex.
Definition: fil0fil.h:397
bool is_being_extended
Set to true when a node is being extended.
Definition: fil0fil.h:432
Tablespace or log data space.
Definition: fil0fil.h:506
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:8698
ib::Timer m_last_extended
When the tablespace was extended last.
Definition: fil0fil.h:646
size_t get_reference_count() const
Definition: fil0fil.cc:10324
space_id_t id
Tablespace ID.
Definition: fil0fil.h:660
bool is_compressed() const noexcept
Check if the tablespace is compressed.
Definition: fil0fil.h:924
Encryption::Progress encryption_op_in_progress
Encryption is in progress.
Definition: fil0fil.h:911
void set_cached_fsp_size_in_header(page_no_t new_size)
Definition: fil0fil.cc:2287
std::atomic_bool m_deleted
true if the tablespace is marked for deletion.
Definition: fil0fil.h:739
void bump_version()
Bumps the space object version and cause all pages in buffer pool that reference the current space ob...
Definition: fil0fil.cc:10346
List_node unflushed_spaces
List of spaces with at least one unflushed file we have written to.
Definition: fil0fil.h:899
dberr_t validate_to_dd(bool validate, bool old_space, bool &needs_reencryption)
Checks if the space has encryption flag enabled in the tablespace flags or validate is true.
Definition: fil0fil.cc:2353
page_no_t get_max_size_in_pages() const
Definition: fil0fil.cc:10387
rw_lock_t latch
Latch protecting the file space storage allocation.
Definition: fil0fil.h:894
bool m_validated
Definition: fil0fil.h:851
ib::Throttler m_prevent_file_open_wait_message_throttler
Throttles writing to log a message about long waiting for file to perform rename.
Definition: fil0fil.h:780
uint32_t flags
Tablespace flags; see fsp_flags_is_valid() and page_size_t(ulint) (constructor).
Definition: fil0fil.h:876
uint32_t get_cached_fsp_free_len() const
Length of the FSP_FREE list.
Definition: fil0fil.cc:2293
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:695
Encryption_metadata m_encryption_metadata
Encryption metadata.
Definition: fil0fil.h:908
bool prevent_file_open
true if we want to rename the .ibd file of tablespace and want to temporarily prevent other threads f...
Definition: fil0fil.h:776
page_no_t m_undo_extend
Extend undo tablespaces by so many pages.
Definition: fil0fil.h:649
uint64_t autoextend_size_in_bytes
Autoextend size.
Definition: fil0fil.h:871
dberr_t validate_first_page()
Assures the FSP header of the tablespace is correct and fills the FSP-related data cache.
Definition: fil0fil.cc:2455
fil_space_t()
Definition: fil0fil.cc:10241
void declare_first_page_valid()
Sets the validation flag to true.
Definition: fil0fil.h:636
lsn_t m_header_page_flush_lsn
Flush lsn of header page.
Definition: fil0fil.h:914
uint64_t get_auto_extend_size() const
Definition: fil0fil.cc:10395
void dec_ref() noexcept
Decrement the page reference count.
Definition: fil0fil.h:564
std::atomic_size_t m_n_ref_count
Number of buf_page_t entries that point to this instance.
Definition: fil0fil.h:735
page_no_t m_size_in_pages
Tablespace file size in pages; 0 if not known yet.
Definition: fil0fil.h:805
std::atomic< uint64_t > m_bulk_extend_size
true if bulk operation is in progress.
Definition: fil0fil.h:745
Files files
Files attached to this tablespace.
Definition: fil0fil.h:802
bool is_fsp_cache_valid() const
Returns true if the FSP-related cache is already filled in and valid.
Definition: fil0fil.cc:2268
bool stop_new_ops
We set this true when we start deleting a single-table tablespace.
Definition: fil0fil.h:789
ulint magic_n
FIL_SPACE_MAGIC_N.
Definition: fil0fil.h:917
bool initialize_while_extending() const
Definition: fil0fil.cc:10405
uint32_t n_reserved_extents
Number of reserved free extents for ongoing operations like B-tree page split.
Definition: fil0fil.h:880
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:937
ut::Expected< ut::unique_ptr_aligned< byte[]> > read_page_direct(page_no_t page_no) const
Reads the specified page directly from the disk, without using fil_io or Buffer Pool caching.
Definition: fil0fil.cc:2323
uint32_t get_current_version() const
Returns current version of the space object.
Definition: fil0fil.cc:10304
bool is_encrypted() const noexcept
Check if the tablespace is encrypted.
Definition: fil0fil.h:930
static fil_space_t * s_sys_space
System tablespace.
Definition: fil0fil.h:920
void dec_cached_fsp_free_len()
Definition: fil0fil.cc:2308
uint32_t n_pending_ops
This is positive when we have pending operations against this tablespace.
Definition: fil0fil.h:890
std::atomic_bool m_is_bulk
true if bulk operation is in progress.
Definition: fil0fil.h:742
UT_LIST_NODE_T(fil_space_t) List_node
Definition: fil0fil.h:508
~fil_space_t()
Definition: fil0fil.cc:10245
void ensure_fsp_cache_valid()
Ensures the FSP-related cache is filled in and valid upon this call return.
Definition: fil0fil.cc:2272
uint32_t get_recent_version() const
Returns current version of the space object.
Definition: fil0fil.cc:10308
char * name
Tablespace name.
Definition: fil0fil.h:657
bool is_validated() const
Returns true iff the tablespace was already validated by checking the content of the first page.
Definition: fil0fil.h:640
std::vector< Observer *, ut::allocator< Observer * > > Flush_observers
Definition: fil0fil.h:643
void end_bulk_operation()
End bulk operation on the space.
Definition: fil0fil.h:756
Compression::Type compression_type
Compression algorithm.
Definition: fil0fil.h:905
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:884
fil_type_t purpose
Purpose.
Definition: fil0fil.h:798
void set_deleted()
Marks the space object for deletion.
Definition: fil0fil.cc:10332
page_no_t get_cached_fsp_size_in_header() const
Definition: fil0fil.cc:2282
struct fil_space_t::fsp_cache m_fsp_cache
page_no_t get_cached_fsp_free_limit() const
Contents of FSP_FREE_LIMIT.
Definition: fil0fil.cc:2313
void inc_cached_fsp_free_len(uint32_t delta)
Definition: fil0fil.cc:2303
bool was_not_deleted() const
Definition: fil0fil.cc:10296
bool is_in_unflushed_spaces
true if this space is currently in unflushed_spaces
Definition: fil0fil.h:902
void set_cached_fsp_free_len(uint32_t new_free_len)
Definition: fil0fil.cc:2298
bool has_no_references() const
Definition: fil0fil.cc:10314
bool is_bulk_operation_in_progress() const
Definition: fil0fil.h:759
page_no_t m_undo_initial
When an undo tablespace has been initialized with required header pages, that size is recorded here.
Definition: fil0fil.h:654
std::vector< fil_node_t, ut::allocator< fil_node_t > > Files
Definition: fil0fil.h:509
void set_cached_fsp_free_limit(page_no_t new_free_limit)
Definition: fil0fil.cc:2318
void begin_bulk_operation(uint64_t extend_size)
Begin bulk operation on the space.
Definition: fil0fil.h:750
void inc_ref() noexcept
Increment the page reference count.
Definition: fil0fil.h:553
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:794
bool is_deleted() const
Definition: fil0fil.cc:10291
fil_node_t * get_node_for_page_no(page_no_t &page_no) noexcept
Get the file node corresponding to the given page number of the tablespace.
Definition: fil0fil.cc:10269
void fill_fsp_cache(const byte *first_page)
Fills the cache of the FSP-related data that is stored in the first page of the tablespace header.
Definition: fil0fil.cc:2584
Allows to monitor an event processing times, allowing to throttle the processing to one per throttle_...
Definition: ut0ut.h:365
For measuring time elapsed.
Definition: ut0ut.h:303
Status_IO
Definition: fil0tablespace_node_handle_interface.h:79
Page identifier.
Definition: buf0types.h:191
Page size descriptor.
Definition: page0size.h:50
C++23 std::expected.
Definition: ut0expected.h:74
const char * p
Definition: ctype-mb.cc:1227
int page
Definition: ctype-mb.cc:1226
dberr_t
Definition: db0err.h:39
Data dictionary global types.
static duk_ret_t normalize_path(duk_context *ctx, duk_idx_t obj_idx)
Definition: duk_module_shim.cc:76
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:92
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.
constexpr page_type_t FIL_PAGE_TYPE_LOB_FIRST
The first page of an uncompressed LOB.
Definition: fil0fil.h:1645
void fil_purge()
Allows fil system to do periodical cleanup.
Definition: fil0fil.cc:10147
bool fil_is_page_type_valid(page_type_t type) noexcept
Check if the given page type is valid.
Definition: fil0fil.cc:10198
constexpr page_type_t FIL_PAGE_UNDO_LOG
Undo log page.
Definition: fil0fil.h:1574
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:3139
std::ostream & operator<<(std::ostream &out, const fil_addr_t &obj)
Definition: fil0fil.h:1551
constexpr page_type_t FIL_PAGE_TYPE_LOB_INDEX
Index pages of uncompressed LOB.
Definition: fil0fil.h:1639
constexpr page_type_t FIL_PAGE_ENCRYPTED_RTREE
Encrypted R-tree page.
Definition: fil0fil.h:1624
bool fil_validate()
Checks the consistency of the tablespace cache.
Definition: fil0fil.cc:1837
constexpr page_type_t FIL_PAGE_TYPE_LOB_DATA
Data pages of uncompressed LOB.
Definition: fil0fil.h:1642
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB
First compressed BLOB page.
Definition: fil0fil.h:1605
uint32_t fil_space_get_flags(space_id_t space_id)
Returns the flags of the space.
Definition: fil0fil.cc:3274
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:6910
dberr_t fil_set_compression(space_id_t space_id, const char *algorithm)
Set the compression type for the tablespace.
Definition: fil0fil.cc:8111
page_no_t fil_page_get_prev(const byte *page)
Get the predecessor of a file page.
Definition: fil0fil.cc:7493
Fil_path MySQL_undo_path
The MySQL server –innodb-undo-directory value.
Definition: fil0fil.cc:287
bool fil_page_index_page_check(const byte *page)
Check whether the page is index page (either regular Btree index or Rtree index.
Definition: fil0fil.h:1682
rw_lock_t * fil_space_get_latch(space_id_t space_id)
Returns the latch of a file space.
Definition: fil0fil.cc:2141
ulint fil_space_get_n_reserved_extents(space_id_t space_id)
Gets the number of reserved extents.
Definition: fil0fil.cc:6753
ulong srv_fast_shutdown
The value of the configuration parameter innodb_fast_shutdown, controlling the InnoDB shutdown.
Definition: srv0srv.cc:558
constexpr size_t FIL_NODE_MAGIC_N
Value of fil_node_t::magic_n.
Definition: fil0fil.h:132
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:73
constexpr page_type_t FIL_PAGE_COMPRESSED_AND_ENCRYPTED
Compressed and Encrypted page.
Definition: fil0fil.h:1621
uint16_t page_type_t
Definition: fil0fil.h:1558
page_no_t fil_space_get_undo_initial_size(space_id_t space_id)
Returns the size of an undo space just after it was initialized.
Definition: fil0fil.cc:3238
fil_type_t fil_space_get_type(space_id_t space_id)
Gets the type of a file space.
Definition: fil0fil.cc:2158
void fil_space_inc_redo_skipped_count(space_id_t space_id)
Increase redo skipped count for a tablespace.
Definition: fil0fil.cc:4396
void fil_space_set_flags(fil_space_t *space, uint32_t flags)
Sets the flags of the tablespace.
Definition: fil0fil.cc:8601
dberr_t fil_tablespace_open_for_recovery(space_id_t space_id)
Open the tablespace and also get the tablespace filenames, space_id must already be known.
Definition: fil0fil.cc:9185
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:1499
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:6144
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY
Index pages of fragment pages (compressed LOB).
Definition: fil0fil.h:1661
std::string fil_path_to_space_name(const std::string &file_path, space_id_t space_id, uint32_t flags)
Convert a file path to a tablespace name, based on space ID and its flags.
Definition: fil0fil.cc:5460
dberr_t fil_close_tablespace(space_id_t space_id)
Closes a single-table tablespace.
Definition: fil0fil.cc:4057
bool fil_op_replay_rename_for_ddl(space_id_t space_id, const char *old_name, const char *new_name)
Replay a file rename operation for ddl replay.
Definition: fil0fil.cc:9009
const byte * fil_tablespace_redo_extend(const byte *ptr, const byte *end, space_id_t space_id, bool parse_only)
Redo a tablespace extend.
Definition: fil0fil.cc:9612
constexpr page_type_t FIL_PAGE_INODE
Index node.
Definition: fil0fil.h:1577
constexpr page_type_t FIL_PAGE_TYPE_UNUSED
This page type is unused.
Definition: fil0fil.h:1571
constexpr page_type_t FIL_PAGE_INDEX
File page types (values of FIL_PAGE_TYPE)
Definition: fil0fil.h:1562
std::atomic_size_t fil_n_files_open
Number of files currently open.
Definition: fil0fil.cc:300
bool MySQL_undo_path_is_unique
The undo path is different from any other known directory.
Definition: fil0fil.cc:290
void fil_space_dec_redo_skipped_count(space_id_t space_id)
Decrease redo skipped count for a tablespace.
Definition: fil0fil.cc:4412
constexpr page_type_t FIL_PAGE_RTREE
R-tree node.
Definition: fil0fil.h:1565
constexpr size_t FIL_IBD_FILE_INITIAL_SIZE
Initial size of a single-table tablespace in pages.
Definition: fil0fil.h:1493
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:97
dberr_t fil_write_initial_pages(pfs_os_file_t file, const char *path, const byte *encrypt_info, space_id_t space_id, uint32_t space_flags)
Write initial pages for a new tablespace file created.
Definition: fil0fil.cc:5094
bool fil_space_exists_in_mem(space_id_t space_id, const char *name, bool print_err, bool adjust_space)
Returns true if a matching tablespace exists in the InnoDB tablespace memory cache.
Definition: fil0fil.cc:5926
const byte * fil_tablespace_redo_extend_wrapper(const byte *ptr, const byte *end, space_id_t space_id)
TODO: This is a wrapper for fil_tablespace_redo_extend to be called during recovery,...
Definition: fil0fil.cc:9550
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:8198
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:5088
constexpr size_t FIL_IBT_FILE_INITIAL_SIZE
Definition: fil0fil.h:1494
void fil_space_update_name(fil_space_t *space, const char *name)
Update the tablespace name.
Definition: fil0fil.cc:9996
bool fil_open_files_limit_update(size_t &new_max_open_files)
Changes the maximum opened files limit.
Definition: fil0fil.cc:3392
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1502
constexpr size_t FIL_SPACE_MAGIC_N
Value of fil_space_t::magic_n.
Definition: fil0fil.h:129
void fil_node_create(const char *name, fil_space_t *space, bool is_raw, page_no_t max_pages)
Attach a node to a tablespace.
Definition: fil0fil.cc:2261
const byte * fil_tablespace_redo_delete_wrapper(const byte *ptr, const byte *end, space_id_t space_id)
TODO: This is a wrapper for fil_tablespace_redo_delete to be called during recovery,...
Definition: fil0fil.cc:9730
dberr_t fil_reset_encryption(space_id_t space_id)
Reset the encryption type for the tablespace.
Definition: fil0fil.cc:8227
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:140
void fil_space_close(space_id_t space_id)
Close each file of a tablespace if open.
Definition: fil0fil.cc:3329
fil_space_t * fil_space_acquire(space_id_t space_id)
Acquire a tablespace when it could be dropped concurrently.
Definition: fil0fil.cc:3755
fil_space_t * fil_space_acquire_silent(space_id_t space_id)
Acquire a tablespace that may not exist.
Definition: fil0fil.cc:3764
Fil_state
Result of comparing a path.
Definition: fil0fil.h:155
@ MATCHES
The path matches what was found during the scan.
@ MISSING
No MLOG_FILE_DELETE record and the file could not be found.
@ MOVED
Space ID matches but the paths don't match.
@ MOVED_PREV
Space ID and paths match but dd_table data dir flag is false despite the file being outside default d...
@ COMPARE_ERROR
In case of error during comparison.
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, bool dd_flag_missing)
Add tablespace to the set of tablespaces to be updated in DD.
Definition: fil0fil.cc:9362
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:3660
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:3206
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FRAG
Fragment pages of compressed LOB.
Definition: fil0fil.h:1658
const byte * fil_tablespace_redo_create_wrapper(const byte *ptr, const byte *end, space_id_t space_id)
TODO: This is a wrapper for fil_tablespace_redo_create to be called during recovery,...
Definition: fil0fil.cc:9371
constexpr page_type_t FIL_PAGE_TYPE_LAST
Note the highest valid non-index page_type_t.
Definition: fil0fil.h:1664
dberr_t fil_delete_tablespace(space_id_t space_id)
Deletes an IBD or IBU tablespace.
Definition: fil0fil.cc:4316
fil_addr_t fil_addr_null
The null file address.
Definition: fil0fil.cc:334
void fil_close_all_files()
Closes all open files.
Definition: fil0fil.cc:3599
void fil_init(ulint max_n_open)
Initializes the tablespace memory cache.
Definition: fil0fil.cc:3359
size_t fil_encryption_rotate()
Rotate the tablespace keys by new master key.
Definition: fil0fil.cc:8385
bool fil_page_type_is_index(page_type_t page_type)
Check whether the page type is index (Btree or Rtree or SDI) type.
Definition: fil0fil.h:1667
ut::Expected< fil_space_t * > fil_space_open(space_id_t space_id)
Looks up the tablespace, acquires the space, opens each node of a tablespace if not already open,...
Definition: fil0fil.cc:3315
fil_space_t * fil_space_get_sys_space()
Definition: fil0fil.h:2419
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:3344
byte fil_faddr_t
'type' definition in C: an address stored in a file page is a string of bytes
Definition: fil0fil.h:1510
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:4748
void fil_space_release(fil_space_t *space)
Release a tablespace acquired with fil_space_acquire().
Definition: fil0fil.cc:3770
bool fil_truncate_tablespace(space_id_t space_id, page_no_t size_in_pages)
Basically recreates the tablespace`s only node and set it to the needed size in place.
Definition: fil0fil.cc:4387
void fil_close()
Initializes the tablespace memory cache.
Definition: fil0fil.cc:7527
const char * fil_get_page_type_str(page_type_t type) noexcept
Get the page type as a string.
Definition: fil0fil.cc:10159
void fil_flush_file_spaces()
Flush to disk the writes in file spaces possibly cached by the OS (note: spaces of type FIL_TYPE_TEMP...
Definition: fil0fil.cc:7481
std::vector< std::string, ut::allocator< std::string > > Filenames
Definition: fil0fil.h:125
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:6701
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 *path_in, bool strict, bool old_space)
Open a single-table tablespace and optionally do some validation such as checking that the space id i...
Definition: fil0fil.cc:5343
page_no_t fil_page_get_next(const byte *page)
Get the successor of a file page.
Definition: fil0fil.cc:7500
const byte * fil_tablespace_redo_rename(const byte *ptr, const byte *end, space_id_t space_id, bool parse_only)
Redo a tablespace rename.
Definition: fil0fil.cc:9501
constexpr size_t FIL_SCAN_THREADS_PER_CORE
Number of threads per core.
Definition: fil0fil.h:81
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_DATA
Data pages of compressed LOB.
Definition: fil0fil.h:1651
constexpr page_type_t FIL_PAGE_TYPE_XDES
Extent descriptor page.
Definition: fil0fil.h:1599
void fil_space_set_undo_size(space_id_t space_id, bool use_current)
This is called for an undo tablespace after it has been initialized or opened.
Definition: fil0fil.cc:3253
constexpr page_type_t FIL_PAGE_COMPRESSED
Compressed page.
Definition: fil0fil.h:1615
std::vector< space_id_t, ut::allocator< space_id_t > > Space_ids
Definition: fil0fil.h:126
std::atomic< std::uint64_t > fil_n_pending_tablespace_flushes
Number of pending tablespace flushes.
Definition: fil0fil.cc:297
constexpr page_type_t FIL_PAGE_SDI
Tablespace SDI Index page.
Definition: fil0fil.h:1568
bool fil_tablespace_lookup_for_recovery(space_id_t space_id)
Lookup the tablespace ID.
Definition: fil0fil.cc:9137
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:5023
dberr_t fil_tablespace_iterate(const Encryption_metadata &encryption_metadata, 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:7828
void fil_space_set_imported(space_id_t space_id)
Note that a tablespace has been imported.
Definition: fil0fil.cc:2172
void fil_op_write_log(mlog_id_t type, space_id_t space_id, const char *path, const char *new_path, uint32_t flags, mtr_t *mtr)
Write a log record about an operation on a tablespace file.
Definition: fil0fil.cc:4115
constexpr size_t FIL_SCAN_MAX_THREADS
Maximum number of threads that will be used for scanning the tablespace files.
Definition: fil0fil.h:78
constexpr uint32_t UNDO_INITIAL_SIZE
Initial size of an UNDO tablespace when it is created new or truncated under low load.
Definition: fil0fil.h:110
void fil_extend_tablespaces_to_stored_len()
Extends all tablespaces to the size stored in the space header.
void fil_space_release_free_extents(space_id_t space_id, ulint n_reserved)
Releases free extents in a file space.
Definition: fil0fil.cc:6727
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB2
Subsequent compressed BLOB page.
Definition: fil0fil.h:1608
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:1612
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FIRST
The first page of a compressed LOB.
Definition: fil0fil.h:1648
dberr_t fil_io(IORequest::Type type, bool sync, const page_id_t &page_id, const page_size_t &page_size, ulint len, byte *buf, buf_page_t *bpage, bool evict_after_write, std::function< void(dberr_t err)> pre_io_complete_callback=[](dberr_t) {})
Read or write data for a single page from a file.
Definition: fil0fil.cc:7277
fil_space_t * fil_space_get(space_id_t space_id)
Look up a tablespace.
Definition: fil0fil.cc:2124
constexpr page_type_t FIL_PAGE_TYPE_ALLOCATED
Freshly allocated page.
Definition: fil0fil.h:1584
constexpr page_type_t FIL_PAGE_TYPE_LEGACY_DBLWR
Legacy doublewrite buffer page.
Definition: fil0fil.h:1633
constexpr page_type_t FIL_PAGE_IBUF_FREE_LIST
Insert buffer free list.
Definition: fil0fil.h:1580
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:3650
volatile bool recv_recovery_on
true when applying redo log records during crash recovery; false otherwise.
Definition: log0recv.cc:108
constexpr page_type_t FIL_PAGE_SDI_ZBLOB
Compressed SDI BLOB page.
Definition: fil0fil.h:1630
constexpr page_type_t FIL_PAGE_TYPE_TRX_SYS
Transaction system data.
Definition: fil0fil.h:1593
Fil_state fil_tablespace_dir_equals(const space_id_t space_id, const char *space_name, const ulint fsp_flags, const Dirs_in_datadir &dirs_in_datadir, const std::string old_path, std::string &new_path)
Lookups the tablespace ID in the scanned tablespaces and return its path to the file.
Definition: fil0fil.cc:9189
std::optional< bool > fil_tablespace_redo_encryption(const byte *ptr, const byte *end, space_id_t space_id, lsn_t lsn)
Parse and process an encryption redo record.
Definition: fil0fil.cc:9798
page_type_t fil_page_get_type(const byte *page)
Get the file page type.
Definition: fil0fil.h:1675
constexpr page_type_t FIL_PAGE_ENCRYPTED
Encrypted page.
Definition: fil0fil.h:1618
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:8178
page_no_t fil_space_get_size(space_id_t space_id)
Returns the size of the space in pages.
Definition: fil0fil.cc:3225
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:5324
Compression::Type fil_get_compression(space_id_t space_id)
Get the compression algorithm for a tablespace.
Definition: fil0fil.cc:8168
space_id_t fil_space_get_id_by_name(const char *name)
Returns the space ID based on the tablespace name.
Definition: fil0fil.cc:5939
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:3202
void fil_aio_wait(ulint segment)
Waits for an AIO operation to complete.
Definition: fil0fil.cc:7254
Fil_path MySQL_datadir_path
The MySQL server –datadir value.
Definition: fil0fil.cc:284
void fil_encryption_reencrypt(const std::vector< space_id_t > &sid_vector)
Re-encrypt the tablespace keys by current master key.
Definition: fil0fil.cc:8387
constexpr page_type_t FIL_PAGE_TYPE_SYS
System page.
Definition: fil0fil.h:1590
bool fil_space_is_redo_skipped(space_id_t space_id)
Check whether a single-table tablespace is redo skipped.
Definition: fil0fil.cc:4430
const byte * fil_tablespace_redo_create(const byte *ptr, const byte *end, space_id_t space_id, bool parse_only)
Redo a tablespace create.
Definition: fil0fil.cc:9460
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:7519
bool fil_space_read_name_and_filepath(space_id_t space_id, std::string &name, std::string &filepath)
Looks for a pre-existing fil_space_t with the given tablespace ID and, if found, returns the name and...
Definition: fil0fil.cc:5441
constexpr page_type_t FIL_PAGE_SDI_BLOB
Uncompressed SDI BLOB page.
Definition: fil0fil.h:1627
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:8021
constexpr page_type_t FIL_PAGE_TYPE_BLOB
Uncompressed BLOB page.
Definition: fil0fil.h:1602
bool fil_addr_is_null(const fil_addr_t &addr)
Returns true if file address is undefined.
Definition: fil0fil.cc:7486
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_INDEX
Index pages of compressed LOB.
Definition: fil0fil.h:1655
void fil_page_set_type(byte *page, ulint type)
Sets the file page type.
Definition: fil0fil.cc:7507
dberr_t fil_discard_tablespace(space_id_t space_id)
Discards a single-table tablespace.
Definition: fil0fil.cc:4463
const byte * fil_tablespace_redo_delete(const byte *ptr, const byte *end, space_id_t space_id, bool parse_only)
Redo a tablespace delete.
Definition: fil0fil.cc:9763
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:10149
ib_file_suffix
Common InnoDB file extensions.
Definition: fil0fil.h:943
@ DWR
Definition: fil0fil.h:950
@ BWR
Definition: fil0fil.h:951
@ IBT
Definition: fil0fil.h:948
@ IBD
Definition: fil0fil.h:945
@ CFP
Definition: fil0fil.h:947
@ CFG
Definition: fil0fil.h:946
@ NO_EXT
Definition: fil0fil.h:944
@ IBU
Definition: fil0fil.h:949
const char * dot_ext[]
Common InnoDB file extensions.
Definition: fil0fil.cc:293
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:5315
constexpr page_type_t FIL_PAGE_TYPE_RSEG_ARRAY
Rollback Segment Array page.
Definition: fil0fil.h:1636
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:7747
dberr_t fil_open_for_business(bool read_only_mode)
Free the Tablespace_files instance.
Definition: fil0fil.cc:9005
void fil_flush(space_id_t space_id)
Flushes to disk possible writes cached by the OS.
Definition: fil0fil.cc:7439
void fil_complete_write(space_id_t space_id, fil_node_t *node)
Definition: fil0fil.cc:10380
dberr_t fil_undo_create(space_id_t space_id, const char *name, const char *path, uint32_t flags, page_no_t size, bool is_explicit)
Create an UNDO tablespace file.
Definition: fil0fil.cc:5332
constexpr page_type_t FIL_PAGE_TYPE_FSP_HDR
File space header.
Definition: fil0fil.h:1596
dberr_t fil_prepare_file_for_io(space_id_t space_id, page_no_t &page_no, fil_node_t **node_out)
Definition: fil0fil.cc:10360
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:2212
constexpr page_type_t FIL_PAGE_IBUF_BITMAP
Insert buffer bitmap.
Definition: fil0fil.h:1587
The low-level file system page header & trailer offsets.
constexpr uint32_t FIL_PAGE_TYPE
file page type: FIL_PAGE_INDEX,..., 2 bytes.
Definition: fil0types.h:76
fil_type_t
File types.
Definition: fil0types.h:180
static bool equal(const Item *i1, const Item *i2, const Field *f2)
Definition: sql_select.cc:3935
constexpr uint32_t FSP_FLAGS_GET_ENCRYPTION(uint32_t flags)
Return the contents of the ENCRYPTION field.
Definition: fsp0types.h:368
static int flags[50]
Definition: hp_test1.cc:40
Insert buffer global types.
#define F
Definition: jit_executor_value.cc:374
unsigned char byte
Blob class.
Definition: common.h:151
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
#define OS_PATH_SEPARATOR
Definition: log_sink_syseventlog.cc:94
A better implementation of the UNIX ctype(3) library.
char my_tolower(const CHARSET_INFO *cs, char ch)
Definition: m_ctype.h:561
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_filename
Definition: ctype-utf8.cc:7047
static uint16_t mach_read_from_2(const byte *b)
The following function is used to fetch data from 2 consecutive bytes.
static char * mem_strdup(const char *str)
Duplicates a NUL-terminated string.
mlog_id_t
Definition: mtr0types.h:63
static const char * filepath
Definition: myisamlog.cc:97
static size_t file_size
Definition: mysql_config_editor.cc:72
static char * path
Definition: mysqldump.cc:151
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
unsigned long long Object_id
Definition: object_id.h:31
Innodb data dictionary name.
Definition: dict0dd.cc:7192
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:943
Json_data_extension ext
Definition: backend.cc:50
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
ValueType max(X &&first)
Definition: gtid.h:103
@ NONE
Definition: base.h:45
bool isalpha(const char &ch)
Definition: parsing_helpers.h:37
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
HARNESS_EXPORT void trim(std::string &str)
Removes both leading and trailing whitespaces from the string.
Definition: string_utils.cc:71
size_t size(const char *const c)
Definition: base64.h:46
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
Define std::hash<Gtid>.
Definition: gtid.h:355
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2284
void free(void *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::malloc*(),...
Definition: ut0new.h:559
os_file_type_t
Definition: os0file.h:678
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:87
A class describing a page size.
const char * filename
Definition: pfs_example_component_population.cc:67
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required string type
Definition: replication_group_member_actions.proto:34
Starts the Innobase database server.
case opt name
Definition: sslopt-case.h:29
Type
Algorithm types supported.
Definition: file.h:53
@ NONE
No compression.
Definition: file.h:59
Callback functor.
Definition: fil0fil.h:2248
virtual ulint get_space_flags() const 1=0
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.
pfs_os_file_t m_file
File handle to the tablespace.
Definition: fil0fil.h:2301
virtual dberr_t operator()(os_offset_t offset, buf_block_t *block) 1=0
Called for every page in the tablespace.
page_size_t m_page_size
The tablespace page size.
Definition: fil0fil.h:2298
PageCallback()
Default constructor.
Definition: fil0fil.h:2250
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:2275
void set_page_size(const buf_frame_t *page) 1
Set the tablespace table size.
Definition: fil0fil.cc:8016
PageCallback(PageCallback &&)=delete
const char * m_filepath
Physical file path.
Definition: fil0fil.h:2304
const page_size_t & get_page_size() const
The compressed page size.
Definition: fil0fil.h:2293
PageCallback(const PageCallback &)=delete
virtual space_id_t get_space_id() const 1=0
PageCallback & operator=(const PageCallback &)=delete
The buffer control block structure.
Definition: buf0buf.h:1756
Data structure for a database table.
Definition: dict0mem.h:1927
File space address.
Definition: fil0fil.h:1513
fil_addr_t()
Definition: fil0fil.h:1515
std::ostream & print(std::ostream &out) const
Print a string representation.
Definition: fil0fil.h:1535
uint32_t boffset
Byte offset within the page.
Definition: fil0fil.h:1545
fil_addr_t(page_no_t p, uint32_t boff)
Constructor.
Definition: fil0fil.h:1520
page_no_t page
Page number within a space.
Definition: fil0fil.h:1542
bool is_equal(const fil_addr_t &rhs) const
Compare to instances.
Definition: fil0fil.h:1525
bool is_null() const
Check if the file address is null.
Definition: fil0fil.h:1531
Structure to hold cached data for the FSP subsystem.
Definition: fil0fil.h:854
uint32_t m_free_len
Length of the FSP_FREE list.
Definition: fil0fil.h:859
page_no_t m_size_in_header
FSP_SIZE in the tablespace header;.
Definition: fil0fil.h:856
bool m_cache_valid
Definition: fil0fil.h:866
page_no_t m_free_limit
Contents of FSP_FREE_LIMIT.
Definition: fil0fil.h:862
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:174
Common file descriptor for file IO instrumentation with PFS on windows and other platforms.
Definition: os0file.h:172
The structure used in the spin lock implementation of a read-write lock.
Definition: sync0rw.h:362
Definition: trx0trx.h:670
Version control for database, common definitions, and include files.
#define UNIV_NOTHROW
Definition: univ.i:459
#define OS_PATH_SEPARATOR_ALT
Definition: univ.i:542
unsigned long int ulint
Definition: univ.i:403
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:97
Minimal implementation of C++23 std::expected.
#define UT_LIST_NODE_T(t)
Macro used for legacy reasons.
Definition: ut0lst.h:64
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
static uint64_t lsn
Definition: xcom_base.cc:446