Commit 3dd7b0a8 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove OS_FILE_ON_ERROR_NO_EXIT

Ever since commit 412ee033
or commit a440d6ed
InnoDB should generally not abort when failing to open or create files.
In Datafile::open_or_create() we had failed to set the flag
to avoid abort() on failure, but everywhere else we were setting it.

We may still call abort() via os_file_handle_error().

Reviewed by: Vladislav Vaintroub
parent 7f7329f0
...@@ -1900,8 +1900,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept ...@@ -1900,8 +1900,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept
ut_ad(!log.is_opened()); ut_ad(!log.is_opened());
bool success; bool success;
log.m_file= log.m_file=
os_file_create_func(get_log_file_path().c_str(), os_file_create_func(get_log_file_path().c_str(), OS_FILE_OPEN,
OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_NORMAL, OS_LOG_FILE, false, &success); OS_FILE_NORMAL, OS_LOG_FILE, false, &success);
ut_a(success); ut_a(success);
ut_a(log.is_opened()); ut_a(log.is_opened());
......
...@@ -361,8 +361,7 @@ static bool fil_node_open_file_low(fil_node_t *node) ...@@ -361,8 +361,7 @@ static bool fil_node_open_file_low(fil_node_t *node)
bool success; bool success;
node->handle= os_file_create(innodb_data_file_key, node->name, node->handle= os_file_create(innodb_data_file_key, node->name,
node->is_raw_disk node->is_raw_disk
? OS_FILE_OPEN_RAW | OS_FILE_ON_ERROR_NO_EXIT ? OS_FILE_OPEN_RAW : OS_FILE_OPEN,
: OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_AIO, type, OS_FILE_AIO, type,
srv_read_only_mode, &success); srv_read_only_mode, &success);
...@@ -1922,7 +1921,7 @@ fil_ibd_create( ...@@ -1922,7 +1921,7 @@ fil_ibd_create(
file = os_file_create( file = os_file_create(
innodb_data_file_key, path, innodb_data_file_key, path,
OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_CREATE,
OS_FILE_AIO, type, srv_read_only_mode, &success); OS_FILE_AIO, type, srv_read_only_mode, &success);
if (!success) { if (!success) {
......
...@@ -109,22 +109,21 @@ struct pfs_os_file_t ...@@ -109,22 +109,21 @@ struct pfs_os_file_t
/** Options for os_file_create_func @{ */ /** Options for os_file_create_func @{ */
enum os_file_create_t { enum os_file_create_t {
OS_FILE_OPEN = 51, /*!< to open an existing file (if /** create a new file */
doesn't exist, error) */ OS_FILE_CREATE= 0,
OS_FILE_CREATE, /*!< to create new file (if /** open an existing file */
exists, error) */ OS_FILE_OPEN,
OS_FILE_OPEN_RAW, /*!< to open a raw device or disk /** retry opening an existing file */
partition */ OS_FILE_OPEN_RETRY,
OS_FILE_OPEN_RETRY, /*!< open with retry */ /** open a raw block device */
OS_FILE_OPEN_RAW,
/** Flags that can be combined with the above values. Please ensure
that the above values stay below 128. */ /** do not display diagnostic messages */
OS_FILE_ON_ERROR_SILENT= 4,
OS_FILE_ON_ERROR_NO_EXIT = 128, /*!< do not exit on unknown errors */
OS_FILE_ON_ERROR_SILENT = 256 /*!< don't print diagnostic messages to OS_FILE_CREATE_SILENT= OS_FILE_CREATE | OS_FILE_ON_ERROR_SILENT,
the log unless it is a fatal error, OS_FILE_OPEN_SILENT= OS_FILE_OPEN | OS_FILE_ON_ERROR_SILENT,
this flag is only used if OS_FILE_OPEN_RETRY_SILENT= OS_FILE_OPEN_RETRY | OS_FILE_ON_ERROR_SILENT
ON_ERROR_NO_EXIT is set */
}; };
static const ulint OS_FILE_READ_ONLY = 333; static const ulint OS_FILE_READ_ONLY = 333;
...@@ -346,7 +345,7 @@ A simple function to open or create a file. ...@@ -346,7 +345,7 @@ A simple function to open or create a file.
pfs_os_file_t pfs_os_file_t
os_file_create_simple_func( os_file_create_simple_func(
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint access_type, ulint access_type,
bool read_only, bool read_only,
bool* success); bool* success);
...@@ -355,7 +354,7 @@ os_file_create_simple_func( ...@@ -355,7 +354,7 @@ os_file_create_simple_func(
os_file_create_simple_no_error_handling(), not directly this function! os_file_create_simple_no_error_handling(), not directly this function!
A simple function to open or create a file. A simple function to open or create a file.
@param[in] name name of the file or path as a null-terminated string @param[in] name name of the file or path as a null-terminated string
@param[in] create_mode create mode @param[in] create_mode OS_FILE_CREATE or OS_FILE_OPEN
@param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or @param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
OS_FILE_READ_ALLOW_DELETE; the last option OS_FILE_READ_ALLOW_DELETE; the last option
is used by a backup program reading the file is used by a backup program reading the file
...@@ -366,7 +365,7 @@ A simple function to open or create a file. ...@@ -366,7 +365,7 @@ A simple function to open or create a file.
pfs_os_file_t pfs_os_file_t
os_file_create_simple_no_error_handling_func( os_file_create_simple_no_error_handling_func(
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint access_type, ulint access_type,
bool read_only, bool read_only,
bool* success) bool* success)
...@@ -400,7 +399,7 @@ Opens an existing file or creates a new. ...@@ -400,7 +399,7 @@ Opens an existing file or creates a new.
pfs_os_file_t pfs_os_file_t
os_file_create_func( os_file_create_func(
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint purpose, ulint purpose,
ulint type, ulint type,
bool read_only, bool read_only,
...@@ -598,7 +597,7 @@ pfs_os_file_t ...@@ -598,7 +597,7 @@ pfs_os_file_t
pfs_os_file_create_simple_func( pfs_os_file_create_simple_func(
mysql_pfs_key_t key, mysql_pfs_key_t key,
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint access_type, ulint access_type,
bool read_only, bool read_only,
bool* success, bool* success,
...@@ -614,7 +613,7 @@ monitor file creation/open. ...@@ -614,7 +613,7 @@ monitor file creation/open.
@param[in] key Performance Schema Key @param[in] key Performance Schema Key
@param[in] name name of the file or path as a null-terminated @param[in] name name of the file or path as a null-terminated
string string
@param[in] create_mode create mode @param[in] create_mode OS_FILE_CREATE or OS_FILE_OPEN
@param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or @param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
OS_FILE_READ_ALLOW_DELETE; the last option is OS_FILE_READ_ALLOW_DELETE; the last option is
used by a backup program reading the file used by a backup program reading the file
...@@ -629,7 +628,7 @@ pfs_os_file_t ...@@ -629,7 +628,7 @@ pfs_os_file_t
pfs_os_file_create_simple_no_error_handling_func( pfs_os_file_create_simple_no_error_handling_func(
mysql_pfs_key_t key, mysql_pfs_key_t key,
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint access_type, ulint access_type,
bool read_only, bool read_only,
bool* success, bool* success,
...@@ -662,7 +661,7 @@ pfs_os_file_t ...@@ -662,7 +661,7 @@ pfs_os_file_t
pfs_os_file_create_func( pfs_os_file_create_func(
mysql_pfs_key_t key, mysql_pfs_key_t key,
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint purpose, ulint purpose,
ulint type, ulint type,
bool read_only, bool read_only,
......
...@@ -45,7 +45,7 @@ pfs_os_file_t ...@@ -45,7 +45,7 @@ pfs_os_file_t
pfs_os_file_create_simple_func( pfs_os_file_create_simple_func(
mysql_pfs_key_t key, mysql_pfs_key_t key,
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint access_type, ulint access_type,
bool read_only, bool read_only,
bool* success, bool* success,
...@@ -80,7 +80,7 @@ monitor file creation/open. ...@@ -80,7 +80,7 @@ monitor file creation/open.
@param[in] key Performance Schema Key @param[in] key Performance Schema Key
@param[in] name name of the file or path as a null-terminated @param[in] name name of the file or path as a null-terminated
string string
@param[in] create_mode create mode @param[in] create_mode OS_FILE_CREATE or OS_FILE_OPEN
@param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or @param[in] access_type OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
OS_FILE_READ_ALLOW_DELETE; the last option is OS_FILE_READ_ALLOW_DELETE; the last option is
used by a backup program reading the file used by a backup program reading the file
...@@ -95,7 +95,7 @@ pfs_os_file_t ...@@ -95,7 +95,7 @@ pfs_os_file_t
pfs_os_file_create_simple_no_error_handling_func( pfs_os_file_create_simple_no_error_handling_func(
mysql_pfs_key_t key, mysql_pfs_key_t key,
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint access_type, ulint access_type,
bool read_only, bool read_only,
bool* success, bool* success,
...@@ -146,7 +146,7 @@ pfs_os_file_t ...@@ -146,7 +146,7 @@ pfs_os_file_t
pfs_os_file_create_func( pfs_os_file_create_func(
mysql_pfs_key_t key, mysql_pfs_key_t key,
const char* name, const char* name,
ulint create_mode, os_file_create_t create_mode,
ulint purpose, ulint purpose,
ulint type, ulint type,
bool read_only, bool read_only,
......
...@@ -466,8 +466,7 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept ...@@ -466,8 +466,7 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept
resize_lsn.store(1, std::memory_order_relaxed); resize_lsn.store(1, std::memory_order_relaxed);
resize_target= 0; resize_target= 0;
resize_log.m_file= resize_log.m_file=
os_file_create_func(path.c_str(), os_file_create_func(path.c_str(), OS_FILE_CREATE,
OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_NORMAL, OS_LOG_FILE, false, &success); OS_FILE_NORMAL, OS_LOG_FILE, false, &success);
if (success) if (success)
{ {
......
...@@ -844,8 +844,7 @@ static struct ...@@ -844,8 +844,7 @@ static struct
inside recv_sys_t::recover_deferred(). */ inside recv_sys_t::recover_deferred(). */
bool success; bool success;
handle= os_file_create(innodb_data_file_key, filename, handle= os_file_create(innodb_data_file_key, filename,
OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT | OS_FILE_CREATE_SILENT,
OS_FILE_ON_ERROR_SILENT,
OS_FILE_AIO, OS_DATA_FILE, false, &success); OS_FILE_AIO, OS_DATA_FILE, false, &success);
} }
space->add(filename, handle, size, false, false); space->add(filename, handle, size, false, false);
...@@ -1714,7 +1713,7 @@ dberr_t recv_sys_t::find_checkpoint() ...@@ -1714,7 +1713,7 @@ dberr_t recv_sys_t::find_checkpoint()
std::string path{get_log_file_path()}; std::string path{get_log_file_path()};
bool success; bool success;
os_file_t file{os_file_create_func(path.c_str(), os_file_t file{os_file_create_func(path.c_str(),
OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_OPEN,
OS_FILE_NORMAL, OS_LOG_FILE, OS_FILE_NORMAL, OS_LOG_FILE,
srv_read_only_mode, &success)}; srv_read_only_mode, &success)};
if (file == OS_FILE_CLOSED) if (file == OS_FILE_CLOSED)
...@@ -1744,8 +1743,7 @@ dberr_t recv_sys_t::find_checkpoint() ...@@ -1744,8 +1743,7 @@ dberr_t recv_sys_t::find_checkpoint()
{ {
path= get_log_file_path(LOG_FILE_NAME_PREFIX).append(std::to_string(i)); path= get_log_file_path(LOG_FILE_NAME_PREFIX).append(std::to_string(i));
file= os_file_create_func(path.c_str(), file= os_file_create_func(path.c_str(),
OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT | OS_FILE_OPEN_SILENT,
OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_LOG_FILE, true, &success); OS_FILE_NORMAL, OS_LOG_FILE, true, &success);
if (file == OS_FILE_CLOSED) if (file == OS_FILE_CLOSED)
break; break;
......
This diff is collapsed.
...@@ -201,7 +201,7 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn) ...@@ -201,7 +201,7 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn)
bool ret; bool ret;
os_file_t file{ os_file_t file{
os_file_create_func(logfile0.c_str(), os_file_create_func(logfile0.c_str(),
OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_CREATE,
OS_FILE_NORMAL, OS_LOG_FILE, false, &ret) OS_FILE_NORMAL, OS_LOG_FILE, false, &ret)
}; };
...@@ -632,9 +632,8 @@ static uint32_t srv_undo_tablespace_open(bool create, const char* name, ...@@ -632,9 +632,8 @@ static uint32_t srv_undo_tablespace_open(bool create, const char* name,
} }
} }
pfs_os_file_t fh= os_file_create(innodb_data_file_key, name, OS_FILE_OPEN | pfs_os_file_t fh= os_file_create(innodb_data_file_key, name,
OS_FILE_ON_ERROR_NO_EXIT | OS_FILE_OPEN_SILENT,
OS_FILE_ON_ERROR_SILENT,
OS_FILE_AIO, OS_DATA_FILE, OS_FILE_AIO, OS_DATA_FILE,
srv_read_only_mode, &success); srv_read_only_mode, &success);
...@@ -731,9 +730,7 @@ srv_check_undo_redo_logs_exists() ...@@ -731,9 +730,7 @@ srv_check_undo_redo_logs_exists()
fh = os_file_create_func( fh = os_file_create_func(
name, name,
OS_FILE_OPEN_RETRY OS_FILE_OPEN_RETRY_SILENT,
| OS_FILE_ON_ERROR_NO_EXIT
| OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_FILE_NORMAL,
OS_DATA_FILE, OS_DATA_FILE,
srv_read_only_mode, srv_read_only_mode,
...@@ -755,8 +752,7 @@ srv_check_undo_redo_logs_exists() ...@@ -755,8 +752,7 @@ srv_check_undo_redo_logs_exists()
auto logfilename = get_log_file_path(); auto logfilename = get_log_file_path();
fh = os_file_create_func(logfilename.c_str(), fh = os_file_create_func(logfilename.c_str(),
OS_FILE_OPEN_RETRY | OS_FILE_ON_ERROR_NO_EXIT OS_FILE_OPEN_RETRY_SILENT,
| OS_FILE_ON_ERROR_SILENT,
OS_FILE_NORMAL, OS_LOG_FILE, OS_FILE_NORMAL, OS_LOG_FILE,
srv_read_only_mode, &ret); srv_read_only_mode, &ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment