MySQL  8.0.19
Source Code Documentation
os0file.cc File Reference
#include "os0file.h"
#include "fil0fil.h"
#include "ha_prototypes.h"
#include "log0log.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "sql_const.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "os0event.h"
#include "os0thread.h"
#include <errno.h>
#include <lz4.h>
#include "my_aes.h"
#include "my_rnd.h"
#include "mysql/service_mysql_keyring.h"
#include "mysqld.h"
#include <sys/types.h>
#include <zlib.h>
#include <ctime>
#include <functional>
#include <new>
#include <vector>

Classes

struct  Block
 Blocks for doing IO, used in the transparent compression and encryption code. More...
 
struct  Slot
 The asynchronous I/O context. More...
 
class  AIO
 The asynchronous i/o array structure. More...
 
class  AIOHandler
 Generic AIO Handler methods. More...
 
class  SyncFileIO
 Helper class for doing synchronous file IO. More...
 
class  SimulatedAIOHandler
 Simulated AIO handler for reaping IO requests. More...
 

Macros

#define BUFFER_BLOCK_SIZE   ((ulint)(UNIV_PAGE_SIZE * 1.3))
 Block buffer size. More...
 
#define OS_AIO_VALIDATE_SKIP   13
 
#define USE_FILE_LOCK
 

Typedefs

typedef std::vector< BlockBlocks
 For storing the allocated blocks. More...
 

Functions

bool os_is_o_direct_supported ()
 Determine if O_DIRECT is supported. More...
 
bool buf_flush_page_cleaner_is_active ()
 Checks if the page_cleaner is in active state. More...
 
static bool os_aio_validate ()
 Validates the consistency of the aio system. More...
 
static bool os_file_handle_error (const char *name, const char *operation)
 Does error handling when a file operation fails. 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...
 
static bool os_file_handle_error_no_exit (const char *name, const char *operation, bool on_error_silent)
 Does error handling when a file operation fails. More...
 
static dberr_t os_file_io_complete (const IORequest &type, os_file_t fh, byte *buf, byte *scratch, ulint src_len, os_offset_t offset, ulint len)
 Decompress after a read and punch a hole in the file if it was a write. More...
 
static dberr_t os_aio_simulated_handler (ulint global_segment, fil_node_t **m1, void **m2, IORequest *type)
 Does simulated AIO. More...
 
static bool os_file_can_delete (const char *name)
 Check the file type and determine if it can be deleted. More...
 
static Blockos_alloc_block ()
 Allocate a page for sync IO. More...
 
static void os_free_block (Block *block)
 Free a page after sync IO. 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...
 
byteos_file_compress_page (Compression compression, ulint block_size, byte *src, ulint src_len, byte *dst, ulint *dst_len)
 Compress a data page. More...
 
static bool os_aio_validate_skip ()
 Validates the consistency the aio system some of the time. More...
 
static int os_file_lock (int fd, const char *name)
 Obtain an exclusive lock on a file. More...
 
FILE * os_file_create_tmpfile (const char *path)
 Creates a temporary 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...
 
UNIV_INLINE bool os_file_is_root (const char *path, const char *last_slash)
 Check if the path refers to the root of a drive using a pointer to the last directory separator that the caller has fixed. More...
 
static char * os_file_get_parent_dir (const char *path)
 Return the parent directory component of a null-terminated path. More...
 
dberr_t os_file_create_subdirs_if_needed (const char *path)
 Creates all missing subdirectories along the given path. More...
 
static Blockos_file_compress_page (IORequest &type, void *&buf, ulint *n)
 Allocate the buffer for IO on a transparently compressed table. More...
 
static Blockos_file_encrypt_page (const IORequest &type, void *&buf, ulint *n)
 Encrypt a page content when write it to disk. More...
 
static Blockos_file_encrypt_log (const IORequest &type, void *&buf, byte *&scratch, ulint *n)
 Encrypt log blocks content when write it to disk. More...
 
static dberr_t os_file_punch_hole_posix (os_file_t fh, os_offset_t off, os_offset_t len)
 Free storage space associated with a section of the file. More...
 
static ulint os_file_get_last_error_low (bool report_all_errors, bool on_error_silent)
 Retrieves the last error number if an error occurs in a file io function. More...
 
static int os_file_fsync_posix (os_file_t file)
 Wrapper to fsync(2) that retries the call on some errors. More...
 
static bool os_file_status_posix (const char *path, bool *exists, os_file_type_t *type)
 Check the existence and type of the given file. 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...
 
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...
 
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_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...
 
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...
 
bool os_file_delete_if_exists_func (const char *name, bool *exist)
 Deletes a file if it exists. More...
 
bool os_file_delete_func (const char *name)
 Deletes a file. 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...
 
os_offset_t os_file_get_size (pfs_os_file_t file)
 Gets a file size. More...
 
os_file_size_t os_file_get_size (const char *filename)
 Gets a file size. More...
 
static dberr_t os_get_free_space_posix (const char *path, uint64_t &free_space)
 Get available free space on disk. More...
 
static dberr_t os_file_get_status_posix (const char *path, os_file_stat_t *stat_info, struct stat *statinfo, bool check_rw_perm, bool read_only)
 This function returns information about the specified file. More...
 
static bool os_file_truncate_posix (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_set_eof (FILE *file)
 Truncates a file at its current position. 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...
 
static ssize_t os_file_io (const IORequest &in_type, os_file_t file, void *buf, ulint n, os_offset_t offset, dberr_t *err)
 Does a syncronous read or write depending upon the type specified In case of partial reads/writes the function tries NUM_RETRIES_ON_PARTIAL_IO times to read/write the complete data. More...
 
static ssize_t os_file_pwrite (IORequest &type, os_file_t file, const byte *buf, ulint n, os_offset_t offset, dberr_t *err)
 Does a synchronous write operation in Posix. More...
 
static dberr_t os_file_write_page (IORequest &type, const char *name, os_file_t file, const byte *buf, os_offset_t offset, ulint n)
 Requests a synchronous write operation. More...
 
static ssize_t os_file_pread (IORequest &type, os_file_t file, void *buf, ulint n, os_offset_t offset, dberr_t *err)
 Does a synchronous read operation in Posix. More...
 
static dberr_t os_file_read_page (IORequest &type, const char *file_name, os_file_t file, void *buf, os_offset_t offset, ulint n, ulint *o, bool exit_on_err)
 Requests a synchronous positioned read operation. 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...
 
static bool os_file_handle_error_cond_exit (const char *name, const char *operation, bool should_exit, bool on_error_silent)
 Does error handling when a file operation fails. 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...
 
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_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...
 
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 positioned 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 positioned read operation of page 0 of IBD file. More...
 
static dberr_t os_file_copy_read_write (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 using read, write. 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...
 
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 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...
 
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_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...
 
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_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...
 
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 AIO::s_writes. More...
 
void os_aio_simulated_wake_handler_threads ()
 Wakes up simulated aio i/o-handler threads if they have something to do. 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_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...
 
void os_file_set_umask (ulint umask)
 Set the file create umask. More...
 
ulint os_file_get_umask ()
 Get the file create umask. More...
 

Variables

unsigned long long os_fsync_threshold = 0
 
static const ulint IO_IBUF_SEGMENT = 0
 Insert buffer segment id. More...
 
static const ulint IO_LOG_SEGMENT = 1
 Log segment id. More...
 
static const ulint NUM_RETRIES_ON_PARTIAL_IO = 10
 Number of retries for partial I/O's. More...
 
static Blocksblock_cache
 Block collection. More...
 
static const size_t MAX_BLOCKS = 128
 Number of blocks to allocate for sync read/writes. More...
 
static ulint os_io_ptr_align = UNIV_SECTOR_SIZE
 Disk sector size of aligning write buffer for DIRECT_IO. More...
 
static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
 Umask for creating files. More...
 
static const ulint OS_AIO_MERGE_N_CONSECUTIVE = 64
 In simulated aio, merge at most this many consecutive i/os. More...
 
static os_event_tos_aio_segment_wait_events = NULL
 Array of events used in simulated AIO. More...
 
static ulint os_aio_n_segments = ULINT_UNDEFINED
 Number of asynchronous I/O segments. More...
 
static bool os_aio_recommend_sleep_for_read_threads = false
 If the following is true, read i/o handler threads try to wait until a batch of new read requests have been posted. More...
 
ulint os_n_file_reads = 0
 
static ulint os_bytes_read_since_printout = 0
 
ulint os_n_file_writes = 0
 
ulint os_n_fsyncs = 0
 
static ulint os_n_file_reads_old = 0
 
static ulint os_n_file_writes_old = 0
 
static ulint os_n_fsyncs_old = 0
 
ulint os_n_pending_writes = 0
 Number of pending write operations. More...
 
ulint os_n_pending_reads = 0
 Number of pending read operations. More...
 
static ib_time_monotonic_t os_last_printout
 
bool os_has_said_disk_full = false
 
uint page_zip_level
 Default Zip compression level. More...
 

Detailed Description

The interface to the operating system file i/o primitives

Created 10/21/1995 Heikki Tuuri

Macro Definition Documentation

◆ BUFFER_BLOCK_SIZE

#define BUFFER_BLOCK_SIZE   ((ulint)(UNIV_PAGE_SIZE * 1.3))

Block buffer size.

◆ OS_AIO_VALIDATE_SKIP

#define OS_AIO_VALIDATE_SKIP   13

◆ USE_FILE_LOCK

#define USE_FILE_LOCK

Typedef Documentation

◆ Blocks

typedef std::vector<Block> Blocks

For storing the allocated blocks.

Function Documentation

◆ buf_flush_page_cleaner_is_active()

bool buf_flush_page_cleaner_is_active ( )

Checks if the page_cleaner is in active state.

Checks if the page_cleaner is in active state.

◆ 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]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 
)

Waits for an AIO operation to complete.

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

◆ os_aio_refresh_stats()

void os_aio_refresh_stats ( )

Refreshes the statistics used to print per-second averages.

◆ os_aio_simulated_handler()

static dberr_t os_aio_simulated_handler ( ulint  global_segment,
fil_node_t **  m1,
void **  m2,
IORequest type 
)
static

Does simulated AIO.

This function should be called by an i/o-handler thread.

Parameters
[in]global_segmentThe number of the segment in the aio arrays to await 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
[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 argument
[in]typeIO context
Returns
DB_SUCCESS or error code

This function should be called by an i/o-handler thread.

Parameters
[in]global_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
[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 argument
[in]typeIO context
Returns
DB_SUCCESS or error code

Found a slot that has already completed its IO

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

static bool os_aio_validate ( )
static

Validates the consistency of the aio system.

Validates the consistency the aio system.

Returns
true if ok

◆ os_aio_validate_skip()

static bool os_aio_validate_skip ( )
static

Validates the consistency the aio system some of the time.

Returns
true if ok or the check was skipped

Try os_aio_validate() every this many times

The os_aio_validate() call skip counter. Use a signed type because of the race condition below.

◆ os_aio_wait_until_no_pending_writes()

void os_aio_wait_until_no_pending_writes ( )

Waits until there are no pending writes in AIO::s_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()

static Block* os_alloc_block ( )
static

Allocate a page for sync IO.

Returns
pointer to page

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

static bool os_file_can_delete ( const char *  name)
static

Check the file type and determine if it can be deleted.

Parameters
[in]nameFilename/Path to check
Returns
true if it's a file or a symlink and can be deleted

◆ 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 close
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]

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

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.

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

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

copy data from one file to another file using read, write.

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

Creates all missing subdirectories along the given path.

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)

Creates a temporary file.

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

static Block* os_file_encrypt_log ( const IORequest type,
void *&  buf,
byte *&  scratch,
ulint *  n 
)
static

Encrypt log blocks content when write it to disk.

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

◆ os_file_encrypt_page()

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

Encrypt a page content when write it to disk.

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

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

static int os_file_fsync_posix ( os_file_t  file)
static

Wrapper to fsync(2) that retries the call on some errors.

Returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

Parameters
[in]fileopen file handle
Returns
0 if success, -1 otherwise

◆ 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 printed for all errors
Returns
error number, or OS error number + 100

◆ os_file_get_last_error_low()

static ulint os_file_get_last_error_low ( bool  report_all_errors,
bool  on_error_silent 
)
static

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 of all errors
[in]on_error_silenttrue then don't print any diagnostic to the log
Returns
error number, or OS error number + 100

◆ os_file_get_parent_dir()

static char* os_file_get_parent_dir ( const char *  path)
static

Return the parent directory component of a null-terminated path.

Return a new buffer containing the string up to, but not including, the final component of the path. The path returned will not contain a trailing separator. Do not return a root path, return NULL instead. The final component trimmed off may be a filename or a directory name. If the final component is the only component of the path, return NULL. It is the caller's responsibility to free the returned string after it is no longer needed.

Parameters
[in]pathPath name
Returns
own: parent directory of the path

