MySQL 8.4.2
Source Code Documentation
os0file.h File Reference

The interface to the operating system file io. More...

#include "my_dbug.h"
#include "my_io.h"
#include "os/file.h"
#include "os0atomic.h"
#include "os0enc.h"
#include <dirent.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <time.h>
#include <functional>
#include <stack>
#include "os0file.ic"

Go to the source code of this file.

Classes

struct  file::Block
 Blocks for doing IO, used in the transparent compression and encryption code. More...
 
struct  pfs_os_file_t
 Common file descriptor for file IO instrumentation with PFS on windows and other platforms. More...
 
class  IORequest
 The IO Context that is passed down to the low level IO code. More...
 
struct  os_file_size_t
 Sparse file size information. More...
 
struct  os_file_stat_t
 Struct used in fetching information of a file in a directory. More...
 
class  Dir_Walker
 Class to scan the directory hierarchy using a depth first scan. More...
 
struct  Dir_Walker::Entry
 Directory names for the depth first directory scan. More...
 
class  SyncFileIO
 Helper class for doing synchronous file IO. More...
 

Namespaces

namespace  file
 

Macros

#define OS_FILE_PREFIX   "#"
 Prefix all files and directory created under data directory with special string so that it never conflicts with MySQL schema directory. More...
 
#define OS_FILE_FROM_FD(fd)   fd
 Convert a C file descriptor to a native file handle. More...
 
#define OS_FD_FROM_FILE(file)   file
 C file descriptor from an existing native file handle. More...
 
#define OS_FILE_CLOSE_FD(fd)   (os_file_close(fd) ? 0 : OS_FD_CLOSED)
 Closes the file associated with C file descriptor fd. More...
 
#define register_pfs_file_open_begin(state, locker, key, op, name, src_location)
 
#define register_pfs_file_open_end(locker, file, result)
 
#define register_pfs_file_rename_begin(state, locker, key, op, from, to, src_location)
 
#define register_pfs_file_rename_end(locker, from, to, result)
 
#define register_pfs_file_close_begin(state, locker, key, op, name, src_location)
 
#define register_pfs_file_close_end(locker, result)
 
#define register_pfs_file_io_begin(state, locker, file, count, op, src_location)
 
#define register_pfs_file_io_end(locker, count)
 
#define os_file_create(key, name, create, purpose, type, read_only, success)
 
#define os_file_create_simple_no_error_handling(key, name, create_mode, access, read_only, success)
 
#define os_file_create_simple_no_error_handling_with_umask( key, name, create_mode, access, read_only, umask, success)
 
#define os_file_close_pfs(file)   pfs_os_file_close_func(file, UT_LOCATION_HERE)
 
#define os_aio(type, mode, name, file, buf, offset, n, read_only, message1, message2)
 
#define os_file_read_pfs(type, file_name, file, buf, offset, n)    pfs_os_file_read_func(type, file_name, file, buf, offset, n, UT_LOCATION_HERE)
 
#define os_file_read_first_page_pfs(type, file_name, file, buf, n)
 
#define os_file_copy_pfs(src, src_offset, dest, dest_offset, size)
 
#define os_file_read_no_error_handling_pfs(type, file_name, file, buf, offset, n, o)
 
#define os_file_read_no_error_handling_int_fd(type, file_name, file, buf, offset, n, o)
 
#define os_file_write_pfs(type, name, file, buf, offset, n)    pfs_os_file_write_func(type, name, file, buf, offset, n, UT_LOCATION_HERE)
 
#define os_file_write_int_fd(type, name, file, buf, offset, n)
 
#define os_file_flush_pfs(file)   pfs_os_file_flush_func(file, UT_LOCATION_HERE)
 
#define os_file_rename(key, oldpath, newpath)    pfs_os_file_rename_func(key, oldpath, newpath, UT_LOCATION_HERE)
 
#define os_file_delete(key, name)    pfs_os_file_delete_func(key, name, UT_LOCATION_HERE)
 
#define os_file_delete_if_exists(key, name, exist)    pfs_os_file_delete_if_exists_func(key, name, exist, UT_LOCATION_HERE)
 
#define os_file_close(file)   os_file_close_pfs(file)
 
#define os_file_read(type, file_name, file, buf, offset, n)    os_file_read_pfs(type, file_name, file, buf, offset, n)
 
#define os_file_read_first_page(type, file_name, file, buf, n)    os_file_read_first_page_pfs(type, file_name, file, buf, n)
 
#define os_file_flush(file)   os_file_flush_pfs(file)
 
#define os_file_write(type, name, file, buf, offset, n)    os_file_write_pfs(type, name, file, buf, offset, n)
 
#define os_file_copy(src, src_offset, dest, dest_offset, size)    os_file_copy_pfs(src, src_offset, dest, dest_offset, size)
 
#define os_file_read_no_error_handling(type, file_name, file, buf, offset, n, o)    os_file_read_no_error_handling_pfs(type, file_name, file, buf, offset, n, o)
 
#define IORequestRead   IORequest(IORequest::READ)
 Types for AIO operations. More...
 
#define IORequestWrite   IORequest(IORequest::WRITE)
 

Typedefs

typedef uint64_t os_offset_t
 File offset in bytes. More...
 
using os_fd_t = int
 Raw file handle. More...
 
using os_file_t = os_fd_t
 File handle. More...
 
typedef std::function< void(const char *path, const char *name)> os_dir_cbk_t
 Callback function type to be implemented by caller. More...
 

Enumerations

enum  os_file_type_t {
  OS_FILE_TYPE_FAILED , OS_FILE_TYPE_NAME_TOO_LONG , OS_FILE_PERMISSION_ERROR , OS_FILE_TYPE_MISSING ,
  OS_FILE_TYPE_UNKNOWN , OS_FILE_TYPE_FILE , OS_FILE_TYPE_DIR , OS_FILE_TYPE_LINK ,
  OS_FILE_TYPE_BLOCK
}
 
enum class  AIO_mode : size_t { NORMAL = 21 , IBUF = 22 , SYNC = 24 }
 Modes for aio operations. More...
 

Functions

FILE * os_file_create_tmpfile ()
 Create a temporary file. More...
 
bool os_file_create_directory (const char *pathname, bool fail_if_exists)
 This function attempts to create a directory named pathname. More...
 
bool os_file_scan_directory (const char *path, os_dir_cbk_t scan_cbk, bool is_drop)
 This function scans the contents of a directory and invokes the callback for each entry. More...
 
pfs_os_file_t os_file_create_simple_no_error_handling_func (const char *name, ulint create_mode, ulint access_type, bool read_only, mode_t umask, bool *success)
 Clang on Windows warns about umask not found. More...
 
void os_file_set_nocache (int fd, const char *file_name, const char *operation_name)
 Tries to disable OS caching on an opened file descriptor. More...
 
pfs_os_file_t os_file_create_func (const char *name, ulint create_mode, ulint purpose, ulint type, bool read_only, bool *success)
 NOTE! Use the corresponding macro os_file_create(), not directly this function! Opens an existing file or creates a new. More...
 
bool os_file_delete_func (const char *name)
 Deletes a file. More...
 
bool os_file_delete_if_exists_func (const char *name, bool *exist)
 Deletes a file if it exists. More...
 
bool os_file_rename_func (const char *oldpath, const char *newpath)
 NOTE! Use the corresponding macro os_file_rename(), not directly this function! Renames a file (can also move it to another directory). More...
 
bool os_file_close_func (os_file_t file)
 NOTE! Use the corresponding macro os_file_close(), not directly this function! Closes a file handle. More...
 
static pfs_os_file_t pfs_os_file_create_simple_no_error_handling_func (mysql_pfs_key_t key, const char *name, ulint create_mode, ulint access_type, bool read_only, mode_t umask, bool *success, ut::Location src_location)
 Clang on Windows warns about umask not found. More...
 
static pfs_os_file_t pfs_os_file_create_func (mysql_pfs_key_t key, const char *name, ulint create_mode, ulint purpose, ulint type, bool read_only, bool *success, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_create(), not directly this function! A performance schema wrapper function for os_file_create(). More...
 
static bool pfs_os_file_close_func (pfs_os_file_t file, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_close(), not directly this function! A performance schema instrumented wrapper function for os_file_close(). More...
 
static dberr_t pfs_os_file_read_func (IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_read(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read() which requests a synchronous read operation. More...
 
static dberr_t pfs_os_file_read_first_page_func (IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, ulint n, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_read_first_page(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_first_page() which requests a synchronous read operation of page 0 of IBD file. More...
 
static dberr_t pfs_os_file_copy_func (pfs_os_file_t src, os_offset_t src_offset, pfs_os_file_t dest, os_offset_t dest_offset, uint size, ut::Location src_location)
 copy data from one file to another file. More...
 
static dberr_t pfs_os_file_read_no_error_handling_func (IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, ulint *o, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_read_no_error_handling(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_no_error_handling_func() which requests a synchronous read operation. More...
 
static dberr_t pfs_os_file_read_no_error_handling_int_fd_func (IORequest &type, const char *file_name, int file, void *buf, os_offset_t offset, ulint n, ulint *o, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_read_no_error_handling_int_fd(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_no_error_handling_int_fd_func() which requests a synchronous read operation on files with int type descriptors. More...
 
static dberr_t pfs_os_aio_func (IORequest &type, AIO_mode mode, const char *name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, bool read_only, fil_node_t *m1, void *m2, ut::Location location)
 NOTE! Please use the corresponding macro os_aio(), not directly this function! Performance schema wrapper function of os_aio() which requests an asynchronous I/O operation. More...
 
static dberr_t pfs_os_file_write_func (IORequest &type, const char *name, pfs_os_file_t file, const void *buf, os_offset_t offset, ulint n, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_write(), not directly this function! This is the performance schema instrumented wrapper function for os_file_write() which requests a synchronous write operation. More...
 
static dberr_t pfs_os_file_write_int_fd_func (IORequest &type, const char *name, int file, const void *buf, os_offset_t offset, ulint n, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_write(), not directly this function! This is the performance schema instrumented wrapper function for os_file_write() which requests a synchronous write operation on files with int type descriptors. More...
 
static bool pfs_os_file_flush_func (pfs_os_file_t file, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_flush(), not directly this function! This is the performance schema instrumented wrapper function for os_file_flush() which flushes the write buffers of a given file to the disk. More...
 
static bool pfs_os_file_rename_func (mysql_pfs_key_t key, const char *oldpath, const char *newpath, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_rename(), not directly this function! This is the performance schema instrumented wrapper function for os_file_rename() More...
 
static bool pfs_os_file_delete_func (mysql_pfs_key_t key, const char *name, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_delete(), not directly this function! This is the performance schema instrumented wrapper function for os_file_delete() More...
 
static bool pfs_os_file_delete_if_exists_func (mysql_pfs_key_t key, const char *name, bool *exist, ut::Location src_location)
 NOTE! Please use the corresponding macro os_file_delete_if_exists(), not directly this function! This is the performance schema instrumented wrapper function for os_file_delete_if_exists() More...
 
os_file_size_t os_file_get_size (const char *filename)
 Gets a file size. More...
 
os_offset_t os_file_get_size (pfs_os_file_t file)
 Gets a file size. More...
 
bool os_file_set_size_fast (const char *name, pfs_os_file_t file, os_offset_t offset, os_offset_t size, bool flush)
 Allocate a block to file using fallocate from the given offset if fallocate is supported. More...
 
bool os_file_set_size (const char *name, pfs_os_file_t file, os_offset_t offset, os_offset_t size, bool flush)
 Write the specified number of zeros to a file from specific offset. More...
 
bool os_file_set_eof (FILE *file)
 Truncates a file at its current position. More...
 
bool os_file_truncate (const char *pathname, pfs_os_file_t file, os_offset_t size)
 Truncates a file to a specified size in bytes. More...
 
bool os_file_seek (const char *pathname, os_file_t file, os_offset_t offset)
 Set read/write position of a file handle to specific offset. More...
 
bool os_file_flush_func (os_file_t file)
 NOTE! Use the corresponding macro os_file_flush(), not directly this function! Flushes the write buffers of a given file to the disk. More...
 
ulint os_file_get_last_error (bool report_all_errors)
 Retrieves the last error number if an error occurs in a file io function. More...
 
dberr_t os_file_read_func (IORequest &type, const char *file_name, os_file_t file, void *buf, os_offset_t offset, ulint n)
 NOTE! Use the corresponding macro os_file_read_first_page(), not directly this function! Requests a synchronous read operation of page 0 of IBD file. More...
 
dberr_t os_file_read_first_page_func (IORequest &type, const char *file_name, os_file_t file, void *buf, ulint n)
 NOTE! Use the corresponding macro os_file_read_first_page(), not directly this function! Requests a synchronous read operation of page 0 of IBD file. More...
 
dberr_t os_file_copy_func (os_file_t src_file, os_offset_t src_offset, os_file_t dest_file, os_offset_t dest_offset, uint size)
 Copy data from one file to another file. More...
 
void os_file_read_string (FILE *file, char *str, ulint size)
 Rewind file to its start, read at most size - 1 bytes from it to str, and NUL-terminate str. More...
 
dberr_t os_file_read_no_error_handling_func (IORequest &type, const char *file_name, os_file_t file, void *buf, os_offset_t offset, ulint n, ulint *o)
 NOTE! Use the corresponding macro os_file_read_no_error_handling(), not directly this function! Requests a synchronous positioned read operation. More...
 
dberr_t os_file_write_func (IORequest &type, const char *name, os_file_t file, const void *buf, os_offset_t offset, ulint n)
 NOTE! Use the corresponding macro os_file_write(), not directly this function! Requests a synchronous write operation. More...
 
bool os_file_status (const char *path, bool *exists, os_file_type_t *type)
 Check the existence and type of a given path. More...
 
bool os_file_exists (const char *path)
 Check the existence and usefulness of a given path. More...
 
dberr_t os_file_create_subdirs_if_needed (const char *path)
 Create all missing subdirectories along the given path. More...
 
void os_create_block_cache ()
 Creates and initializes block_cache. More...
 
bool os_aio_init (ulint n_readers, ulint n_writers)
 Initializes the asynchronous io system. More...
 
void os_aio_start_threads ()
 Starts one thread for each segment created in os_aio_init. More...
 
void os_aio_free ()
 Frees the asynchronous io system. More...
 
dberr_t os_aio_func (IORequest &type, AIO_mode aio_mode, const char *name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, bool read_only, fil_node_t *m1, void *m2)
 NOTE! Use the corresponding macro os_aio(), not directly this function! Requests an asynchronous i/o operation. More...
 
void os_aio_wake_all_threads_at_shutdown ()
 Wakes up all async i/o threads so that they know to exit themselves in shutdown. More...
 
void os_aio_wait_until_no_pending_writes ()
 Waits until there are no pending writes in os_aio_write_array. More...
 
void os_aio_simulated_wake_handler_threads ()
 Wakes up simulated aio i/o-handler threads if they have something to do. More...
 
void os_aio_simulated_put_read_threads_to_sleep ()
 This function can be called if one wants to post a batch of reads and prefers an i/o-handler thread to handle them all at once later. More...
 
dberr_t os_aio_handler (ulint segment, fil_node_t **m1, void **m2, IORequest *request)
 Waits for an AIO operation to complete. More...
 
void os_aio_print (FILE *file)
 Prints info of the aio arrays. More...
 
void os_aio_refresh_stats ()
 Refreshes the statistics used to print per-second averages. More...
 
bool os_aio_all_slots_free ()
 Checks that all slots in the system have been freed, that is, there are no pending io operations. More...
 
void os_aio_print_pending_io (FILE *file)
 Prints all pending IO. More...
 
dberr_t os_get_free_space (const char *path, uint64_t &free_space)
 Get available free space on disk. More...
 
dberr_t os_file_get_status (const char *path, os_file_stat_t *stat_info, bool check_rw_perm, bool read_only)
 This function returns information about the specified file. More...
 
bool os_file_check_mode (const char *name, bool read_only)
 Check if a file can be opened in read-write mode. More...
 
char * innobase_mysql_tmpdir ()
 return any of the tmpdir path More...
 
os_fd_t innobase_mysql_tmpfile (const char *path)
 Creates a temporary file in the location specified by the parameter path. More...
 
ulint os_file_compressed_page_size (const byte *buf)
 If it is a compressed page return the compressed page data + footer size. More...
 
ulint os_file_original_page_size (const byte *buf)
 If it is a compressed page return the original page data + footer size. More...
 
void os_file_set_umask (mode_t umask)
 Set the global file create umask. More...
 
dberr_t os_file_punch_hole (os_file_t fh, os_offset_t off, os_offset_t len)
 Free storage space associated with a section of the file. More...
 
bool os_is_sparse_file_supported (pfs_os_file_t fh)
 Check if the file system supports sparse files. More...
 
dberr_t os_file_decompress_page (bool dblwr_read, byte *src, byte *dst, ulint dst_len)
 Decompress the page data contents. More...
 
byteos_file_compress_page (Compression compression, ulint block_size, byte *src, ulint src_len, byte *dst, ulint *dst_len)
 Compress a data page. More...
 
bool os_is_o_direct_supported ()
 Determine if O_DIRECT is supported. More...
 
dberr_t os_file_write_zeros (pfs_os_file_t file, const char *name, ulint page_size, os_offset_t start, ulint len)
 Fill the pages with NULs. More...
 
file::Blockos_alloc_block () noexcept
 Allocate a page for sync IO. More...
 
byteos_block_get_frame (const file::Block *block) noexcept
 Get the sector aligned frame pointer. More...
 
void os_free_block (file::Block *block) noexcept
 Free a page after sync IO. More...
 
file::Blockos_file_encrypt_page (const IORequest &type, void *&buf, ulint n)
 Encrypt a page content when write it to disk. More...
 
file::Blockos_file_compress_page (IORequest &type, void *&buf, ulint *n)
 Allocate the buffer for IO on a transparently compressed table. More...
 
dberr_t os_file_write_retry (IORequest &type, const char *name, pfs_os_file_t file, const void *buf, os_offset_t offset, ulint n)
 This is a wrapper function for the os_file_write() function call. More...
 

Variables

bool os_has_said_disk_full
 
constexpr size_t NUM_RETRIES_ON_PARTIAL_IO = 10
 Number of retries for partial I/O's. More...
 
std::atomic< ulintos_n_pending_reads
 Number of pending read operations. More...
 
std::atomic< ulintos_n_pending_writes
 Number of pending write operations. More...
 
unsigned long long os_fsync_threshold
 
static constexpr os_fd_t OS_FD_CLOSED = -1
 
static constexpr os_fd_t OS_FILE_CLOSED = OS_FD_CLOSED
 
constexpr uint32_t OS_FILE_LOG_BLOCK_SIZE = 512
 The next value should be smaller or equal to the smallest sector size used on any disk. More...
 
static const ulint OS_AIO_N_PENDING_IOS_PER_THREAD = 32
 Win NT does not allow more than 64. More...
 
ulint os_n_file_reads
 
ulint os_n_file_writes
 
ulint os_n_fsyncs
 
constexpr uint32_t OS_FILE_MAX_PATH = 4000
 
mysql_pfs_key_t innodb_log_file_key
 
mysql_pfs_key_t innodb_temp_file_key
 
mysql_pfs_key_t innodb_dblwr_file_key
 
mysql_pfs_key_t innodb_arch_file_key
 
mysql_pfs_key_t innodb_clone_file_key
 
mysql_pfs_key_t innodb_data_file_key
 
mysql_pfs_key_t innodb_tablespace_open_file_key
 
constexpr mode_t os_innodb_umask_default = std::numeric_limits<mode_t>::max()
 A magic constant for the umask parameter that indicates caller wants the os_innodb_umask value to be used. More...
 
static const ulint OS_DATA_FILE = 100
 Types for file create. More...
 
static const ulint OS_LOG_FILE = 101
 
static const ulint OS_BUFFERED_FILE = 102
 
static const ulint OS_CLONE_DATA_FILE = 103
 
static const ulint OS_CLONE_LOG_FILE = 104
 
static const ulint OS_DBLWR_FILE = 105
 Doublewrite files. More...
 
static const ulint OS_REDO_LOG_ARCHIVE_FILE = 105
 Redo log archive file. More...
 
static const ulint OS_FILE_NOT_FOUND = 71
 Error codes from os_file_get_last_error. More...
 
static const ulint OS_FILE_DISK_FULL = 72
 
static const ulint OS_FILE_ALREADY_EXISTS = 73
 
static const ulint OS_FILE_PATH_ERROR = 74
 
static const ulint OS_FILE_AIO_RESOURCES_RESERVED = 75
 wait for OS aio resources to become available again More...
 
static const ulint OS_FILE_SHARING_VIOLATION = 76
 
static const ulint OS_FILE_ERROR_NOT_SPECIFIED = 77
 
static const ulint OS_FILE_INSUFFICIENT_RESOURCE = 78
 
static const ulint OS_FILE_AIO_INTERRUPTED = 79
 
static const ulint OS_FILE_OPERATION_ABORTED = 80
 
static const ulint OS_FILE_ACCESS_VIOLATION = 81
 
static const ulint OS_FILE_NAME_TOO_LONG = 82
 
static const ulint OS_FILE_TOO_MANY_OPENED = 83
 
static const ulint OS_FILE_ERROR_MAX = 100
 
enum  os_file_create_t {
  OS_FILE_OPEN = 51 , OS_FILE_CREATE , OS_FILE_OPEN_RAW , OS_FILE_CREATE_PATH ,
  OS_FILE_OPEN_RETRY , OS_FILE_ON_ERROR_NO_EXIT = 128 , OS_FILE_ON_ERROR_SILENT = 256
}
 Options for os_file_create_func. More...
 
static const ulint OS_FILE_READ_ONLY = 333
 
static const ulint OS_FILE_READ_WRITE = 444
 
static const ulint OS_FILE_READ_ALLOW_DELETE = 555
 Used by MySQLBackup. More...
 
static const ulint OS_FILE_AIO = 61
 
static const ulint OS_FILE_NORMAL = 62
 

Detailed Description

The interface to the operating system file io.

Created 10/21/1995 Heikki Tuuri

Macro Definition Documentation

◆ IORequestRead

#define IORequestRead   IORequest(IORequest::READ)

Types for AIO operations.

No transformations during read/write, write as is.

◆ IORequestWrite

#define IORequestWrite   IORequest(IORequest::WRITE)

◆ os_aio

#define os_aio (   type,
  mode,
  name,
  file,
  buf,
  offset,
  n,
  read_only,
  message1,
  message2 
)
Value:
pfs_os_aio_func(type, mode, name, file, buf, offset, n, read_only, message1, \
message2, UT_LOCATION_HERE)
Definition: buf0block_hint.cc:30
constexpr value_type read_only
Definition: classic_protocol_constants.h:213
Definition: os0file.h:89
mode
Definition: file_handle.h:61
static dberr_t pfs_os_aio_func(IORequest &type, AIO_mode mode, const char *name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, bool read_only, fil_node_t *m1, void *m2, ut::Location location)
NOTE! Please use the corresponding macro os_aio(), not directly this function! Performance schema wra...
required string type
Definition: replication_group_member_actions.proto:34
case opt name
Definition: sslopt-case.h:29
#define UT_LOCATION_HERE
Definition: ut0core.h:73
int n
Definition: xcom_base.cc:509

◆ OS_FD_FROM_FILE

#define OS_FD_FROM_FILE (   file)    file

C file descriptor from an existing native file handle.

Parameters
[in]filenative file handle
Returns
C file descriptor

◆ os_file_close

#define os_file_close (   file)    os_file_close_pfs(file)

◆ OS_FILE_CLOSE_FD

#define OS_FILE_CLOSE_FD (   fd)    (os_file_close(fd) ? 0 : OS_FD_CLOSED)

Closes the file associated with C file descriptor fd.

Parameters
[in]fdC file descriptor
Returns
0 if success

◆ os_file_close_pfs

#define os_file_close_pfs (   file)    pfs_os_file_close_func(file, UT_LOCATION_HERE)

◆ os_file_copy

#define os_file_copy (   src,
  src_offset,
  dest,
  dest_offset,
  size 
)     os_file_copy_pfs(src, src_offset, dest, dest_offset, size)

◆ os_file_copy_pfs

#define os_file_copy_pfs (   src,
  src_offset,
  dest,
  dest_offset,
  size 
)
Value:
pfs_os_file_copy_func(src, src_offset, dest, dest_offset, size, \
size_t size(const char *const c)
Definition: base64.h:46
static dberr_t pfs_os_file_copy_func(pfs_os_file_t src, os_offset_t src_offset, pfs_os_file_t dest, os_offset_t dest_offset, uint size, ut::Location src_location)
copy data from one file to another file.

◆ os_file_create

#define os_file_create (   key,
  name,
  create,
  purpose,
  type,
  read_only,
  success 
)
Value:
success, UT_LOCATION_HERE)
static mysql_service_status_t create(const char *service_names[], reference_caching_channel *out_channel) noexcept
Definition: component.cc:45
static pfs_os_file_t pfs_os_file_create_func(mysql_pfs_key_t key, const char *name, ulint create_mode, ulint purpose, ulint type, bool read_only, bool *success, ut::Location src_location)
NOTE! Please use the corresponding macro os_file_create(), not directly this function!...
required string key
Definition: replication_asynchronous_connection_failover.proto:60

◆ os_file_create_simple_no_error_handling

#define os_file_create_simple_no_error_handling (   key,
  name,
  create_mode,
  access,
  read_only,
  success 
)
Value:
key, name, create_mode, access, read_only, os_innodb_umask_default, \
success, UT_LOCATION_HERE)
constexpr mode_t os_innodb_umask_default
A magic constant for the umask parameter that indicates caller wants the os_innodb_umask value to be ...
Definition: os0file.h:1747
static pfs_os_file_t pfs_os_file_create_simple_no_error_handling_func(mysql_pfs_key_t key, const char *name, ulint create_mode, ulint access_type, bool read_only, mode_t umask, bool *success, ut::Location src_location)
Clang on Windows warns about umask not found.

◆ os_file_create_simple_no_error_handling_with_umask

#define os_file_create_simple_no_error_handling_with_umask (   key,
  name,
  create_mode,
  access,
  read_only,
  umask,
  success 
)
Value:

◆ os_file_delete

#define os_file_delete (   key,
  name 
)     pfs_os_file_delete_func(key, name, UT_LOCATION_HERE)

◆ os_file_delete_if_exists

#define os_file_delete_if_exists (   key,
  name,
  exist 
)     pfs_os_file_delete_if_exists_func(key, name, exist, UT_LOCATION_HERE)

◆ os_file_flush

#define os_file_flush (   file)    os_file_flush_pfs(file)

◆ os_file_flush_pfs

#define os_file_flush_pfs (   file)    pfs_os_file_flush_func(file, UT_LOCATION_HERE)

◆ OS_FILE_FROM_FD

#define OS_FILE_FROM_FD (   fd)    fd

Convert a C file descriptor to a native file handle.

Parameters
fdfile descriptor
Returns
native file handle

◆ OS_FILE_PREFIX

#define OS_FILE_PREFIX   "#"

Prefix all files and directory created under data directory with special string so that it never conflicts with MySQL schema directory.

◆ os_file_read

#define os_file_read (   type,
  file_name,
  file,
  buf,
  offset,
  n 
)     os_file_read_pfs(type, file_name, file, buf, offset, n)

◆ os_file_read_first_page

#define os_file_read_first_page (   type,
  file_name,
  file,
  buf,
  n 
)     os_file_read_first_page_pfs(type, file_name, file, buf, n)

◆ os_file_read_first_page_pfs

#define os_file_read_first_page_pfs (   type,
  file_name,
  file,
  buf,
  n 
)
Value:
std::string file_name(Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0pre_8_0_30.cc:94
static dberr_t pfs_os_file_read_first_page_func(IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, ulint n, ut::Location src_location)
NOTE! Please use the corresponding macro os_file_read_first_page(), not directly this function!...

◆ os_file_read_no_error_handling

#define os_file_read_no_error_handling (   type,
  file_name,
  file,
  buf,
  offset,
  n,
 
)     os_file_read_no_error_handling_pfs(type, file_name, file, buf, offset, n, o)

◆ os_file_read_no_error_handling_int_fd

#define os_file_read_no_error_handling_int_fd (   type,
  file_name,
  file,
  buf,
  offset,
  n,
 
)
Value:
static dberr_t pfs_os_file_read_no_error_handling_int_fd_func(IORequest &type, const char *file_name, int file, void *buf, os_offset_t offset, ulint n, ulint *o, ut::Location src_location)
NOTE! Please use the corresponding macro os_file_read_no_error_handling_int_fd(), not directly this f...

◆ os_file_read_no_error_handling_pfs

#define os_file_read_no_error_handling_pfs (   type,
  file_name,
  file,
  buf,
  offset,
  n,
 
)
Value:
static dberr_t pfs_os_file_read_no_error_handling_func(IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, ulint *o, ut::Location src_location)
NOTE! Please use the corresponding macro os_file_read_no_error_handling(), not directly this function...

◆ os_file_read_pfs

#define os_file_read_pfs (   type,
  file_name,
  file,
  buf,
  offset,
  n 
)     pfs_os_file_read_func(type, file_name, file, buf, offset, n, UT_LOCATION_HERE)

◆ os_file_rename

#define os_file_rename (   key,
  oldpath,
  newpath 
)     pfs_os_file_rename_func(key, oldpath, newpath, UT_LOCATION_HERE)

◆ os_file_write

#define os_file_write (   type,
  name,
  file,
  buf,
  offset,
  n 
)     os_file_write_pfs(type, name, file, buf, offset, n)

◆ os_file_write_int_fd

#define os_file_write_int_fd (   type,
  name,
  file,
  buf,
  offset,
  n 
)
Value:
static dberr_t pfs_os_file_write_int_fd_func(IORequest &type, const char *name, int file, const void *buf, os_offset_t offset, ulint n, ut::Location src_location)
NOTE! Please use the corresponding macro os_file_write(), not directly this function!...

◆ os_file_write_pfs

#define os_file_write_pfs (   type,
  name,
  file,
  buf,
  offset,
  n 
)     pfs_os_file_write_func(type, name, file, buf, offset, n, UT_LOCATION_HERE)

◆ register_pfs_file_close_begin

#define register_pfs_file_close_begin (   state,
  locker,
  key,
  op,
  name,
  src_location 
)
Value:
do { \
locker = PSI_FILE_CALL(get_thread_file_name_locker)(state, key.m_value, \
op, name, &locker); \
if (locker != nullptr) { \
PSI_FILE_CALL(start_file_close_wait) \
(locker, src_location.filename, static_cast<uint>(src_location.line)); \
} \
} while (0)
#define PSI_FILE_CALL(M)
Definition: psi_file.h:36

◆ register_pfs_file_close_end

#define register_pfs_file_close_end (   locker,
  result 
)
Value:
do { \
if (locker != nullptr) { \
PSI_FILE_CALL(end_file_close_wait)(locker, result); \
} \
} while (0)
struct result result
Definition: result.h:34

◆ register_pfs_file_io_begin

#define register_pfs_file_io_begin (   state,
  locker,
  file,
  count,
  op,
  src_location 
)
Value:
do { \
locker = \
PSI_FILE_CALL(get_thread_file_stream_locker)(state, file.m_psi, op); \
if (locker != nullptr) { \
PSI_FILE_CALL(start_file_wait) \
(locker, count, src_location.filename, \
static_cast<uint>(src_location.line)); \
} \
} while (0)
static int count
Definition: myisam_ftdump.cc:45

◆ register_pfs_file_io_end

#define register_pfs_file_io_end (   locker,
  count 
)
Value:
do { \
if (locker != nullptr) { \
PSI_FILE_CALL(end_file_wait)(locker, count); \
} \
} while (0)

◆ register_pfs_file_open_begin

#define register_pfs_file_open_begin (   state,
  locker,
  key,
  op,
  name,
  src_location 
)
Value:
do { \
locker = PSI_FILE_CALL(get_thread_file_name_locker)(state, key.m_value, \
op, name, &locker); \
if (locker != nullptr) { \
PSI_FILE_CALL(start_file_open_wait) \
(locker, src_location.filename, static_cast<uint>(src_location.line)); \
} \
} while (0)

◆ register_pfs_file_open_end

#define register_pfs_file_open_end (   locker,
  file,
  result 
)
Value:
do { \
if (locker != nullptr) { \
file.m_psi = PSI_FILE_CALL(end_file_open_wait)(locker, result); \
} \
} while (0)

◆ register_pfs_file_rename_begin

#define register_pfs_file_rename_begin (   state,
  locker,
  key,
  op,
  from,
  to,
  src_location 
)
Value:
do { \
locker = PSI_FILE_CALL(get_thread_file_name_locker)(state, key.m_value, \
op, from, &locker); \
if (locker != nullptr) { \
PSI_FILE_CALL(start_file_rename_wait) \
(locker, (size_t)0, from, to, src_location.filename, \
static_cast<uint>(src_location.line)); \
} \
} while (0)

◆ register_pfs_file_rename_end

#define register_pfs_file_rename_end (   locker,
  from,
  to,
  result 
)
Value:
do { \
if (locker != nullptr) { \
PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result); \
} \
} while (0)

Typedef Documentation

◆ os_dir_cbk_t

typedef std::function<void(const char *path, const char *name)> os_dir_cbk_t

Callback function type to be implemented by caller.

It is called for each entry in directory.

Parameters
[in]pathpath to the file
[in]namename of the file

◆ os_fd_t

using os_fd_t = int

Raw file handle.

◆ os_file_t

using os_file_t = os_fd_t

File handle.

◆ os_offset_t

typedef uint64_t os_offset_t

File offset in bytes.

Enumeration Type Documentation

◆ AIO_mode

enum class AIO_mode : size_t
strong

Modes for aio operations.

Enumerator
NORMAL 

Normal asynchronous i/o not for ibuf pages or ibuf bitmap pages.

IBUF 

Asynchronous i/o for ibuf pages or ibuf bitmap pages.

SYNC 

Asynchronous i/o where the calling thread will itself wait for the i/o to complete, doing also the job of the i/o-handler thread; can be used for any pages, ibuf or non-ibuf.

This is used to save CPU time, as we can do with fewer thread switches. Plain synchronous I/O is not as good, because it must serialize the file seek and read or write, causing a bottleneck for parallelism.

◆ os_file_create_t

Options for os_file_create_func.

Enumerator
OS_FILE_OPEN 

to open an existing file (if doesn't exist, error)

OS_FILE_CREATE 

to create new file (if exists, error)

OS_FILE_OPEN_RAW 

to open a raw device or disk partition

OS_FILE_CREATE_PATH 

to create the directories

OS_FILE_OPEN_RETRY 

open with retry

OS_FILE_ON_ERROR_NO_EXIT 

Flags that can be combined with the above values.

Please ensure that the above values stay below 128. do not exit on unknown errors

OS_FILE_ON_ERROR_SILENT 

don't print diagnostic messages to the log unless it is a fatal error, this flag is only used if ON_ERROR_NO_EXIT is set

◆ os_file_type_t

Enumerator
OS_FILE_TYPE_FAILED 

Get status failed.

OS_FILE_TYPE_NAME_TOO_LONG 

stat() failed, with ENAMETOOLONG

OS_FILE_PERMISSION_ERROR 

stat() failed with EACCESS

OS_FILE_TYPE_MISSING 

File doesn't exist.

OS_FILE_TYPE_UNKNOWN 

File exists but type is unknown.

OS_FILE_TYPE_FILE 

Ordinary file.

OS_FILE_TYPE_DIR 

Directory.

OS_FILE_TYPE_LINK 

Symbolic link.

OS_FILE_TYPE_BLOCK 

Block device.

Function Documentation

◆ innobase_mysql_tmpdir()

char * innobase_mysql_tmpdir ( )

return any of the tmpdir path

◆ innobase_mysql_tmpfile()

os_fd_t innobase_mysql_tmpfile ( const char *  path)

Creates a temporary file in the location specified by the parameter path.

If the path is NULL, then it will be created in –tmpdir.

Parameters
[in]pathlocation for creating temporary file
Returns
temporary file descriptor, or OS_FD_CLOSED on error

◆ os_aio_all_slots_free()

bool os_aio_all_slots_free ( )

Checks that all slots in the system have been freed, that is, there are no pending io operations.

Returns
true if all free

◆ os_aio_free()

void os_aio_free ( )

Frees the asynchronous io system.

◆ os_aio_func()

dberr_t os_aio_func ( IORequest type,
AIO_mode  aio_mode,
const char *  name,
pfs_os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
bool  read_only,
fil_node_t m1,
void *  m2 
)

NOTE! Use the corresponding macro os_aio(), not directly this function! Requests an asynchronous i/o operation.

Parameters
[in]typeIO request context
[in]aio_modeIO mode
[in]nameName of the file or path as NUL terminated string
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nhow many bytes to read or write; this must not cross a file boundary; in AIO this must be a block size multiple
[in]read_onlyif true read only mode checks are enforced
[in,out]m1Message for the AIO handler, (can be used to identify a completed AIO operation); ignored if mode is OS_AIO_SYNC
[in,out]m2message for the AIO handler (can be used to identify a completed AIO operation); ignored if mode is OS_AIO_SYNC
Returns
DB_SUCCESS or error code

◆ os_aio_handler()

dberr_t os_aio_handler ( ulint  segment,
fil_node_t **  m1,
void **  m2,
IORequest request 
)

Waits for an AIO operation to complete.

This function is used to wait the for completed requests. The AIO array of pending requests is divided into segments. The thread specifies which segment or slot it wants to wait for. NOTE: this function will also take care of freeing the AIO slot, therefore no other thread is allowed to do the freeing!

Parameters
[in]segmentThe number of the segment in the AIO arrays to wait for; segment 0 is the ibuf I/O thread, then follow the non-ibuf read threads, and as the last are the non-ibuf write threads
[out]m1the messages passed with the AIO request; note that also in the case where the AIO operation failed, these output parameters are valid and can be used to restart the operation, for example
[out]m2callback message
[out]requestOS_FILE_WRITE or ..._READ
Returns
DB_SUCCESS or error code

◆ os_aio_init()

bool os_aio_init ( ulint  n_readers,
ulint  n_writers 
)

Initializes the asynchronous io system.

Creates an array for ibuf i/o (if not in read-only mode). Also creates one array each for read and write where each array is divided logically into n_readers and n_writers respectively. The caller must create an i/o handler thread for each segment in these arrays by calling os_aio_start_threads().

Parameters
[in]n_readersnumber of reader threads
[in]n_writersnumber of writer threads

◆ os_aio_print()

void os_aio_print ( FILE *  file)

Prints info of the aio arrays.

Parameters
[in,out]filefile where to print

◆ os_aio_print_pending_io()

void os_aio_print_pending_io ( FILE *  file)

Prints all pending IO.

Parameters
[in]fileFile where to print

◆ os_aio_refresh_stats()

void os_aio_refresh_stats ( )

Refreshes the statistics used to print per-second averages.

◆ os_aio_simulated_put_read_threads_to_sleep()

void os_aio_simulated_put_read_threads_to_sleep ( )

This function can be called if one wants to post a batch of reads and prefers an i/o-handler thread to handle them all at once later.

You must call os_aio_simulated_wake_handler_threads later to ensure the threads are not left sleeping!

◆ os_aio_simulated_wake_handler_threads()

void os_aio_simulated_wake_handler_threads ( )

Wakes up simulated aio i/o-handler threads if they have something to do.

◆ os_aio_start_threads()

void os_aio_start_threads ( )

Starts one thread for each segment created in os_aio_init.

◆ os_aio_wait_until_no_pending_writes()

void os_aio_wait_until_no_pending_writes ( )

Waits until there are no pending writes in os_aio_write_array.

There can be other, synchronous, pending writes.

Waits until there are no pending writes in os_aio_write_array.

There can be other, synchronous, pending writes.

◆ os_aio_wake_all_threads_at_shutdown()

void os_aio_wake_all_threads_at_shutdown ( )

Wakes up all async i/o threads so that they know to exit themselves in shutdown.

◆ os_alloc_block()

file::Block * os_alloc_block ( )
noexcept

Allocate a page for sync IO.

Returns
pointer to page

◆ os_block_get_frame()

byte * os_block_get_frame ( const file::Block block)
noexcept

Get the sector aligned frame pointer.

Parameters
[in]blockthe memory block containing the page frame.
Returns
the sector aligned frame pointer.

◆ os_create_block_cache()

void os_create_block_cache ( )

Creates and initializes block_cache.

Creates array of MAX_BLOCKS and allocates the memory in each block to hold BUFFER_BLOCK_SIZE of data.

This function is called by InnoDB during srv_start(). It is also called by MEB while applying the redo logs on TDE tablespaces, the "Blocks" allocated in this block_cache are used to hold the decrypted page data.

◆ os_file_check_mode()

bool os_file_check_mode ( const char *  name,
bool  read_only 
)

Check if a file can be opened in read-write mode.

Parameters
[in]namefilename to check
[in]read_onlytrue if check for read-only mode only
Return values
trueif file can be opened in the specified mode (rw or ro); or file does not exist
falseif file exists and can't be opened in the specified mode

◆ os_file_close_func()

bool os_file_close_func ( os_file_t  file)

NOTE! Use the corresponding macro os_file_close(), not directly this function! Closes a file handle.

In case of error, error number can be retrieved with os_file_get_last_error.

Parameters
[in]fileHandle to a file
Returns
true if success

◆ os_file_compress_page() [1/2]

byte * os_file_compress_page ( Compression  compression,
ulint  block_size,
byte src,
ulint  src_len,
byte dst,
ulint dst_len 
)

Compress a data page.

Parameters
[in]compressionCompression algorithm
[in]block_sizeFile system block size
[in]srcSource contents to compress
[in]src_lenLength in bytes of the source
[out]dstCompressed page contents
[out]dst_lenLength in bytes of dst contents
Returns
buffer data, dst_len will have the length of the data

◆ os_file_compress_page() [2/2]

file::Block * os_file_compress_page ( IORequest type,
void *&  buf,
ulint n 
)

Allocate the buffer for IO on a transparently compressed table.

Parameters
[in]typeIO flags
[out]bufbuffer to read or write
[in,out]nnumber of bytes to read/write, starting from offset
Returns
pointer to allocated page, compressed data is written to the offset that is aligned on the disk sector size

◆ os_file_compressed_page_size()

ulint os_file_compressed_page_size ( const byte buf)

If it is a compressed page return the compressed page data + footer size.

Parameters
[in]bufBuffer to check, must include header + 10 bytes
Returns
ULINT_UNDEFINED if the page is not a compressed page or length of the compressed data (including footer) if it is a compressed page

◆ os_file_copy_func()

dberr_t os_file_copy_func ( os_file_t  src_file,
os_offset_t  src_offset,
os_file_t  dest_file,
os_offset_t  dest_offset,
uint  size 
)

Copy data from one file to another file.

Data is read/written at current file offset.

Parameters
[in]src_filefile handle to copy from
[in]src_offsetoffset to copy from
[in]dest_filefile handle to copy to
[in]dest_offsetoffset to copy to
[in]sizenumber of bytes to copy
Returns
DB_SUCCESS if successful

◆ os_file_create_directory()

bool os_file_create_directory ( const char *  pathname,
bool  fail_if_exists 
)

This function attempts to create a directory named pathname.

The new directory gets default permissions. On Unix the permissions are (0770 & ~umask). If the directory exists already, nothing is done and the call succeeds, unless the fail_if_exists arguments is true. If another error occurs, such as a permission error, this does not crash, but reports the error and returns false.

Parameters
[in]pathnamedirectory name as null-terminated string
[in]fail_if_existsif true, pre-existing directory is treated as an error.
Returns
true if call succeeds, false on error

◆ os_file_create_func()

pfs_os_file_t os_file_create_func ( const char *  name,
ulint  create_mode,
ulint  purpose,
ulint  type,
bool  read_only,
bool *  success 
)

NOTE! Use the corresponding macro os_file_create(), not directly this function! Opens an existing file or creates a new.

Parameters
[in]namename of the file or path as a null-terminated string
[in]create_modecreate mode
[in]purposeOS_FILE_AIO, if asynchronous, non-buffered I/O is desired, OS_FILE_NORMAL, if any normal file; NOTE that it also depends on type, os_aio_.. and srv_.. variables whether we really use async I/O or unbuffered I/O: look in the function source code for the exact rules
[in]typeOS_DATA_FILE, OS_LOG_FILE etc.
[in]read_onlyif true read only mode checks are enforced
[in]successtrue if succeeded
Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error

◆ os_file_create_simple_no_error_handling_func()

pfs_os_file_t os_file_create_simple_no_error_handling_func ( const char *  name,
ulint  create_mode,
ulint  access_type,
bool  read_only,
mode_t  umask,
bool *  success 
)

Clang on Windows warns about umask not found.

NOTE! Use the corresponding macro os_file_create_simple_no_error_handling(), not directly this function! A simple function to open or create a file.

Parameters
[in]namename of the file or path as a null-terminated string
[in]create_modecreate mode
[in]access_typeOS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or OS_FILE_READ_ALLOW_DELETE; the last option is used by a backup program reading the file
[in]read_onlyif true read only mode checks are enforced
[in]umaskUNIX access permission to be set when creating a file. Use os_umask_default to use global default umask.
[out]successtrue if succeeded
Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error

◆ os_file_create_subdirs_if_needed()

dberr_t os_file_create_subdirs_if_needed ( const char *  path)

Create all missing subdirectories along the given path.

Returns
DB_SUCCESS if OK, otherwise error code.

Create all missing subdirectories along the given path.

Parameters
[in]pathPath name
Returns
DB_SUCCESS if OK, otherwise error code.

◆ os_file_create_tmpfile()

FILE * os_file_create_tmpfile ( )

Create a temporary file.

This function is like tmpfile(3). It will create the file in the MySQL server configuration parameter (–tmpdir).

Returns
temporary file handle, or NULL on error

◆ os_file_decompress_page()

dberr_t os_file_decompress_page ( bool  dblwr_read,
byte src,
byte dst,
ulint  dst_len 
)

Decompress the page data contents.

Page type must be FIL_PAGE_COMPRESSED, if not then the source contents are left unchanged and DB_SUCCESS is returned.

Parameters
[in]dblwr_readtrue of double write recovery in progress
[in,out]srcData read from disk, decompressed data will be copied to this page
[in,out]dstScratch area to use for decompression or nullptr.
[in]dst_lenIf dst is valid, then size of the scratch area in bytes
Returns
DB_SUCCESS or error code

◆ os_file_delete_func()

bool os_file_delete_func ( const char *  name)

Deletes a file.

The file has to be closed before calling this.

Parameters
[in]namefile path as a null-terminated string
Returns
true if success

◆ os_file_delete_if_exists_func()

bool os_file_delete_if_exists_func ( const char *  name,
bool *  exist 
)

Deletes a file if it exists.

The file has to be closed before calling this.

Parameters
[in]namefile path as a null-terminated string
[out]existindicate if file pre-exist
Returns
true if success

◆ os_file_encrypt_page()

file::Block * os_file_encrypt_page ( const IORequest type,
void *&  buf,
ulint  n 
)

Encrypt a page content when write it to disk.

Parameters
[in]typeIO flags
[out]bufbuffer to read or write
[in]nnumber of bytes to read/write, starting from offset
Returns
pointer to the encrypted page

◆ os_file_exists()

bool os_file_exists ( const char *  path)

Check the existence and usefulness of a given path.

Parameters
[in]pathpath name
Return values
trueif the path exists and can be used
falseif the path does not exist or if the path is unusable to get to a possibly existing file or directory.

◆ os_file_flush_func()

bool os_file_flush_func ( os_file_t  file)

NOTE! Use the corresponding macro os_file_flush(), not directly this function! Flushes the write buffers of a given file to the disk.

Parameters
[in]filehandle to a file
Returns
true if success

◆ os_file_get_last_error()

ulint os_file_get_last_error ( bool  report_all_errors)

Retrieves the last error number if an error occurs in a file io function.

The number should be retrieved before any other OS calls (because they may overwrite the error number). If the number is not known to this program, the OS error number + 100 is returned.

Parameters
[in]report_all_errorstrue if we want an error message printed for all errors
Returns
error number, or OS error number + 100

◆ os_file_get_size() [1/2]

os_file_size_t os_file_get_size ( const char *  filename)

Gets a file size.

Parameters
[in]filenameFull path to the filename to check
Returns
file size if OK, else set m_total_size to ~0 and m_alloc_size to errno.

◆ os_file_get_size() [2/2]

os_offset_t os_file_get_size ( pfs_os_file_t  file)

Gets a file size.

Parameters
[in]fileHandle to a file
Returns
file size, or (os_offset_t) -1 on failure

◆ os_file_get_status()

dberr_t os_file_get_status ( const char *  path,
os_file_stat_t stat_info,
bool  check_rw_perm,
bool  read_only 
)

This function returns information about the specified file.

Parameters
[in]pathpathname of the file
[out]stat_infoinformation of a file in a directory
[in]check_rw_permfor testing whether the file can be opened in RW mode
[in]read_onlytrue if file is opened in read-only mode
Returns
DB_SUCCESS if all OK

◆ os_file_original_page_size()

ulint os_file_original_page_size ( const byte buf)

If it is a compressed page return the original page data + footer size.

Parameters
[in]bufBuffer to check, must include header + 10 bytes
Returns
ULINT_UNDEFINED if the page is not a compressed page or length of the original data + footer if it is a compressed page

◆ os_file_punch_hole()

dberr_t os_file_punch_hole ( os_file_t  fh,
os_offset_t  off,
os_offset_t  len 
)

Free storage space associated with a section of the file.

Parameters
[in]fhOpen file handle
[in]offStarting offset (SEEK_SET)
[in]lenSize of the hole
Returns
DB_SUCCESS or error code

◆ os_file_read_first_page_func()

dberr_t os_file_read_first_page_func ( IORequest type,
const char *  file_name,
os_file_t  file,
void *  buf,
ulint  n 
)

NOTE! Use the corresponding macro os_file_read_first_page(), not directly this function! Requests a synchronous read operation of page 0 of IBD file.

Parameters
[in]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]nnumber of bytes to read
Returns
DB_SUCCESS if request was successful, DB_IO_ERROR on failure

◆ os_file_read_func()

dberr_t os_file_read_func ( IORequest type,
const char *  file_name,
os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n 
)

NOTE! Use the corresponding macro os_file_read_first_page(), not directly this function! Requests a synchronous read operation of page 0 of IBD file.

Parameters
[in]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
Returns
DB_SUCCESS if request was successful, DB_IO_ERROR on failure

◆ os_file_read_no_error_handling_func()

dberr_t os_file_read_no_error_handling_func ( IORequest type,
const char *  file_name,
os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
ulint o 
)

NOTE! Use the corresponding macro os_file_read_no_error_handling(), not directly this function! Requests a synchronous positioned read operation.

This function does not do any error handling. In case of error it returns false.

Parameters
[in]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
[out]onumber of bytes actually read
Returns
DB_SUCCESS or error code

◆ os_file_read_string()

void os_file_read_string ( FILE *  file,
char *  str,
ulint  size 
)

Rewind file to its start, read at most size - 1 bytes from it to str, and NUL-terminate str.

All errors are silently ignored. This function is mostly meant to be used with temporary files.

Parameters
[in,out]fileFile to read from
[in,out]strBuffer where to read
[in]sizeSize of buffer

◆ os_file_rename_func()

bool os_file_rename_func ( const char *  oldpath,
const char *  newpath 
)

NOTE! Use the corresponding macro os_file_rename(), not directly this function! Renames a file (can also move it to another directory).

It is safest that the file is closed before calling this function.

Parameters
[in]oldpathold file path as a null-terminated string
[in]newpathnew file path
Returns
true if success

◆ os_file_scan_directory()

bool os_file_scan_directory ( const char *  path,
os_dir_cbk_t  scan_cbk,
bool  is_drop 
)

This function scans the contents of a directory and invokes the callback for each entry.

Parameters
[in]pathdirectory name as null-terminated string
[in]scan_cbkuse callback to be called for each entry
[in]is_dropattempt to drop the directory after scan
Returns
true if call succeeds, false on error

◆ os_file_seek()

bool os_file_seek ( const char *  pathname,
os_file_t  file,
os_offset_t  offset 
)

Set read/write position of a file handle to specific offset.

Parameters
[in]pathnamefile path
[in]filefile handle
[in]offsetread/write offset
Returns
true if success

◆ os_file_set_eof()

bool os_file_set_eof ( FILE *  file)

Truncates a file at its current position.

Parameters
[in,out]filefile to be truncated
Returns
true if success in: file to be truncated
true if success
Parameters
filein: file to be truncated

◆ os_file_set_nocache()

void os_file_set_nocache ( int  fd,
const char *  file_name,
const char *  operation_name 
)

Tries to disable OS caching on an opened file descriptor.

Parameters
[in]fdfile descriptor to alter
[in]file_namefile name, used in the diagnostic message
[in]operation_name"open" or "create"; used in the diagnostic message

◆ os_file_set_size()

bool os_file_set_size ( const char *  name,
pfs_os_file_t  file,
os_offset_t  offset,
os_offset_t  size,
bool  flush 
)

Write the specified number of zeros to a file from specific offset.

Parameters
[in]namename of the file or path as a null-terminated string
[in]filehandle to a file
[in]offsetfile offset
[in]sizefile size
[in]flushflush file content to disk
Returns
true if success

