summaryrefslogtreecommitdiff
path: root/storage/innobase/fil/fil0fil.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-07-27 14:25:36 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-07-27 14:25:36 +0300
commite5c4f4e590d7782ef938b436f84ae11b68e0af08 (patch)
tree7919303321a6e4663340a75dd56aa4ef55e3ef4f /storage/innobase/fil/fil0fil.cc
parent3bb36e949534fc4a24d68d4297663ae8b80ba336 (diff)
parent0ee1082bd2e7e7049c4f0e686bad53cf7ba053ab (diff)
downloadmariadb-git-e5c4f4e590d7782ef938b436f84ae11b68e0af08.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/fil/fil0fil.cc')
-rw-r--r--storage/innobase/fil/fil0fil.cc39
1 files changed, 25 insertions, 14 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index c2e24df66ae..f74402065b3 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1668,15 +1668,13 @@ database server shutdown. This should be called at a server startup after the
space objects for the log and the system tablespace have been created. The
purpose of this operation is to make sure we never run out of file descriptors
if we need to read from the insert buffer or to write to the log. */
-void
-fil_open_log_and_system_tablespace_files(void)
-/*==========================================*/
+dberr_t fil_open_log_and_system_tablespace_files()
{
- fil_space_t* space;
+ dberr_t err = DB_SUCCESS;
mutex_enter(&fil_system.mutex);
- for (space = UT_LIST_GET_FIRST(fil_system.space_list);
+ for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.space_list);
space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) {
@@ -1691,17 +1689,29 @@ fil_open_log_and_system_tablespace_files(void)
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- if (!node->is_open()) {
- if (!fil_node_open_file(node)) {
- /* This func is called during server's
- startup. If some file of log or system
- tablespace is missing, the server
- can't start successfully. So we should
- assert for it. */
- ut_a(0);
+ if (node->is_open()) {
+ continue;
+ }
+ if (!fil_node_open_file(node)) {
+ err = DB_ERROR;
+#ifndef _WIN32
+ } else if (!space->id && my_disable_locking
+ && !srv_read_only_mode
+ && os_file_lock(node->handle, node->name)) {
+ /* Retry for 60 seconds. */
+ for (int i = 60; i--;) {
+ os_thread_sleep(1000000);
+ if (!os_file_lock(node->handle,
+ node->name)) {
+ goto got_lock;
+ }
}
+ err = DB_ERROR;
+#endif
}
-
+#ifndef _WIN32
+got_lock:
+#endif
if (srv_max_n_open_files < 10 + fil_system.n_open) {
ib::warn() << "You must raise the value of"
@@ -1723,6 +1733,7 @@ fil_open_log_and_system_tablespace_files(void)
}
mutex_exit(&fil_system.mutex);
+ return err;
}
/*******************************************************************//**