MySQL  8.0.18
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 "univ.i"
#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  pfs_os_file_t
 Common file descriptor for file IO instrumentation with PFS on windows and other platforms. More...
 
struct  Encryption
 Encryption algorithm. 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 heirarchy using a depth first scan. More...
 
struct  Dir_Walker::Entry
 Directory names for the depth first directory scan. More...
 

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 : -1)
 Closes the file associated with C file descriptor fd. More...
 
#define OS_FILE_LOG_BLOCK_SIZE   512
 The next value should be smaller or equal to the smallest sector size used on any disk. More...
 
#define ENCRYPTION_IN_PROGRESS   (1 << 0)
 Flag bit to indicate if Encryption/Decryption is in progress. More...
 
#define UNENCRYPTION_IN_PROGRESS   (1 << 1)
 
#define OS_FILE_MAX_PATH   4000
 
#define register_pfs_file_open_begin(state, locker, key, op, name, src_file, src_line)
 
#define register_pfs_file_open_end(locker, file, result)
 
#define register_pfs_file_rename_begin(state, locker, key, op, name, src_file, src_line)
 
#define register_pfs_file_rename_end(locker, from, to, result)
 
#define register_pfs_file_close_begin(state, locker, key, op, name, src_file, src_line)
 
#define register_pfs_file_close_end(locker, result)
 
#define register_pfs_file_io_begin(state, locker, file, count, op, src_file, src_line)
 
#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(key, name, create, access, read_only, success)
 
#define os_file_create_simple_no_error_handling(key, name, create_mode, access, read_only, success)
 
#define os_file_close_pfs(file)   pfs_os_file_close_func(file, __FILE__, __LINE__)
 
#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)
 
#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, __FILE__, __LINE__)
 
#define os_file_write_int_fd(type, name, file, buf, offset, n)
 
#define os_file_flush_pfs(file)   pfs_os_file_flush_func(file, __FILE__, __LINE__)
 
#define os_file_rename(key, oldpath, newpath)   pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)
 
#define os_file_delete(key, name)   pfs_os_file_delete_func(key, name, __FILE__, __LINE__)
 
#define os_file_delete_if_exists(key, name, exist)   pfs_os_file_delete_if_exists_func(key, name, exist, __FILE__, __LINE__)
 
#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)
 
#define IORequestLogRead   IORequest(IORequest::LOG | IORequest::READ)
 
#define IORequestLogWrite   IORequest(IORequest::LOG | IORequest::WRITE)
 

Typedefs

typedef ib_uint64_t os_offset_t
 File offset in bytes. More...
 
typedef int os_file_t
 File handle. More...
 
typedef void(* os_dir_cbk_t) (const char *path, const char *name)
 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  AIO_mode : size_t { AIO_mode::NORMAL = 21, AIO_mode::IBUF = 22, AIO_mode::LOG = 23, AIO_mode::SYNC = 24 }
 Modes for aio operations. More...
 

Functions

FILE * os_file_create_tmpfile (const char *path)
 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_delete)
 This function scans the contents of a directory and invokes the callback for each entry. More...
 
os_file_t os_file_create_simple_func (const char *name, ulint create_mode, ulint access_type, bool read_only, bool *success)
 NOTE! Use the corresponding macro os_file_create_simple(), not directly this function! A simple function to open or create a file. 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, bool *success)
 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. 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...
 
UNIV_INLINE pfs_os_file_t pfs_os_file_create_simple_func (mysql_pfs_key_t key, const char *name, ulint create_mode, ulint access_type, bool read_only, bool *success, const char *src_file, uint src_line)
 NOTE! Please use the corresponding macro os_file_create_simple(), not directly this function! A performance schema instrumented wrapper function for os_file_create_simple() which opens or creates a file. More...
 
UNIV_INLINE 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, bool *success, const char *src_file, uint src_line)
 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(). More...
 
UNIV_INLINE 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, const char *src_file, uint src_line)
 NOTE! Please use the corresponding macro os_file_create(), not directly this function! A performance schema wrapper function for os_file_create(). More...
 
UNIV_INLINE bool pfs_os_file_close_func (pfs_os_file_t file, const char *src_file, uint src_line)
 NOTE! Please use the corresponding macro os_file_close(), not directly this function! A performance schema instrumented wrapper function for os_file_close(). More...
 
UNIV_INLINE 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, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE dberr_t pfs_os_file_read_first_page_func (IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, ulint n, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE 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, const char *src_file, uint src_line)
 copy data from one file to another file. More...
 
UNIV_INLINE 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, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE 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, const char *src_file, ulint src_line)
 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...
 
UNIV_INLINE 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, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE 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, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE 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, const char *src_file, ulint src_line)
 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...
 
UNIV_INLINE bool pfs_os_file_flush_func (pfs_os_file_t file, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE bool pfs_os_file_rename_func (mysql_pfs_key_t key, const char *oldpath, const char *newpath, const char *src_file, uint src_line)
 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...
 
UNIV_INLINE bool pfs_os_file_delete_func (mysql_pfs_key_t key, const char *name, const char *src_file, uint src_line)
 
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...
 
UNIV_INLINE bool pfs_os_file_delete_if_exists_func (mysql_pfs_key_t key, const char *name, bool *exist, const char *src_file, uint src_line)
 
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 (const char *name, pfs_os_file_t file, os_offset_t offset, os_offset_t size, bool read_only, 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(), not directly this function! Requests a synchronous read operation. 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 the given file. 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, ulint n_slots_sync)
 Initializes the asynchronous io system. 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)
 This is the generic AIO handler interface function. 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...
 
char * innobase_mysql_tmpdir ()
 return any of the tmpdir path More...
 
int 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 (ulint umask)
 Set the file create umask. More...
 
ulint os_file_get_umask ()
 Get the 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 (const char *path, pfs_os_file_t fh)
 Check if the file system supports sparse files. More...
 
dberr_t os_file_decompress_page (bool dblwr_recover, 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...
 

Variables

bool os_has_said_disk_full
 
ulint os_n_pending_reads
 Number of pending read operations. More...
 
ulint os_n_pending_writes
 Number of pending write operations. More...
 
unsigned long long os_fsync_threshold
 
static const os_file_t OS_FILE_CLOSED = os_file_t(~0)
 
static const ulint ENCRYPTION_KEY_LEN = 32
 Encryption key length. More...
 
static const ulint ENCRYPTION_MAGIC_SIZE = 3
 Encryption magic bytes size. More...
 
static const char ENCRYPTION_KEY_MAGIC_V1 [] = "lCA"
 Encryption magic bytes for 5.7.11, it's for checking the encryption information version. More...
 
static const char ENCRYPTION_KEY_MAGIC_V2 [] = "lCB"
 Encryption magic bytes for 5.7.12+, it's for checking the encryption information version. More...
 
static const char ENCRYPTION_KEY_MAGIC_V3 [] = "lCC"
 Encryption magic bytes for 8.0.5+, it's for checking the encryption information version. More...
 
static const char ENCRYPTION_MASTER_KEY_PRIFIX [] = "INNODBKey"
 Encryption master key prifix. More...
 
static const ulint ENCRYPTION_MASTER_KEY_PRIFIX_LEN = 9
 Encryption master key prifix size. More...
 
static const ulint ENCRYPTION_MASTER_KEY_NAME_MAX_LEN = 100
 Encryption master key prifix size. More...
 
static const ulint ENCRYPTION_SERVER_UUID_LEN = 36
 UUID of server instance, it's needed for composing master key name. More...
 
static const ulint ENCRYPTION_INFO_SIZE
 Encryption information total size: magic number + master_key_id + key + iv + server_uuid + checksum. More...
 
static const ulint ENCRYPTION_INFO_MAX_SIZE
 Maximum size of Encryption information considering all formats v1, v2 & v3. More...
 
static const char ENCRYPTION_DEFAULT_MASTER_KEY [] = "DefaultMasterKey"
 Default master key for bootstrap. More...
 
static const ulint ENCRYPTION_DEFAULT_MASTER_KEY_ID = 0
 Default master key id for bootstrap. More...
 
static const uint ENCRYPTION_OPERATION_INFO_SIZE = 1
 (Un)Encryption Operation information size More...
 
static const uint ENCRYPTION_PROGRESS_INFO_SIZE = sizeof(uint)
 Encryption Progress information size. 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
 
mysql_pfs_key_t innodb_log_file_key
 
mysql_pfs_key_t innodb_temp_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
 
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_REDO_LOG_ARCHIVE_FILE = 105
 
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_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

◆ ENCRYPTION_IN_PROGRESS

#define ENCRYPTION_IN_PROGRESS   (1 << 0)

Flag bit to indicate if Encryption/Decryption is in progress.

◆ IORequestLogRead

#define IORequestLogRead   IORequest(IORequest::LOG | IORequest::READ)

◆ IORequestLogWrite

#define IORequestLogWrite   IORequest(IORequest::LOG | IORequest::WRITE)

◆ 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, __FILE__, __LINE__)
const string name("\ame\)
bool read_only
Definition: mysqld.cc:1054
UNIV_INLINE 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, const char *src_file, uint src_line)
NOTE! Please use the corresponding macro os_aio(), not directly this function! Performance schema wra...
int n
Definition: xcom_base.c:425
int type
Definition: http_common.h:411

◆ 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 : -1)

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, __FILE__, __LINE__)

◆ 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, __FILE__, \
__LINE__)
UNIV_INLINE 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, const char *src_file, uint src_line)
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, __FILE__, __LINE__)
const string name("\ame\)
bool read_only
Definition: mysqld.cc:1054
UNIV_INLINE 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, const char *src_file, uint src_line)
NOTE! Please use the corresponding macro os_file_create(), not directly this function! A performance ...
static const char * key
Definition: suite_stubs.c:14
int type
Definition: http_common.h:411

◆ os_file_create_simple

#define os_file_create_simple (   key,
  name,
  create,
  access,
  read_only,
  success 
)
Value:
success, __FILE__, __LINE__)
const string name("\ame\)
bool read_only
Definition: mysqld.cc:1054
static const char * key
Definition: suite_stubs.c:14
UNIV_INLINE pfs_os_file_t pfs_os_file_create_simple_func(mysql_pfs_key_t key, const char *name, ulint create_mode, ulint access_type, bool read_only, bool *success, const char *src_file, uint src_line)
NOTE! Please use the corresponding macro os_file_create_simple(), not directly this function! A perfo...

◆ 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, success, __FILE__, __LINE__)
UNIV_INLINE 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, bool *success, const char *src_file, uint src_line)
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().
const string name("\ame\)
bool read_only
Definition: mysqld.cc:1054
static const char * key
Definition: suite_stubs.c:14

◆ os_file_delete

#define os_file_delete (   key,
  name 
)    pfs_os_file_delete_func(key, name, __FILE__, __LINE__)

◆ os_file_delete_if_exists

#define os_file_delete_if_exists (   key,
  name,
  exist 
)    pfs_os_file_delete_if_exists_func(key, name, exist, __FILE__, __LINE__)

◆ 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, __FILE__, __LINE__)

◆ 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_LOG_BLOCK_SIZE

#define OS_FILE_LOG_BLOCK_SIZE   512

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

#define OS_FILE_MAX_PATH   4000

◆ 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:
pfs_os_file_read_first_page_func(type, file_name, file, buf, n, __FILE__, \
__LINE__)
UNIV_INLINE dberr_t pfs_os_file_read_first_page_func(IORequest &type, const char *file_name, pfs_os_file_t file, void *buf, ulint n, const char *src_file, uint src_line)
NOTE! Please use the corresponding macro os_file_read_first_page(), not directly this function! This ...
int n
Definition: xcom_base.c:425
int type
Definition: http_common.h:411

◆ 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:
type, file_name, file, buf, offset, n, o, __FILE__, __LINE__)
UNIV_INLINE 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, const char *src_file, ulint src_line)
NOTE! Please use the corresponding macro os_file_read_no_error_handling_int_fd(), not directly this f...
int n
Definition: xcom_base.c:425
int type
Definition: http_common.h:411

◆ os_file_read_no_error_handling_pfs

#define os_file_read_no_error_handling_pfs (   type,
  file_name,
  file,
  buf,
  offset,
  n,
 
)
Value:
pfs_os_file_read_no_error_handling_func(type, file_name, file, buf, offset, \
n, o, __FILE__, __LINE__)
int n
Definition: xcom_base.c:425
int type
Definition: http_common.h:411
UNIV_INLINE 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, const char *src_file, uint src_line)
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 
)
Value:
pfs_os_file_read_func(type, file_name, file, buf, offset, n, __FILE__, \
__LINE__)
UNIV_INLINE 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, const char *src_file, uint src_line)
NOTE! Please use the corresponding macro os_file_read(), not directly this function! This is the perf...
int n
Definition: xcom_base.c:425
int type
Definition: http_common.h:411

◆ os_file_rename

#define os_file_rename (   key,
  oldpath,
  newpath 
)    pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)

◆ 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:
pfs_os_file_write_int_fd_func(type, name, file, buf, offset, n, __FILE__, \
__LINE__)
const string name("\ame\)
UNIV_INLINE 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, const char *src_file, ulint src_line)
NOTE! Please use the corresponding macro os_file_write(), not directly this function! This is the per...
int n
Definition: xcom_base.c:425
int type
Definition: http_common.h:411

◆ 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, __FILE__, __LINE__)

◆ register_pfs_file_close_begin

#define register_pfs_file_close_begin (   state,
  locker,
  key,
  op,
  name,
  src_file,
  src_line 
)
Value:
do { \
locker = PSI_FILE_CALL(get_thread_file_name_locker)(state, key.m_value, \
op, name, &locker); \
if (locker != NULL) { \
PSI_FILE_CALL(start_file_close_wait) \
(locker, src_file, static_cast<uint>(src_line)); \
} \
} while (0)
const string name("\ame\)
#define PSI_FILE_CALL(M)
Definition: psi_file.h:31
unsigned int uint
Definition: uca-dump.cc:29
static const char * key
Definition: suite_stubs.c:14
#define NULL
Definition: types.h:55

◆ register_pfs_file_close_end

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

◆ register_pfs_file_io_begin

#define register_pfs_file_io_begin (   state,
  locker,
  file,
  count,
  op,
  src_file,
  src_line 
)
Value:
do { \
locker = \
PSI_FILE_CALL(get_thread_file_stream_locker)(state, file.m_psi, op); \
if (locker != NULL) { \
PSI_FILE_CALL(start_file_wait) \
(locker, count, src_file, static_cast<uint>(src_line)); \
} \
} while (0)
ssize_t count
Definition: memcached.c:386
unsigned int uint
Definition: uca-dump.cc:29
#define NULL
Definition: types.h:55

◆ register_pfs_file_io_end

#define register_pfs_file_io_end (   locker,
  count 
)
Value:
do { \
if (locker != NULL) { \
PSI_FILE_CALL(end_file_wait)(locker, count); \
} \
} while (0)
ssize_t count
Definition: memcached.c:386
#define NULL
Definition: types.h:55

◆ register_pfs_file_open_begin

#define register_pfs_file_open_begin (   state,
  locker,
  key,
  op,
  name,
  src_file,
  src_line 
)
Value:
do { \
locker = PSI_FILE_CALL(get_thread_file_name_locker)(state, key.m_value, \
op, name, &locker); \
if (locker != NULL) { \
PSI_FILE_CALL(start_file_open_wait) \
(locker, src_file, static_cast<uint>(src_line)); \
} \
} while (0)
const string name("\ame\)
#define PSI_FILE_CALL(M)
Definition: psi_file.h:31
unsigned int uint
Definition: uca-dump.cc:29
static const char * key
Definition: suite_stubs.c:14
#define NULL
Definition: types.h:55

◆ register_pfs_file_open_end

#define register_pfs_file_open_end (   locker,
  file,
  result 
)
Value:
do { \
if (locker != NULL) { \
file.m_psi = PSI_FILE_CALL(end_file_open_wait)(locker, result); \
} \
} while (0)
struct result result
Definition: result.h:37
#define PSI_FILE_CALL(M)
Definition: psi_file.h:31
#define NULL
Definition: types.h:55

◆ register_pfs_file_rename_begin

#define register_pfs_file_rename_begin (   state,
  locker,
  key,
  op,
  name,
  src_file,
  src_line 
)
Value:
register_pfs_file_open_begin(state, locker, key, op, name, src_file, \
static_cast<uint>(src_line))
const string name("\ame\)
static const char * key
Definition: suite_stubs.c:14
#define register_pfs_file_open_begin(state, locker, key, op, name, src_file, src_line)
Definition: os0file.h:1025

◆ register_pfs_file_rename_end

#define register_pfs_file_rename_end (   locker,
  from,
  to,
  result 
)
Value:
do { \
if (locker != NULL) { \
PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result); \
} \
} while (0)
struct result result
Definition: result.h:37
#define NULL
Definition: types.h:55

◆ UNENCRYPTION_IN_PROGRESS

#define UNENCRYPTION_IN_PROGRESS   (1 << 1)

Typedef Documentation

◆ os_dir_cbk_t

typedef void(* os_dir_cbk_t) (const char *path, const char *name)

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_file_t

typedef int os_file_t

File handle.

◆ os_offset_t

typedef ib_uint64_t os_offset_t

File offset in bytes.

Enumeration Type Documentation

◆ AIO_mode

enum 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.

LOG 

Asynchronous i/o for the log.

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()

int 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 on –tmpdir location. This function is defined in ha_innodb.cc.

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

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

Parameters
[in]pathlocation for creating temporary file
Returns
temporary file descriptor, or < 0 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.


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]nnumber of bytes to read
[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
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]nnumber of bytes to read
[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 AIO_mode::SYNC
[in,out]m2message for the AIO handler (can be used to identify a completed AIO operation); ignored if mode is AIO_mode::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 
)

This is the generic AIO handler interface function.

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, segment 1 the log I/O thread, then follow the non-ibuf read threads, and as the last are the non-ibuf write threads; if this is ULINT_UNDEFINED, then it means that sync AIO is used, and this parameter is ignored
[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

This is the generic AIO handler interface function.

This function is used to wait 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, segment 1 the log I/O thread, then follow the non-ibuf read threads, and as the last are the non-ibuf write threads; if this is ULINT_UNDEFINED, then it means that sync AIO is used, and this parameter is ignored
[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,
ulint  n_slots_sync 
)

Initializes the asynchronous io system.

Creates one array each for ibuf and log i/o. Also creates one array each for read and write where each array is divided logically into n_read_segs and n_write_segs respectively. The caller must create an i/o handler thread for each segment in these arrays. This function also creates the sync array. No i/o handler thread needs to be created for that

Parameters
[in]n_readersnumber of reader threads
[in]n_writersnumber of writer threads
[in]n_slots_syncnumber of slots in the sync aio array

Creates one array each for ibuf and log i/o. 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. This function also creates the sync array. No i/o handler thread needs to be created for that

Parameters
[in]n_readersnumber of reader threads
[in]n_writersnumber of writer threads
[in]n_slots_syncnumber of slots in the sync aio array

◆ 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
[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_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_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_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]fileown: handle to a file
Returns
true if success

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

Parameters
[in]fileHandle to close
Returns
true if success

◆ os_file_compress_page()

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_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
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.

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


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 or OS_LOG_FILE
[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
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 or OS_LOG_FILE
[in]read_onlytrue, if read only checks should be enforcedm
[in]successtrue if succeeded
Returns
handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error

◆ os_file_create_simple_func()

os_file_t os_file_create_simple_func ( const char *  name,
ulint  create_mode,
ulint  access_type,
bool  read_only,
bool success 
)

NOTE! Use the corresponding macro os_file_create_simple(), 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 or OS_FILE_READ_WRITE
[in]read_onlyif true read only mode checks are enforced
[out]successtrue if succeed, false if error
Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error
Parameters
[in]namename of the file or path as a null-terminated string
[in]create_modecreate mode
[in]access_typeOS_FILE_READ_ONLY or OS_FILE_READ_WRITE
[in]read_onlyif true, read only checks are enforced
[out]successtrue if succeed, false if error
Returns
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,
bool success 
)

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
[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 ( const char *  path)

Create a temporary file.

This function is like tmpfile(3), but the temporary file is created in the given parameter path. If the path is null then it will create the file in the mysql server configuration parameter (–tmpdir).

Parameters
[in]pathlocation for creating temporary file
Returns
temporary file handle, or NULL on error

Create a temporary file.

This function is like tmpfile(3), but the temporary file is created in the given parameter path. If the path is NULL then it will create the file in the MySQL server configuration parameter (–tmpdir).

Parameters
[in]pathlocation for creating temporary file
Returns
temporary file handle, or NULL on error

◆ os_file_decompress_page()

dberr_t os_file_decompress_page ( bool  dblwr_recover,
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_recovertrue 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
[in]dst_lenSize 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_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

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 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]filenamehandle to a file
Returns
file size if OK, else set m_total_size to ~0 and m_alloc_size to errno
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
Parameters
[in]filehandle to an open 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
[in]stat_infoinformation of a file in a directory
[in]check_rw_permfor testing whether the file can be opened in RW mode
[in]read_onlyif true read only mode checks are enforced
Returns
DB_SUCCESS if all OK
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_get_umask()

ulint os_file_get_umask ( )

Get the file create umask.

Returns
the umask to use for file creation.

◆ 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

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.

Returns
DB_SUCCESS if request was successful, DB_IO_ERROR on failure
Parameters
[in]typeIO flags
[in]file_namefile name
[in]filehandle to an open file
[out]bufbuffer where to read
[in]nnumber of bytes to read, starting from offset
Returns
DB_SUCCESS or error code

◆ 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(), not directly this function! Requests a synchronous read operation.

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

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

Returns
DB_SUCCESS if request was successful, DB_IO_ERROR on failure
Parameters
[in]typeIO flags
[in]file_namefile name
[in]filehandle to an open file
[out]bufbuffer where to read
[in]offsetfile offset from the start where to read
[in]nnumber of bytes to read, starting from offset
Returns
DB_SUCCESS or error code

◆ 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
DB_SUCCESS if request was successful, DB_IO_ERROR on failure
Parameters
[in]typeIO flags
[in]file_namefile name
[in]filehandle to an open file
[out]bufbuffer where to read
[in]offsetfile offset from the start where to read
[in]nnumber of bytes to read, starting from offset
[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

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  read_only,
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]read_onlyEnable read-only checks if true
[in]flushFlush file content to disk
Returns
true if success

◆ os_file_set_umask()

void os_file_set_umask ( ulint  umask)

Set the file create umask.

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

Set the file create umask.

Parameters
[in]umaskThe umask to use for 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 the given file.

Parameters
[in]pathpathname of the file
[out]existstrue if file exists
[out]typetype of the file (if it exists)
Returns
true if call succeeded
Parameters
[in]pathpath name of file
[out]existstrue if the 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 preserved is smaller or equal than current size of file.

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

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

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

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_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 ( const char *  path,
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]pathFile name
[in]fhFile handle for the file - if opened
Returns
true if the file system supports sparse files

◆ pfs_os_aio_func()

UNIV_INLINE 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,
const char *  src_file,
uint  src_line 
)

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]nnumber of bytes to read
[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]src_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was queued successfully, false if fail

◆ pfs_os_file_close_func()

UNIV_INLINE bool pfs_os_file_close_func ( pfs_os_file_t  file,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
true if success

◆ pfs_os_file_copy_func()

UNIV_INLINE 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,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if successful

◆ pfs_os_file_create_func()

UNIV_INLINE 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,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the 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_func()

UNIV_INLINE pfs_os_file_t pfs_os_file_create_simple_func ( mysql_pfs_key_t  key,
const char *  name,
ulint  create_mode,
ulint  access_type,
bool  read_only,
bool success,
const char *  src_file,
uint  src_line 
)

NOTE! Please use the corresponding macro os_file_create_simple(), not directly this function! A performance schema instrumented wrapper function for os_file_create_simple() which opens or creates a file.

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 or OS_FILE_READ_WRITE
[in]read_onlyif true read only mode checks are enforced
[out]successtrue if succeeded
[in]src_filefile name where func invoked
[in]src_lineline where the 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()

UNIV_INLINE 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,
bool success,
const char *  src_file,
uint  src_line 
)

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
[out]successtrue if succeeded
[in]src_filefile name where func invoked
[in]src_lineline where the 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()

UNIV_INLINE bool pfs_os_file_delete_func ( mysql_pfs_key_t  key,
const char *  name,
const char *  src_file,
uint  src_line 
)


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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
true if success

◆ pfs_os_file_delete_if_exists_func()

UNIV_INLINE bool pfs_os_file_delete_if_exists_func ( mysql_pfs_key_t  key,
const char *  name,
bool exist,
const char *  src_file,
uint  src_line 
)


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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
true if success

◆ pfs_os_file_flush_func()

UNIV_INLINE bool pfs_os_file_flush_func ( pfs_os_file_t  file,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
true if success

◆ pfs_os_file_read_first_page_func()

UNIV_INLINE dberr_t pfs_os_file_read_first_page_func ( IORequest type,
const char *  file_name,
pfs_os_file_t  file,
void *  buf,
ulint  n,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_read_func()

UNIV_INLINE 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,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_read_no_error_handling_func()

UNIV_INLINE 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,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_read_no_error_handling_int_fd_func()

UNIV_INLINE 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,
const char *  src_file,
ulint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_rename_func()

UNIV_INLINE bool pfs_os_file_rename_func ( mysql_pfs_key_t  key,
const char *  oldpath,
const char *  newpath,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
true if success

◆ pfs_os_file_write_func()

UNIV_INLINE 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,
const char *  src_file,
uint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was successful

◆ pfs_os_file_write_int_fd_func()

UNIV_INLINE 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,
const char *  src_file,
ulint  src_line 
)

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_filefile name where func invoked
[in]src_lineline where the func invoked
Returns
DB_SUCCESS if request was successful

Variable Documentation

◆ ENCRYPTION_DEFAULT_MASTER_KEY

const char ENCRYPTION_DEFAULT_MASTER_KEY[] = "DefaultMasterKey"
static

Default master key for bootstrap.

◆ ENCRYPTION_DEFAULT_MASTER_KEY_ID

const ulint ENCRYPTION_DEFAULT_MASTER_KEY_ID = 0
static

Default master key id for bootstrap.

◆ ENCRYPTION_INFO_MAX_SIZE

const ulint ENCRYPTION_INFO_MAX_SIZE
static
Initial value:
=
uint32_t uint32
Definition: my_inttypes.h:66
static const ulint ENCRYPTION_INFO_SIZE
Encryption information total size: magic number + master_key_id + key + iv + server_uuid + checksum...
Definition: os0file.h:258

Maximum size of Encryption information considering all formats v1, v2 & v3.

◆ ENCRYPTION_INFO_SIZE

const ulint ENCRYPTION_INFO_SIZE
static
Initial value:
=
static const ulint ENCRYPTION_KEY_LEN
Encryption key length.
Definition: os0file.h:227
static const ulint ENCRYPTION_SERVER_UUID_LEN
UUID of server instance, it&#39;s needed for composing master key name.
Definition: os0file.h:254
uint32_t uint32
Definition: my_inttypes.h:66
static const ulint ENCRYPTION_MAGIC_SIZE
Encryption magic bytes size.
Definition: os0file.h:230

Encryption information total size: magic number + master_key_id + key + iv + server_uuid + checksum.

◆ ENCRYPTION_KEY_LEN

const ulint ENCRYPTION_KEY_LEN = 32
static

Encryption key length.

◆ ENCRYPTION_KEY_MAGIC_V1

const char ENCRYPTION_KEY_MAGIC_V1[] = "lCA"
static

Encryption magic bytes for 5.7.11, it's for checking the encryption information version.

◆ ENCRYPTION_KEY_MAGIC_V2

const char ENCRYPTION_KEY_MAGIC_V2[] = "lCB"
static

Encryption magic bytes for 5.7.12+, it's for checking the encryption information version.

◆ ENCRYPTION_KEY_MAGIC_V3

const char ENCRYPTION_KEY_MAGIC_V3[] = "lCC"
static

Encryption magic bytes for 8.0.5+, it's for checking the encryption information version.

◆ ENCRYPTION_MAGIC_SIZE

const ulint ENCRYPTION_MAGIC_SIZE = 3
static

Encryption magic bytes size.

◆ ENCRYPTION_MASTER_KEY_NAME_MAX_LEN

const ulint ENCRYPTION_MASTER_KEY_NAME_MAX_LEN = 100
static

Encryption master key prifix size.

◆ ENCRYPTION_MASTER_KEY_PRIFIX

const char ENCRYPTION_MASTER_KEY_PRIFIX[] = "INNODBKey"
static

Encryption master key prifix.

◆ ENCRYPTION_MASTER_KEY_PRIFIX_LEN

const ulint ENCRYPTION_MASTER_KEY_PRIFIX_LEN = 9
static

Encryption master key prifix size.

◆ ENCRYPTION_OPERATION_INFO_SIZE

const uint ENCRYPTION_OPERATION_INFO_SIZE = 1
static

(Un)Encryption Operation information size

◆ ENCRYPTION_PROGRESS_INFO_SIZE

const uint ENCRYPTION_PROGRESS_INFO_SIZE = sizeof(uint)
static

Encryption Progress information size.

◆ ENCRYPTION_SERVER_UUID_LEN

const ulint ENCRYPTION_SERVER_UUID_LEN = 36
static

UUID of server instance, it's needed for composing master key name.

◆ innodb_arch_file_key

mysql_pfs_key_t innodb_arch_file_key

◆ innodb_clone_file_key

mysql_pfs_key_t innodb_clone_file_key

◆ innodb_data_file_key

mysql_pfs_key_t innodb_data_file_key

◆ innodb_log_file_key

mysql_pfs_key_t innodb_log_file_key

◆ innodb_tablespace_open_file_key

mysql_pfs_key_t innodb_tablespace_open_file_key

◆ innodb_temp_file_key

mysql_pfs_key_t innodb_temp_file_key

◆ 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_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

const os_file_t OS_FILE_CLOSED = os_file_t(~0)
static

◆ 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_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_fsync_threshold

unsigned long long os_fsync_threshold

◆ os_has_said_disk_full

bool os_has_said_disk_full

◆ OS_LOG_FILE

const ulint OS_LOG_FILE = 101
static

◆ os_n_file_reads

ulint os_n_file_reads

◆ os_n_file_writes

ulint os_n_file_writes

◆ os_n_fsyncs

ulint os_n_fsyncs

◆ os_n_pending_reads

ulint os_n_pending_reads

Number of pending read operations.

◆ os_n_pending_writes

ulint os_n_pending_writes

Number of pending write operations.

◆ OS_REDO_LOG_ARCHIVE_FILE

const ulint OS_REDO_LOG_ARCHIVE_FILE = 105
static