◆ os_file_set_size_fast()

bool os_file_set_size_fast ( const char *  name,
pfs_os_file_t  file,
os_offset_t  offset,
os_offset_t  size,
bool  flush 
)

Allocate a block to file using fallocate from the given offset if fallocate is supported.

Falls back to the old slower method of writing zeros otherwise.

Parameters
[in]namename of the file
[in]filehandle to the file
[in]offsetfile offset
[in]sizefile size
[in]flushflush file content to disk
Returns
true if success

◆ os_file_set_umask()

void os_file_set_umask ( mode_t  umask)

Set the global file create umask.

This value is to be set once, at startup and never modified.

Parameters
[in]umaskThe umask to use for all InnoDB file creation.

◆ os_file_status()

bool os_file_status ( const char *  path,
bool *  exists,
os_file_type_t type 
)

Check the existence and type of a given path.

Parameters
[in]pathpathname of the file
[out]existstrue if file exists
[out]typetype of the file (if it exists)
Returns
true if call succeeded

◆ os_file_truncate()

bool os_file_truncate ( const char *  pathname,
pfs_os_file_t  file,
os_offset_t  size 
)

Truncates a file to a specified size in bytes.

Do nothing if the size to preserve is greater or equal to the current size of the file.

Parameters
[in]pathnamefile path
[in]filefile to be truncated
[in]sizesize to preserve in bytes
Returns
true if success

◆ os_file_write_func()

dberr_t os_file_write_func ( IORequest type,
const char *  name,
os_file_t  file,
const void *  buf,
os_offset_t  offset,
ulint  n 
)

NOTE! Use the corresponding macro os_file_write(), not directly this function! Requests a synchronous write operation.

Parameters
[in,out]typeIO request context
[in]namename of the file or path as a null-terminated string
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
Returns
DB_SUCCESS if request was successful

◆ os_file_write_retry()

dberr_t os_file_write_retry ( IORequest type,
const char *  name,
pfs_os_file_t  file,
const void *  buf,
os_offset_t  offset,
ulint  n 
)

This is a wrapper function for the os_file_write() function call.

The purpose of this wrapper function is to retry on i/o error. On I/O error (perhaps because of disk full situation) keep retrying the write operation till it succeeds.

Parameters
[in]typeIO flags
[in]namename of the file or path as a null-terminated string
[in]filehandle to an open file
[out]bufbuffer from which to write
[in]offsetfile offset from the start where to read
[in]nnumber of bytes to read, starting from offset
Returns
DB_SUCCESS if request was successful, false if fail

◆ os_file_write_zeros()

dberr_t os_file_write_zeros ( pfs_os_file_t  file,
const char *  name,
ulint  page_size,
os_offset_t  start,
ulint  len 
)

Fill the pages with NULs.

Parameters
[in]fileFile handle
[in]nameFile name
[in]page_sizephysical page size
[in]startOffset from the start of the file in bytes
[in]lenLength in bytes
Returns
DB_SUCCESS or error code

◆ os_free_block()

void os_free_block ( file::Block block)
noexcept

Free a page after sync IO.

Parameters
[in,out]blockThe block to free/release

◆ os_get_free_space()

dberr_t os_get_free_space ( const char *  path,
uint64_t &  free_space 
)

Get available free space on disk.

Parameters
[in]pathpathname of a directory or file in disk
[out]free_spacefree space available in bytes
Returns
DB_SUCCESS if all OK

◆ os_is_o_direct_supported()

bool os_is_o_direct_supported ( )

Determine if O_DIRECT is supported.

Return values
trueif O_DIRECT is supported.
falseif O_DIRECT is not supported.

◆ os_is_sparse_file_supported()

bool os_is_sparse_file_supported ( pfs_os_file_t  fh)

Check if the file system supports sparse files.

Warning: On POSIX systems we try and punch a hole from offset 0 to the system configured page size. This should only be called on an empty file.

Note: On Windows we use the name and on Unices we use the file handle.

Parameters
[in]fhFile handle for the file - if opened
Returns
true if the file system supports sparse files

◆ pfs_os_aio_func()

static dberr_t pfs_os_aio_func ( IORequest type,
AIO_mode  mode,
const char *  name,
pfs_os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
bool  read_only,
fil_node_t m1,
void *  m2,
ut::Location  location 
)
inlinestatic

NOTE! Please use the corresponding macro os_aio(), not directly this function! Performance schema wrapper function of os_aio() which requests an asynchronous I/O operation.

Parameters
[in]typeIO request context
[in]modeIO mode
[in]nameName of the file or path as NUL terminated string
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nhow many bytes to read or write; this must not cross a file boundary; in AIO this must be a block size multiple
[in]read_onlyif true read only mode checks are enforced
[in,out]m1Message for the AIO handler, (can be used to identify a completed AIO operation); ignored if mode is OS_AIO_SYNC
[in,out]m2message for the AIO handler (can be used to identify a completed AIO operation); ignored if mode is OS_AIO_SYNC
[in]locationlocation where func invoked
Returns
DB_SUCCESS if request was queued successfully, false if fail

◆ pfs_os_file_close_func()

static bool pfs_os_file_close_func ( pfs_os_file_t  file,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_close(), not directly this function! A performance schema instrumented wrapper function for os_file_close().

Parameters
[in]filehandle to a file
[in]src_locationlocation where func invoked
Returns
true if success

◆ pfs_os_file_copy_func()

static dberr_t pfs_os_file_copy_func ( pfs_os_file_t  src,
os_offset_t  src_offset,
pfs_os_file_t  dest,
os_offset_t  dest_offset,
uint  size,
ut::Location  src_location 
)
inlinestatic

copy data from one file to another file.

Data is read/written at current file offset.

Parameters
[in]srcfile handle to copy from
[in]src_offsetoffset to copy from
[in]destfile handle to copy to
[in]dest_offsetoffset to copy to
[in]sizenumber of bytes to copy
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if successful

◆ pfs_os_file_create_func()

static pfs_os_file_t pfs_os_file_create_func ( mysql_pfs_key_t  key,
const char *  name,
ulint  create_mode,
ulint  purpose,
ulint  type,
bool  read_only,
bool *  success,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_create(), not directly this function! A performance schema wrapper function for os_file_create().

Add instrumentation to monitor file creation/open.

Parameters
[in]keyPerformance Schema Key
[in]namename of the file or path as a null-terminated string
[in]create_modecreate mode
[in]purposeOS_FILE_AIO, if asynchronous, non-buffered I/O is desired, OS_FILE_NORMAL, if any normal file; NOTE that it also depends on type, os_aio_.. and srv_.. variables whether we really use async I/O or unbuffered I/O: look in the function source code for the exact rules
[in]typeOS_DATA_FILE or OS_LOG_FILE
[in]read_onlyif true read only mode checks are enforced
[out]successtrue if succeeded
[in]src_locationlocation where func invoked
Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error

◆ pfs_os_file_create_simple_no_error_handling_func()

static pfs_os_file_t pfs_os_file_create_simple_no_error_handling_func ( mysql_pfs_key_t  key,
const char *  name,
ulint  create_mode,
ulint  access_type,
bool  read_only,
mode_t  umask,
bool *  success,
ut::Location  src_location 
)
inlinestatic

Clang on Windows warns about umask not found.

NOTE! Please use the corresponding macro os_file_create_simple_no_error_handling(), not directly this function! A performance schema instrumented wrapper function for os_file_create_simple_no_error_handling(). Add instrumentation to monitor file creation/open.

Parameters
[in]keyPerformance Schema Key
[in]namename of the file or path as a null-terminated string
[in]create_modecreate mode
[in]access_typeOS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or OS_FILE_READ_ALLOW_DELETE; the last option is used by a backup program reading the file
[in]read_onlyif true read only mode checks are enforced
[in]umaskUNIX access permission to be set when creating a file. Use os_umask_default to use global default umask.
[out]successtrue if succeeded
[in]src_locationlocation where func invoked
Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error

◆ pfs_os_file_delete_func()

static bool pfs_os_file_delete_func ( mysql_pfs_key_t  key,
const char *  name,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_delete(), not directly this function! This is the performance schema instrumented wrapper function for os_file_delete()

Parameters
[in]keyPerformance Schema Key
[in]nameold file path as a null-terminated string
[in]src_locationlocation where func invoked
Returns
true if success

◆ pfs_os_file_delete_if_exists_func()

static bool pfs_os_file_delete_if_exists_func ( mysql_pfs_key_t  key,
const char *  name,
bool *  exist,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_delete_if_exists(), not directly this function! This is the performance schema instrumented wrapper function for os_file_delete_if_exists()

Parameters
[in]keyPerformance Schema Key
[in]nameold file path as a null-terminated string
[in]existindicate if file pre-exist
[in]src_locationlocation where func invoked
Returns
true if success

◆ pfs_os_file_flush_func()

static bool pfs_os_file_flush_func ( pfs_os_file_t  file,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_flush(), not directly this function! This is the performance schema instrumented wrapper function for os_file_flush() which flushes the write buffers of a given file to the disk.

Flushes the write buffers of a given file to the disk.

Parameters
[in]fileOpen file handle
[in]src_locationlocation where func invoked
Returns
true if success

◆ pfs_os_file_read_first_page_func()

static dberr_t pfs_os_file_read_first_page_func ( IORequest type,
const char *  file_name,
pfs_os_file_t  file,
void *  buf,
ulint  n,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_read_first_page(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_first_page() which requests a synchronous read operation of page 0 of IBD file.

Parameters
[in,out]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]nnumber of bytes to read
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_read_func()

static dberr_t pfs_os_file_read_func ( IORequest type,
const char *  file_name,
pfs_os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_read(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read() which requests a synchronous read operation.

Parameters
[in,out]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_read_no_error_handling_func()

static dberr_t pfs_os_file_read_no_error_handling_func ( IORequest type,
const char *  file_name,
pfs_os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
ulint o,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_read_no_error_handling(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_no_error_handling_func() which requests a synchronous read operation.

Parameters
[in,out]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
[out]onumber of bytes actually read
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_read_no_error_handling_int_fd_func()

static dberr_t pfs_os_file_read_no_error_handling_int_fd_func ( IORequest type,
const char *  file_name,
int  file,
void *  buf,
os_offset_t  offset,
ulint  n,
ulint o,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_read_no_error_handling_int_fd(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_no_error_handling_int_fd_func() which requests a synchronous read operation on files with int type descriptors.

Parameters
[in,out]typeIO request context
[in]file_namefile name
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
[out]onumber of bytes actually read
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_rename_func()

static bool pfs_os_file_rename_func ( mysql_pfs_key_t  key,
const char *  oldpath,
const char *  newpath,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_rename(), not directly this function! This is the performance schema instrumented wrapper function for os_file_rename()

Parameters
[in]keyPerformance Schema Key
[in]oldpathold file path as a null-terminated string
[in]newpathnew file path
[in]src_locationlocation where func invoked
Returns
true if success

◆ pfs_os_file_write_func()

static dberr_t pfs_os_file_write_func ( IORequest type,
const char *  name,
pfs_os_file_t  file,
const void *  buf,
os_offset_t  offset,
ulint  n,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_write(), not directly this function! This is the performance schema instrumented wrapper function for os_file_write() which requests a synchronous write operation.

Parameters
[in,out]typeIO request context
[in]nameName of the file or path as NUL terminated string
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_write_int_fd_func()

static dberr_t pfs_os_file_write_int_fd_func ( IORequest type,
const char *  name,
int  file,
const void *  buf,
os_offset_t  offset,
ulint  n,
ut::Location  src_location 
)
inlinestatic

NOTE! Please use the corresponding macro os_file_write(), not directly this function! This is the performance schema instrumented wrapper function for os_file_write() which requests a synchronous write operation on files with int type descriptors.

Parameters
[in,out]typeIO request context
[in]nameName of the file or path as NUL terminated string
[in]fileOpen file handle
[out]bufbuffer where to read
[in]offsetfile offset where to read
[in]nnumber of bytes to read
[in]src_locationlocation where func invoked
Returns
DB_SUCCESS if request was successful

Variable Documentation

◆ innodb_arch_file_key

mysql_pfs_key_t innodb_arch_file_key
extern

◆ innodb_clone_file_key

mysql_pfs_key_t innodb_clone_file_key
extern

◆ innodb_data_file_key

mysql_pfs_key_t innodb_data_file_key
extern

◆ innodb_dblwr_file_key

mysql_pfs_key_t innodb_dblwr_file_key
extern

◆ innodb_log_file_key

mysql_pfs_key_t innodb_log_file_key
extern

◆ innodb_tablespace_open_file_key

mysql_pfs_key_t innodb_tablespace_open_file_key
extern

◆ innodb_temp_file_key

mysql_pfs_key_t innodb_temp_file_key
extern

◆ NUM_RETRIES_ON_PARTIAL_IO

constexpr size_t NUM_RETRIES_ON_PARTIAL_IO = 10
constexpr

Number of retries for partial I/O's.

◆ OS_AIO_N_PENDING_IOS_PER_THREAD

const ulint OS_AIO_N_PENDING_IOS_PER_THREAD = 32
static

Win NT does not allow more than 64.

◆ OS_BUFFERED_FILE

const ulint OS_BUFFERED_FILE = 102
static

◆ OS_CLONE_DATA_FILE

const ulint OS_CLONE_DATA_FILE = 103
static

◆ OS_CLONE_LOG_FILE

const ulint OS_CLONE_LOG_FILE = 104
static

◆ OS_DATA_FILE

const ulint OS_DATA_FILE = 100
static

Types for file create.

◆ OS_DBLWR_FILE

const ulint OS_DBLWR_FILE = 105
static

Doublewrite files.

◆ OS_FD_CLOSED

constexpr os_fd_t OS_FD_CLOSED = -1
staticconstexpr

◆ OS_FILE_ACCESS_VIOLATION

const ulint OS_FILE_ACCESS_VIOLATION = 81
static

◆ OS_FILE_AIO

const ulint OS_FILE_AIO = 61
static

◆ OS_FILE_AIO_INTERRUPTED

const ulint OS_FILE_AIO_INTERRUPTED = 79
static

◆ OS_FILE_AIO_RESOURCES_RESERVED

const ulint OS_FILE_AIO_RESOURCES_RESERVED = 75
static

wait for OS aio resources to become available again

◆ OS_FILE_ALREADY_EXISTS

const ulint OS_FILE_ALREADY_EXISTS = 73
static

◆ OS_FILE_CLOSED

constexpr os_fd_t OS_FILE_CLOSED = OS_FD_CLOSED
staticconstexpr

◆ OS_FILE_DISK_FULL

const ulint OS_FILE_DISK_FULL = 72
static

◆ OS_FILE_ERROR_MAX

const ulint OS_FILE_ERROR_MAX = 100
static

◆ OS_FILE_ERROR_NOT_SPECIFIED

const ulint OS_FILE_ERROR_NOT_SPECIFIED = 77
static

◆ OS_FILE_INSUFFICIENT_RESOURCE

const ulint OS_FILE_INSUFFICIENT_RESOURCE = 78
static

◆ OS_FILE_LOG_BLOCK_SIZE

constexpr uint32_t OS_FILE_LOG_BLOCK_SIZE = 512
constexpr

The next value should be smaller or equal to the smallest sector size used on any disk.

A log block is required to be a portion of disk which is written so that if the start and the end of a block get written to disk, then the whole block gets written. This should be true even in most cases of a crash: if this fails for a log block, then it is equivalent to a media failure in the log.

◆ OS_FILE_MAX_PATH

constexpr uint32_t OS_FILE_MAX_PATH = 4000
constexpr

◆ OS_FILE_NAME_TOO_LONG

const ulint OS_FILE_NAME_TOO_LONG = 82
static

◆ OS_FILE_NORMAL

const ulint OS_FILE_NORMAL = 62
static

◆ OS_FILE_NOT_FOUND

const ulint OS_FILE_NOT_FOUND = 71
static

Error codes from os_file_get_last_error.

◆ OS_FILE_OPERATION_ABORTED

const ulint OS_FILE_OPERATION_ABORTED = 80
static

◆ OS_FILE_PATH_ERROR

const ulint OS_FILE_PATH_ERROR = 74
static

◆ OS_FILE_READ_ALLOW_DELETE

const ulint OS_FILE_READ_ALLOW_DELETE = 555
static

Used by MySQLBackup.

◆ OS_FILE_READ_ONLY

const ulint OS_FILE_READ_ONLY = 333
static

◆ OS_FILE_READ_WRITE

const ulint OS_FILE_READ_WRITE = 444
static

◆ OS_FILE_SHARING_VIOLATION

const ulint OS_FILE_SHARING_VIOLATION = 76
static

◆ OS_FILE_TOO_MANY_OPENED

const ulint OS_FILE_TOO_MANY_OPENED = 83
static

◆ os_fsync_threshold

unsigned long long os_fsync_threshold
extern

◆ os_has_said_disk_full

bool os_has_said_disk_full
extern

◆ os_innodb_umask_default

constexpr mode_t os_innodb_umask_default = std::numeric_limits<mode_t>::max()
constexpr

A magic constant for the umask parameter that indicates caller wants the os_innodb_umask value to be used.

The os_innodb_umask is a static value, private to this module, and to the file creation methods, so it should not be used directly.

◆ OS_LOG_FILE

const ulint OS_LOG_FILE = 101
static

◆ os_n_file_reads

ulint os_n_file_reads
extern

◆ os_n_file_writes

ulint os_n_file_writes
extern

◆ os_n_fsyncs

ulint os_n_fsyncs
extern

◆ os_n_pending_reads

std::atomic<ulint> os_n_pending_reads
extern

Number of pending read operations.

◆ os_n_pending_writes

std::atomic<ulint> os_n_pending_writes
extern

Number of pending write operations.

◆ OS_REDO_LOG_ARCHIVE_FILE

const ulint OS_REDO_LOG_ARCHIVE_FILE = 105
static

Redo log archive file.