◆ 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 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
[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_status_posix()

static dberr_t os_file_get_status_posix ( const char *  path,
os_file_stat_t stat_info,
struct stat *  statinfo,
bool  check_rw_perm,
bool  read_only 
)
static

This function returns information about the specified file.

Parameters
[in]pathpathname of the file
[out]stat_infoinformation of a file in a directory
[in,out]statinfoinformation 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

◆ os_file_get_umask()

ulint os_file_get_umask ( )

Get the file create umask.

Returns
the umask to use for file creation.

◆ os_file_handle_error()

static bool os_file_handle_error ( const char *  name,
const char *  operation 
)
static

Does error handling when a file operation fails.

Parameters
[in]nameFile name or NULL
[in]operationName of operation e.g., "read", "write"
Returns
true if we should retry the operation
Parameters
[in]namename of a file or NULL
[in]operationoperation name that failed
Returns
true if we should retry the operation

◆ os_file_handle_error_cond_exit()

static bool os_file_handle_error_cond_exit ( const char *  name,
const char *  operation,
bool  should_exit,
bool  on_error_silent 
)
static

Does error handling when a file operation fails.

Conditionally exits (calling srv_fatal_error()) based on should_exit value and the error type, if should_exit is true then on_error_silent is ignored.

Parameters
[in]namename of a file or NULL
[in]operationoperation
[in]should_exitcall srv_fatal_error() on an unknown error, if this parameter is true
[in]on_error_silentif true then don't print any message to the log iff it is an unknown non-fatal error
Returns
true if we should retry the operation

◆ os_file_handle_error_no_exit()

static bool os_file_handle_error_no_exit ( const char *  name,
const char *  operation,
bool  on_error_silent 
)
static

Does error handling when a file operation fails.

Parameters
[in]nameFile name or NULL
[in]operationName of operation e.g., "read", "write"
[in]on_error_silentif true then don't print any message to the log.
Returns
true if we should retry the operation
Parameters
[in]namename of a file or NULL
[in]operationoperation name that failed
[in]on_error_silentif true then don't print any message to the log.
Returns
true if we should retry the operation

◆ os_file_io()

static ssize_t os_file_io ( const IORequest in_type,
os_file_t  file,
void *  buf,
ulint  n,
os_offset_t  offset,
dberr_t err 
)
static

Does a syncronous read or write depending upon the type specified In case of partial reads/writes the function tries NUM_RETRIES_ON_PARTIAL_IO times to read/write the complete data.

Parameters
[in]in_typeIO flags
[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]errDB_SUCCESS or error code
Returns
number of bytes read/written, -1 if error

◆ os_file_io_complete()

static dberr_t os_file_io_complete ( const IORequest type,
os_file_t  fh,
byte buf,
byte scratch,
ulint  src_len,
os_offset_t  offset,
ulint  len 
)
static

Decompress after a read and punch a hole in the file if it was a write.

Parameters
[in]typeIO context
[in]fhOpen file handle
[in,out]bufBuffer to transform
[in,out]scratchScratch area for read decompression
[in]src_lenLength of the buffer before compression
[in]offsetfile offset from the start where to read
[in]lenCompressed buffer length for write and size of buf len for read
Returns
DB_SUCCESS or error code
Parameters
[in]typeIO context
[in]fhOpen file handle
[in,out]bufBuffer to transform
[in,out]scratchScratch area for read decompression
[in]src_lenLength of the buffer before compression
[in]offsetfile offset from the start where to read
[in]lenUsed buffer length for write and output buf len for read
Returns
DB_SUCCESS or error code

◆ os_file_is_root()

UNIV_INLINE bool os_file_is_root ( const char *  path,
const char *  last_slash 
)

Check if the path refers to the root of a drive using a pointer to the last directory separator that the caller has fixed.

Parameters
[in]pathpath name
[in]last_slashlast directory separator in the path
Returns
true if this path is a drive root, false if not

◆ os_file_lock()

static int os_file_lock ( int  fd,
const char *  name 
)
static

Obtain an exclusive lock on a file.

Parameters
[in]fdfile descriptor
[in]namefile name
Returns
0 on success

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

static ssize_t os_file_pread ( IORequest type,
os_file_t  file,
void *  buf,
ulint  n,
os_offset_t  offset,
dberr_t err 
)
static

Does a synchronous read operation in Posix.

Parameters
[in]typeIO flags
[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]errDB_SUCCESS or error code
Returns
number of bytes read, -1 if error

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

static dberr_t os_file_punch_hole_posix ( os_file_t  fh,
os_offset_t  off,
os_offset_t  len 
)
static

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

static ssize_t os_file_pwrite ( IORequest type,
os_file_t  file,
const byte buf,
ulint  n,
os_offset_t  offset,
dberr_t err 
)
static

Does a synchronous write operation in Posix.

Parameters
[in]typeIO context
[in]filehandle to an open file
[out]bufbuffer from which to write
[in]nnumber of bytes to read, starting from offset
[in]offsetfile offset from the start where to read
[out]errDB_SUCCESS or error code
Returns
number of bytes written, -1 if error

◆ 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 positioned read operation of page 0 of IBD file.

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 positioned read operation.

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.

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
[out]onumber of bytes actually read
Returns
DB_SUCCESS or error code

◆ os_file_read_page()

static dberr_t os_file_read_page ( IORequest type,
const char *  file_name,
os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
ulint *  o,
bool  exit_on_err 
)
static

Requests a synchronous positioned read operation.

Returns
DB_SUCCESS if request was successful, false if fail
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
[in]exit_on_errif true then exit on error
Returns
DB_SUCCESS or error code

The read will succeed but decompress can fail for various reasons.

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

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

◆ 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]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_status_posix()

static bool os_file_status_posix ( const char *  path,
bool exists,
os_file_type_t type 
)
static

Check the existence and type of the given file.

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

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

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 Requests a synchronous write operation.

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

static dberr_t os_file_write_page ( IORequest type,
const char *  name,
os_file_t  file,
const byte buf,
os_offset_t  offset,
ulint  n 
)
static

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

static void os_free_block ( Block block)
static

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

static dberr_t os_get_free_space_posix ( const char *  path,
uint64_t &  free_space 
)
static

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

Variable Documentation

◆ block_cache

Blocks* block_cache
static

Block collection.

◆ IO_IBUF_SEGMENT

const ulint IO_IBUF_SEGMENT = 0
static

Insert buffer segment id.

◆ IO_LOG_SEGMENT

const ulint IO_LOG_SEGMENT = 1
static

Log segment id.

◆ MAX_BLOCKS

const size_t MAX_BLOCKS = 128
static

Number of blocks to allocate for sync read/writes.

◆ NUM_RETRIES_ON_PARTIAL_IO

const ulint NUM_RETRIES_ON_PARTIAL_IO = 10
static

Number of retries for partial I/O's.

◆ OS_AIO_MERGE_N_CONSECUTIVE

const ulint OS_AIO_MERGE_N_CONSECUTIVE = 64
static

In simulated aio, merge at most this many consecutive i/os.

◆ os_aio_n_segments

ulint os_aio_n_segments = ULINT_UNDEFINED
static

Number of asynchronous I/O segments.

Set by os_aio_init().

◆ os_aio_recommend_sleep_for_read_threads

bool os_aio_recommend_sleep_for_read_threads = false
static

If the following is true, read i/o handler threads try to wait until a batch of new read requests have been posted.

◆ os_aio_segment_wait_events

os_event_t* os_aio_segment_wait_events = NULL
static

Array of events used in simulated AIO.

◆ os_bytes_read_since_printout

ulint os_bytes_read_since_printout = 0
static

◆ os_fsync_threshold

unsigned long long os_fsync_threshold = 0

◆ os_has_said_disk_full

bool os_has_said_disk_full = false

◆ os_innodb_umask

ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
static

Umask for creating files.

◆ os_io_ptr_align

ulint os_io_ptr_align = UNIV_SECTOR_SIZE
static

Disk sector size of aligning write buffer for DIRECT_IO.

◆ os_last_printout

ib_time_monotonic_t os_last_printout
static

◆ os_n_file_reads

ulint os_n_file_reads = 0

◆ os_n_file_reads_old

ulint os_n_file_reads_old = 0
static

◆ os_n_file_writes

ulint os_n_file_writes = 0

◆ os_n_file_writes_old

ulint os_n_file_writes_old = 0
static

◆ os_n_fsyncs

ulint os_n_fsyncs = 0

◆ os_n_fsyncs_old

ulint os_n_fsyncs_old = 0
static

◆ os_n_pending_reads

ulint os_n_pending_reads = 0

Number of pending read operations.

◆ os_n_pending_writes

ulint os_n_pending_writes = 0

Number of pending write operations.

◆ page_zip_level

uint page_zip_level

Default Zip compression level.