mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 17:14:30 +02:00
Merge 10.0 into 10.1
Significantly reduce the amount of InnoDB, XtraDB and Mariabackup code changes by defining pfs_os_file_t as something that is transparently compatible with os_file_t.
This commit is contained in:
commit
65e1399e64
255 changed files with 7289 additions and 4965 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/***********************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2013, 2017, MariaDB Corporation.
|
||||
|
||||
|
|
@ -80,6 +80,25 @@ typedef int os_file_t;
|
|||
# define OS_FILE_FROM_FD(fd) fd
|
||||
#endif
|
||||
|
||||
/** File descriptor with optional PERFORMANCE_SCHEMA instrumentation */
|
||||
struct pfs_os_file_t
|
||||
{
|
||||
/** The wrapped file handle */
|
||||
os_file_t m_file;
|
||||
#ifdef UNIV_PFS_IO
|
||||
/** PERFORMANCE_SCHEMA descriptor */
|
||||
struct PSI_file *m_psi;
|
||||
/** Default constructor */
|
||||
pfs_os_file_t() : m_file(), m_psi(NULL) {}
|
||||
#endif
|
||||
/** Implicit type conversion.
|
||||
@return the wrapped file handle */
|
||||
operator os_file_t() const { return m_file; }
|
||||
/** Assignment operator.
|
||||
@param[in] file file handle to be assigned */
|
||||
void operator=(os_file_t file) { m_file = file; }
|
||||
};
|
||||
|
||||
/** Umask for creating files */
|
||||
extern ulint os_innodb_umask;
|
||||
|
||||
|
|
@ -207,6 +226,8 @@ extern mysql_pfs_key_t innodb_file_temp_key;
|
|||
various file I/O operations with performance schema.
|
||||
1) register_pfs_file_open_begin() and register_pfs_file_open_end() are
|
||||
used to register file creation, opening, closing and renaming.
|
||||
2) register_pfs_file_rename_begin() and register_pfs_file_rename_end()
|
||||
are used to register file renaming
|
||||
2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
|
||||
used to register actual file read, write and flush
|
||||
3) register_pfs_file_close_begin() and register_pfs_file_close_end()
|
||||
|
|
@ -216,17 +237,30 @@ are used to register file deletion operations*/
|
|||
do { \
|
||||
locker = PSI_FILE_CALL(get_thread_file_name_locker)( \
|
||||
state, key, op, name, &locker); \
|
||||
if (UNIV_LIKELY(locker != NULL)) { \
|
||||
if (locker != NULL) { \
|
||||
PSI_FILE_CALL(start_file_open_wait)( \
|
||||
locker, src_file, src_line); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define register_pfs_file_open_end(locker, file) \
|
||||
# define register_pfs_file_open_end(locker, file, result) \
|
||||
do { \
|
||||
if (UNIV_LIKELY(locker != NULL)) { \
|
||||
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(\
|
||||
locker, file); \
|
||||
if (locker != NULL) { \
|
||||
file.m_psi = PSI_FILE_CALL( \
|
||||
end_file_open_wait)( \
|
||||
locker, result); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define register_pfs_file_rename_begin(state, locker, key, op, name, \
|
||||
src_file, src_line) \
|
||||
register_pfs_file_open_begin(state, locker, key, op, name, \
|
||||
src_file, src_line) \
|
||||
|
||||
# define register_pfs_file_rename_end(locker, result) \
|
||||
do { \
|
||||
if (locker != NULL) { \
|
||||
PSI_FILE_CALL(end_file_open_wait)(locker, result); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
@ -252,9 +286,9 @@ do { \
|
|||
# define register_pfs_file_io_begin(state, locker, file, count, op, \
|
||||
src_file, src_line) \
|
||||
do { \
|
||||
locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)( \
|
||||
state, file, op); \
|
||||
if (UNIV_LIKELY(locker != NULL)) { \
|
||||
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, src_line); \
|
||||
} \
|
||||
|
|
@ -262,7 +296,7 @@ do { \
|
|||
|
||||
# define register_pfs_file_io_end(locker, count) \
|
||||
do { \
|
||||
if (UNIV_LIKELY(locker != NULL)) { \
|
||||
if (locker != NULL) { \
|
||||
PSI_FILE_CALL(end_file_wait)(locker, count); \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
@ -280,7 +314,9 @@ os_file_rename
|
|||
os_aio
|
||||
os_file_read
|
||||
os_file_read_no_error_handling
|
||||
os_file_read_no_error_handling_int_fd
|
||||
os_file_write
|
||||
os_file_write_int_fd
|
||||
|
||||
The wrapper functions have the prefix of "innodb_". */
|
||||
|
||||
|
|
@ -315,11 +351,20 @@ The wrapper functions have the prefix of "innodb_". */
|
|||
pfs_os_file_read_no_error_handling_func(file, buf, offset, n, \
|
||||
__FILE__, __LINE__)
|
||||
|
||||
# define os_file_write(name, file, buf, offset, n) \
|
||||
pfs_os_file_write_func(name, file, buf, offset, \
|
||||
# define os_file_read_no_error_handling_int_fd( \
|
||||
file, buf, offset, n) \
|
||||
pfs_os_file_read_no_error_handling_int_fd_func( \
|
||||
file, buf, offset, n, __FILE__, __LINE__)
|
||||
|
||||
# define os_file_write(name, file, buf, offset, n) \
|
||||
pfs_os_file_write_func(name, file, buf, offset, \
|
||||
n, __FILE__, __LINE__)
|
||||
|
||||
# define os_file_flush(file) \
|
||||
# define os_file_write_int_fd(name, file, buf, offset, n) \
|
||||
pfs_os_file_write_int_fd_func(name, file, buf, offset, \
|
||||
n, __FILE__, __LINE__)
|
||||
|
||||
# define os_file_flush(file) \
|
||||
pfs_os_file_flush_func(file, __FILE__, __LINE__)
|
||||
|
||||
# define os_file_rename(key, oldpath, newpath) \
|
||||
|
|
@ -345,22 +390,29 @@ to original un-instrumented file I/O APIs */
|
|||
os_file_create_simple_no_error_handling_func( \
|
||||
name, create_mode, access, success, atomic_writes)
|
||||
|
||||
# define os_file_close(file) os_file_close_func(file)
|
||||
# define os_file_close(file) \
|
||||
os_file_close_func(file)
|
||||
|
||||
# define os_aio(type, is_log, mode, name, file, buf, offset, n, page_size, message1, \
|
||||
message2, write_size) \
|
||||
os_aio_func(type, is_log, mode, name, file, buf, offset, n, \
|
||||
page_size, message1, message2, write_size)
|
||||
|
||||
# define os_file_read(file, buf, offset, n) \
|
||||
# define os_file_read(file, buf, offset, n) \
|
||||
os_file_read_func(file, buf, offset, n)
|
||||
|
||||
# define os_file_read_no_error_handling(file, buf, offset, n) \
|
||||
os_file_read_no_error_handling_func(file, buf, offset, n)
|
||||
# define os_file_read_no_error_handling_int_fd( \
|
||||
file, buf, offset, n) \
|
||||
os_file_read_no_error_handling_func(file, buf, offset, n)
|
||||
|
||||
# define os_file_write_int_fd(name, file, buf, offset, n) \
|
||||
os_file_write_func(name, file, buf, offset, n)
|
||||
# define os_file_write(name, file, buf, offset, n) \
|
||||
os_file_write_func(name, file, buf, offset, n)
|
||||
|
||||
|
||||
# define os_file_flush(file) os_file_flush_func(file)
|
||||
|
||||
# define os_file_rename(key, oldpath, newpath) \
|
||||
|
|
@ -512,7 +564,7 @@ A simple function to open or create a file.
|
|||
@return own: handle to the file, not defined if error, error number
|
||||
can be retrieved with os_file_get_last_error */
|
||||
UNIV_INTERN
|
||||
os_file_t
|
||||
pfs_os_file_t
|
||||
os_file_create_simple_no_error_handling_func(
|
||||
/*=========================================*/
|
||||
const char* name, /*!< in: name of the file or path as a
|
||||
|
|
@ -544,7 +596,7 @@ Opens an existing file or creates a new.
|
|||
@return own: handle to the file, not defined if error, error number
|
||||
can be retrieved with os_file_get_last_error */
|
||||
UNIV_INTERN
|
||||
os_file_t
|
||||
pfs_os_file_t
|
||||
os_file_create_func(
|
||||
/*================*/
|
||||
const char* name, /*!< in: name of the file or path as a
|
||||
|
|
@ -615,7 +667,7 @@ os_file_create_simple() which opens or creates a file.
|
|||
@return own: handle to the file, not defined if error, error number
|
||||
can be retrieved with os_file_get_last_error */
|
||||
UNIV_INLINE
|
||||
os_file_t
|
||||
pfs_os_file_t
|
||||
pfs_os_file_create_simple_func(
|
||||
/*===========================*/
|
||||
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
|
||||
|
|
@ -638,7 +690,7 @@ monitor file creation/open.
|
|||
@return own: handle to the file, not defined if error, error number
|
||||
can be retrieved with os_file_get_last_error */
|
||||
UNIV_INLINE
|
||||
os_file_t
|
||||
pfs_os_file_t
|
||||
pfs_os_file_create_simple_no_error_handling_func(
|
||||
/*=============================================*/
|
||||
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
|
||||
|
|
@ -664,7 +716,7 @@ Add instrumentation to monitor file creation/open.
|
|||
@return own: handle to the file, not defined if error, error number
|
||||
can be retrieved with os_file_get_last_error */
|
||||
UNIV_INLINE
|
||||
os_file_t
|
||||
pfs_os_file_t
|
||||
pfs_os_file_create_func(
|
||||
/*====================*/
|
||||
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
|
||||
|
|
@ -695,7 +747,7 @@ UNIV_INLINE
|
|||
ibool
|
||||
pfs_os_file_close_func(
|
||||
/*===================*/
|
||||
os_file_t file, /*!< in, own: handle to a file */
|
||||
pfs_os_file_t file, /*!< in, own: handle to a file */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line);/*!< in: line where the func invoked */
|
||||
/*******************************************************************//**
|
||||
|
|
@ -708,7 +760,7 @@ UNIV_INLINE
|
|||
ibool
|
||||
pfs_os_file_read_func(
|
||||
/*==================*/
|
||||
os_file_t file, /*!< in: handle to a file */
|
||||
pfs_os_file_t file, /*!< in: handle to a file */
|
||||
void* buf, /*!< in: buffer where to read */
|
||||
os_offset_t offset, /*!< in: file offset where to read */
|
||||
ulint n, /*!< in: number of bytes to read */
|
||||
|
|
@ -726,7 +778,7 @@ UNIV_INLINE
|
|||
ibool
|
||||
pfs_os_file_read_no_error_handling_func(
|
||||
/*====================================*/
|
||||
os_file_t file, /*!< in: handle to a file */
|
||||
pfs_os_file_t file, /*!< in: handle to a file */
|
||||
void* buf, /*!< in: buffer where to read */
|
||||
os_offset_t offset, /*!< in: file offset where to read */
|
||||
ulint n, /*!< in: number of bytes to read */
|
||||
|
|
@ -748,7 +800,7 @@ pfs_os_aio_func(
|
|||
ulint mode, /*!< in: OS_AIO_NORMAL etc. I/O mode */
|
||||
const char* name, /*!< in: name of the file or path as a
|
||||
null-terminated string */
|
||||
os_file_t file, /*!< in: handle to a file */
|
||||
pfs_os_file_t file, /*!< in: handle to a file */
|
||||
void* buf, /*!< in: buffer where to read or from which
|
||||
to write */
|
||||
os_offset_t offset, /*!< in: file offset where to read or write */
|
||||
|
|
@ -781,7 +833,7 @@ pfs_os_file_write_func(
|
|||
/*===================*/
|
||||
const char* name, /*!< in: name of the file or path as a
|
||||
null-terminated string */
|
||||
os_file_t file, /*!< in: handle to a file */
|
||||
pfs_os_file_t file, /*!< in: handle to a file */
|
||||
const void* buf, /*!< in: buffer from which to write */
|
||||
os_offset_t offset, /*!< in: file offset where to write */
|
||||
ulint n, /*!< in: number of bytes to write */
|
||||
|
|
@ -798,7 +850,7 @@ UNIV_INLINE
|
|||
ibool
|
||||
pfs_os_file_flush_func(
|
||||
/*===================*/
|
||||
os_file_t file, /*!< in, own: handle to a file */
|
||||
pfs_os_file_t file, /*!< in, own: handle to a file */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line);/*!< in: line where the func invoked */
|
||||
|
||||
|
|
@ -869,7 +921,7 @@ UNIV_INTERN
|
|||
os_offset_t
|
||||
os_file_get_size(
|
||||
/*=============*/
|
||||
os_file_t file) /*!< in: handle to a file */
|
||||
pfs_os_file_t file) /*!< in: handle to a file */
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
/** Set the size of a newly created file.
|
||||
@param[in] name file name
|
||||
|
|
@ -881,7 +933,7 @@ UNIV_INTERN
|
|||
bool
|
||||
os_file_set_size(
|
||||
const char* name,
|
||||
os_file_t file,
|
||||
pfs_os_file_t file,
|
||||
os_offset_t size,
|
||||
bool is_sparse = false)
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
|
|
@ -1122,7 +1174,7 @@ os_aio_func(
|
|||
caution! */
|
||||
const char* name, /*!< in: name of the file or path as a
|
||||
null-terminated string */
|
||||
os_file_t file, /*!< in: handle to a file */
|
||||
pfs_os_file_t file, /*!< in: handle to a file */
|
||||
void* buf, /*!< in: buffer where to read or from which
|
||||
to write */
|
||||
os_offset_t offset, /*!< in: file offset where to read or write */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue