Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e5c4f4e5
Commit
e5c4f4e5
authored
Jul 27, 2022
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
3bb36e94
0ee1082b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
52 deletions
+92
-52
mysql-test/include/mtr_warnings.sql
mysql-test/include/mtr_warnings.sql
+4
-0
storage/innobase/fil/fil0fil.cc
storage/innobase/fil/fil0fil.cc
+25
-14
storage/innobase/fsp/fsp0sysspace.cc
storage/innobase/fsp/fsp0sysspace.cc
+27
-4
storage/innobase/include/fil0fil.h
storage/innobase/include/fil0fil.h
+3
-4
storage/innobase/include/os0file.h
storage/innobase/include/os0file.h
+9
-1
storage/innobase/os/os0file.cc
storage/innobase/os/os0file.cc
+15
-25
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+9
-4
No files found.
mysql-test/include/mtr_warnings.sql
View file @
e5c4f4e5
...
...
@@ -157,6 +157,10 @@ INSERT INTO global_suppressions VALUES
(
"InnoDB: Error: table `test`.`t[123]` .*does not exist in the InnoDB internal"
),
(
"InnoDB: Warning: semaphore wait:"
),
/* MDEV-28976: Tests that kill the server do not ensure that the
old process has terminated before starting a new one */
(
"InnoDB: Unable to lock"
),
/*
BUG#32080 - Excessive warnings on Solaris: setrlimit could not
change the size of core files
...
...
storage/innobase/fil/fil0fil.cc
View file @
e5c4f4e5
...
...
@@ -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
;
}
/*******************************************************************//**
...
...
storage/innobase/fsp/fsp0sysspace.cc
View file @
e5c4f4e5
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 202
1
, MariaDB Corporation.
Copyright (c) 2016, 202
2
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -445,12 +445,27 @@ SysTablespace::create_file(
case
SRV_NOT_RAW
:
err
=
file
.
open_or_create
(
m_ignore_read_only
?
false
:
srv_read_only_mode
);
!
m_ignore_read_only
&&
srv_read_only_mode
);
break
;
}
if
(
err
!=
DB_SUCCESS
)
{
return
err
;
}
if
(
err
==
DB_SUCCESS
&&
file
.
m_type
!=
SRV_OLD_RAW
)
{
switch
(
file
.
m_type
)
{
case
SRV_OLD_RAW
:
break
;
case
SRV_NOT_RAW
:
#ifndef _WIN32
if
(
!
space_id
()
&&
my_disable_locking
&&
os_file_lock
(
file
.
m_handle
,
file
.
m_filepath
))
{
err
=
DB_ERROR
;
break
;
}
#endif
/* fall through */
case
SRV_NEW_RAW
:
err
=
set_size
(
file
);
}
...
...
@@ -491,7 +506,7 @@ SysTablespace::open_file(
case
SRV_NOT_RAW
:
err
=
file
.
open_or_create
(
m_ignore_read_only
?
false
:
srv_read_only_mode
);
!
m_ignore_read_only
&&
srv_read_only_mode
);
if
(
err
!=
DB_SUCCESS
)
{
return
(
err
);
...
...
@@ -506,6 +521,14 @@ SysTablespace::open_file(
break
;
case
SRV_NOT_RAW
:
#ifndef _WIN32
if
(
!
space_id
()
&&
(
m_ignore_read_only
||
!
srv_read_only_mode
)
&&
my_disable_locking
&&
os_file_lock
(
file
.
m_handle
,
file
.
m_filepath
))
{
err
=
DB_ERROR
;
break
;
}
#endif
/* Check file size for existing file. */
err
=
check_size
(
file
);
break
;
...
...
storage/innobase/include/fil0fil.h
View file @
e5c4f4e5
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 202
1
, MariaDB Corporation.
Copyright (c) 2013, 202
2
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -1095,9 +1095,8 @@ 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
()
MY_ATTRIBUTE
((
warn_unused_result
));
/*******************************************************************//**
Closes all open files. There must not be any pending i/o's or not flushed
modifications in the files. */
...
...
storage/innobase/include/os0file.h
View file @
e5c4f4e5
...
...
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 202
1
, MariaDB Corporation.
Copyright (c) 2013, 202
2
, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
...
...
@@ -582,6 +582,14 @@ os_file_set_nocache(
const
char
*
operation_name
);
#endif
#ifndef _WIN32
/* On Microsoft Windows, mandatory locking is used */
/** Obtain an exclusive lock on a file.
@param fd file descriptor
@param name file name
@return 0 on success */
int
os_file_lock
(
int
fd
,
const
char
*
name
);
#endif
/** NOTE! Use the corresponding macro os_file_create(), not directly
this function!
Opens an existing file or creates a new.
...
...
storage/innobase/os/os0file.cc
View file @
e5c4f4e5
...
...
@@ -977,26 +977,13 @@ os_aio_validate_skip()
}
#endif
/* UNIV_DEBUG */
#undef USE_FILE_LOCK
#ifndef _WIN32
/* On Windows, mandatory locking is used */
# define USE_FILE_LOCK
#endif
#ifdef USE_FILE_LOCK
#ifndef _WIN32
/* On Microsoft Windows, mandatory locking is used */
/** Obtain an exclusive lock on a file.
@param
[in] fd
file descriptor
@param
[in] name
file name
@param
fd
file descriptor
@param
name
file name
@return 0 on success */
static
int
os_file_lock
(
int
fd
,
const
char
*
name
)
int
os_file_lock
(
int
fd
,
const
char
*
name
)
{
if
(
my_disable_locking
)
{
return
0
;
}
struct
flock
lk
;
lk
.
l_type
=
F_WRLCK
;
...
...
@@ -1022,7 +1009,7 @@ os_file_lock(
return
(
0
);
}
#endif
/*
USE_FILE_LOCK
*/
#endif
/*
!_WIN32
*/
/** Calculates local segment number and aio array from global segment number.
@param[out] array aio wait array
...
...
@@ -2628,17 +2615,18 @@ os_file_create_simple_func(
os_file_set_nocache
(
file
,
name
,
mode_str
);
}
#if
def USE_FILE_LOCK
#if
ndef _WIN32
if
(
!
read_only
&&
*
success
&&
(
access_type
==
OS_FILE_READ_WRITE
)
&&
access_type
==
OS_FILE_READ_WRITE
&&
!
my_disable_locking
&&
os_file_lock
(
file
,
name
))
{
*
success
=
false
;
close
(
file
);
file
=
-
1
;
}
#endif
/*
USE_FILE_LOCK
*/
#endif
/*
!_WIN32
*/
return
(
file
);
}
...
...
@@ -2810,10 +2798,11 @@ os_file_create_func(
os_file_set_nocache
(
file
,
name
,
mode_str
);
}
#if
def USE_FILE_LOCK
#if
ndef _WIN32
if
(
!
read_only
&&
*
success
&&
create_mode
!=
OS_FILE_OPEN_RAW
&&
!
my_disable_locking
&&
os_file_lock
(
file
,
name
))
{
if
(
create_mode
==
OS_FILE_OPEN_RETRY
)
{
...
...
@@ -2838,7 +2827,7 @@ os_file_create_func(
close
(
file
);
file
=
-
1
;
}
#endif
/*
USE_FILE_LOCK
*/
#endif
/*
!_WIN32
*/
return
(
file
);
}
...
...
@@ -2911,10 +2900,11 @@ os_file_create_simple_no_error_handling_func(
*
success
=
(
file
!=
-
1
);
#if
def USE_FILE_LOCK
#if
ndef _WIN32
if
(
!
read_only
&&
*
success
&&
access_type
==
OS_FILE_READ_WRITE
&&
!
my_disable_locking
&&
os_file_lock
(
file
,
name
))
{
*
success
=
false
;
...
...
@@ -2922,7 +2912,7 @@ os_file_create_simple_no_error_handling_func(
file
=
-
1
;
}
#endif
/*
USE_FILE_LOCK
*/
#endif
/*
!_WIN32
*/
return
(
file
);
}
...
...
storage/innobase/srv/srv0start.cc
View file @
e5c4f4e5
...
...
@@ -479,7 +479,9 @@ create_log_files(
log_sys
.
log
.
create
(
srv_n_log_files
);
fil_open_log_and_system_tablespace_files
();
if
(
dberr_t
err
=
fil_open_log_and_system_tablespace_files
())
{
return
err
;
}
/* Create a log checkpoint. */
log_mutex_enter
();
...
...
@@ -566,8 +568,9 @@ create_log_files_rename(
DBUG_EXECUTE_IF
(
"innodb_log_abort_10"
,
err
=
DB_ERROR
;);
if
(
err
==
DB_SUCCESS
)
{
fil_open_log_and_system_tablespace_files
();
err
=
fil_open_log_and_system_tablespace_files
();
ib
::
info
()
<<
"New log files created, LSN="
<<
lsn
;
ut_a
(
err
==
DB_SUCCESS
);
}
return
(
err
);
...
...
@@ -1792,10 +1795,12 @@ dberr_t srv_start(bool create_new_db)
tablespace: we keep them open until database
shutdown */
fil_open_log_and_system_tablespace_files
();
err
=
fil_open_log_and_system_tablespace_files
();
ut_d
(
fil_system
.
sys_space
->
recv_size
=
srv_sys_space_size_debug
);
if
(
err
==
DB_SUCCESS
)
{
err
=
srv_undo_tablespaces_init
(
create_new_db
);
}
/* If the force recovery is set very high then we carry on regardless
of all errors. Basically this is fingers crossed mode. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment