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
565b0dd1
Commit
565b0dd1
authored
Nov 30, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.5 into 10.6
parents
ccb5cf20
8fa6e363
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
155 deletions
+58
-155
storage/innobase/buf/buf0flu.cc
storage/innobase/buf/buf0flu.cc
+1
-1
storage/innobase/fil/fil0crypt.cc
storage/innobase/fil/fil0crypt.cc
+1
-2
storage/innobase/include/os0thread.h
storage/innobase/include/os0thread.h
+4
-27
storage/innobase/os/os0thread.cc
storage/innobase/os/os0thread.cc
+1
-67
storage/innobase/sync/sync0arr.cc
storage/innobase/sync/sync0arr.cc
+8
-8
storage/innobase/sync/sync0debug.cc
storage/innobase/sync/sync0debug.cc
+2
-2
storage/innobase/sync/sync0rw.cc
storage/innobase/sync/sync0rw.cc
+4
-4
storage/innobase/ut/ut0ut.cc
storage/innobase/ut/ut0ut.cc
+37
-44
No files found.
storage/innobase/buf/buf0flu.cc
View file @
565b0dd1
...
@@ -2043,7 +2043,7 @@ static os_thread_ret_t DECLARE_THREAD(buf_flush_page_cleaner)(void*)
...
@@ -2043,7 +2043,7 @@ static os_thread_ret_t DECLARE_THREAD(buf_flush_page_cleaner)(void*)
#ifdef UNIV_DEBUG_THREAD_CREATION
#ifdef UNIV_DEBUG_THREAD_CREATION
ib
::
info
()
<<
"page_cleaner thread running, id "
ib
::
info
()
<<
"page_cleaner thread running, id "
<<
os_thread_
pf
(
os_thread_get_curr_id
()
);
<<
os_thread_
get_curr_id
(
);
#endif
/* UNIV_DEBUG_THREAD_CREATION */
#endif
/* UNIV_DEBUG_THREAD_CREATION */
#ifdef UNIV_LINUX
#ifdef UNIV_LINUX
/* linux might be able to set different setting for each thread.
/* linux might be able to set different setting for each thread.
...
...
storage/innobase/fil/fil0crypt.cc
View file @
565b0dd1
...
@@ -2198,8 +2198,7 @@ fil_crypt_set_thread_cnt(
...
@@ -2198,8 +2198,7 @@ fil_crypt_set_thread_cnt(
for
(
uint
i
=
0
;
i
<
add
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
add
;
i
++
)
{
ib
::
info
()
<<
"Creating #"
ib
::
info
()
<<
"Creating #"
<<
i
+
1
<<
" encryption thread id "
<<
i
+
1
<<
" encryption thread id "
<<
os_thread_pf
(
<<
os_thread_create
(
fil_crypt_thread
)
os_thread_create
(
fil_crypt_thread
))
<<
" total threads "
<<
new_cnt
<<
"."
;
<<
" total threads "
<<
new_cnt
<<
"."
;
}
}
}
else
if
(
new_cnt
<
srv_n_fil_crypt_threads
)
{
}
else
if
(
new_cnt
<
srv_n_fil_crypt_threads
)
{
...
...
storage/innobase/include/os0thread.h
View file @
565b0dd1
...
@@ -66,22 +66,10 @@ typedef void* (*os_posix_f_t) (void*);
...
@@ -66,22 +66,10 @@ typedef void* (*os_posix_f_t) (void*);
typedef
unsigned
int
mysql_pfs_key_t
;
typedef
unsigned
int
mysql_pfs_key_t
;
#endif
/* HAVE_PSI_INTERFACE */
#endif
/* HAVE_PSI_INTERFACE */
/***************************************************************//**
#define os_thread_eq(a,b) IF_WIN(a == b, pthread_equal(a, b))
Compares two thread ids for equality.
#define os_thread_yield() IF_WIN(SwitchToThread(), sched_yield())
@return TRUE if equal */
#define os_thread_get_curr_id() IF_WIN(GetCurrentThreadId(), pthread_self())
ibool
os_thread_eq
(
/*=========*/
os_thread_id_t
a
,
/*!< in: OS thread or thread id */
os_thread_id_t
b
);
/*!< in: OS thread or thread id */
/****************************************************************//**
Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is
unique for the thread though!
@return thread identifier as a number */
ulint
os_thread_pf
(
/*=========*/
os_thread_id_t
a
);
/*!< in: OS thread identifier */
/****************************************************************//**
/****************************************************************//**
Creates a new thread of execution. The execution starts from
Creates a new thread of execution. The execution starts from
the function given.
the function given.
...
@@ -94,17 +82,6 @@ os_thread_t os_thread_create(os_thread_func_t func, void *arg= nullptr);
...
@@ -94,17 +82,6 @@ os_thread_t os_thread_create(os_thread_func_t func, void *arg= nullptr);
/** Detach and terminate the current thread. */
/** Detach and terminate the current thread. */
ATTRIBUTE_NORETURN
void
os_thread_exit
();
ATTRIBUTE_NORETURN
void
os_thread_exit
();
/*****************************************************************//**
Returns the thread identifier of current thread.
@return current thread identifier */
os_thread_id_t
os_thread_get_curr_id
(
void
);
/*========================*/
/*****************************************************************//**
Advises the os to give up remainder of the thread's time slice. */
void
os_thread_yield
(
void
);
/*=================*/
/*****************************************************************//**
/*****************************************************************//**
The thread sleeps at least the time given in microseconds. */
The thread sleeps at least the time given in microseconds. */
void
void
...
...
storage/innobase/os/os0thread.cc
View file @
565b0dd1
...
@@ -27,58 +27,6 @@ Created 9/8/1995 Heikki Tuuri
...
@@ -27,58 +27,6 @@ Created 9/8/1995 Heikki Tuuri
#include "univ.i"
#include "univ.i"
#include "srv0srv.h"
#include "srv0srv.h"
/***************************************************************//**
Compares two thread ids for equality.
@return TRUE if equal */
ibool
os_thread_eq
(
/*=========*/
os_thread_id_t
a
,
/*!< in: OS thread or thread id */
os_thread_id_t
b
)
/*!< in: OS thread or thread id */
{
#ifdef _WIN32
if
(
a
==
b
)
{
return
(
TRUE
);
}
return
(
FALSE
);
#else
if
(
pthread_equal
(
a
,
b
))
{
return
(
TRUE
);
}
return
(
FALSE
);
#endif
}
/****************************************************************//**
Converts an OS thread id to a ulint. It is NOT guaranteed that the ulint is
unique for the thread though!
@return thread identifier as a number */
ulint
os_thread_pf
(
/*=========*/
os_thread_id_t
a
)
/*!< in: OS thread identifier */
{
return
((
ulint
)
a
);
}
/*****************************************************************//**
Returns the thread identifier of current thread. Currently the thread
identifier in Unix is the thread handle itself. Note that in HP-UX
pthread_t is a struct of 3 fields.
@return current thread identifier */
os_thread_id_t
os_thread_get_curr_id
(
void
)
/*=======================*/
{
#ifdef _WIN32
return
(
GetCurrentThreadId
());
#else
return
(
pthread_self
());
#endif
}
/****************************************************************//**
/****************************************************************//**
Creates a new thread of execution. The execution starts from
Creates a new thread of execution. The execution starts from
the function given.
the function given.
...
@@ -135,8 +83,7 @@ os_thread_t os_thread_create(os_thread_func_t func, void *arg)
...
@@ -135,8 +83,7 @@ os_thread_t os_thread_create(os_thread_func_t func, void *arg)
ATTRIBUTE_NORETURN
void
os_thread_exit
()
ATTRIBUTE_NORETURN
void
os_thread_exit
()
{
{
#ifdef UNIV_DEBUG_THREAD_CREATION
#ifdef UNIV_DEBUG_THREAD_CREATION
ib
::
info
()
<<
"Thread exits, id "
ib
::
info
()
<<
"Thread exits, id "
<<
os_thread_get_curr_id
();
<<
os_thread_pf
(
os_thread_get_curr_id
());
#endif
#endif
#ifdef UNIV_PFS_THREAD
#ifdef UNIV_PFS_THREAD
...
@@ -151,19 +98,6 @@ ATTRIBUTE_NORETURN void os_thread_exit()
...
@@ -151,19 +98,6 @@ ATTRIBUTE_NORETURN void os_thread_exit()
#endif
#endif
}
}
/*****************************************************************//**
Advises the os to give up remainder of the thread's time slice. */
void
os_thread_yield
(
void
)
/*=================*/
{
#if defined(_WIN32)
SwitchToThread
();
#else
sched_yield
();
#endif
}
/*****************************************************************//**
/*****************************************************************//**
The thread sleeps at least the time given in microseconds. */
The thread sleeps at least the time given in microseconds. */
void
void
...
...
storage/innobase/sync/sync0arr.cc
View file @
565b0dd1
...
@@ -477,10 +477,10 @@ sync_array_cell_print(
...
@@ -477,10 +477,10 @@ sync_array_cell_print(
type
=
cell
->
request_type
;
type
=
cell
->
request_type
;
fprintf
(
file
,
fprintf
(
file
,
"--Thread
%lu has waited at %s line %lu"
"--Thread
"
ULINTPF
" has waited at %s line "
ULINTPF
" for %.2f seconds the semaphore:
\n
"
,
" for %.2f seconds the semaphore:
\n
"
,
(
ulong
)
os_thread_pf
(
cell
->
thread_id
),
ulint
(
cell
->
thread_id
),
innobase_basename
(
cell
->
file
),
(
ulong
)
cell
->
line
,
innobase_basename
(
cell
->
file
),
cell
->
line
,
difftime
(
time
(
NULL
),
cell
->
reservation_time
));
difftime
(
time
(
NULL
),
cell
->
reservation_time
));
switch
(
type
)
{
switch
(
type
)
{
...
@@ -510,7 +510,7 @@ sync_array_cell_print(
...
@@ -510,7 +510,7 @@ sync_array_cell_print(
fprintf
(
file
,
fprintf
(
file
,
"a writer (thread id "
ULINTPF
") has"
"a writer (thread id "
ULINTPF
") has"
" reserved it in mode %s"
,
" reserved it in mode %s"
,
os_thread_pf
(
rwlock
->
writer_thread
),
ulint
(
rwlock
->
writer_thread
),
writer
==
RW_LOCK_X
?
" exclusive
\n
"
writer
==
RW_LOCK_X
?
" exclusive
\n
"
:
writer
==
RW_LOCK_SX
?
" SX
\n
"
:
writer
==
RW_LOCK_SX
?
" SX
\n
"
:
" wait exclusive
\n
"
);
:
" wait exclusive
\n
"
);
...
@@ -532,7 +532,7 @@ sync_array_cell_print(
...
@@ -532,7 +532,7 @@ sync_array_cell_print(
innobase_basename
(
rwlock
->
last_x_file_name
),
innobase_basename
(
rwlock
->
last_x_file_name
),
rwlock
->
last_x_line
rwlock
->
last_x_line
#if 0 /* JAN: TODO: FIX LATER */
#if 0 /* JAN: TODO: FIX LATER */
,
os_thread_pf
(rwlock->thread_id),
,
ulint
(rwlock->thread_id),
innobase_basename(rwlock->file_name),
innobase_basename(rwlock->file_name),
rwlock->line
rwlock->line
#endif
#endif
...
@@ -725,7 +725,7 @@ sync_array_detect_deadlock(
...
@@ -725,7 +725,7 @@ sync_array_detect_deadlock(
ib
::
info
()
ib
::
info
()
<<
"Mutex "
<<
mutex
<<
" owned by"
<<
"Mutex "
<<
mutex
<<
" owned by"
" thread "
<<
os_thread_pf
(
thread
)
" thread "
<<
thread
<<
" file "
<<
name
<<
" line "
<<
" file "
<<
name
<<
" line "
<<
policy
.
context
.
get_enter_line
();
<<
policy
.
context
.
get_enter_line
();
...
@@ -1203,7 +1203,7 @@ sync_arr_fill_sys_semphore_waits_table(
...
@@ -1203,7 +1203,7 @@ sync_arr_fill_sys_semphore_waits_table(
type
=
cell
->
request_type
;
type
=
cell
->
request_type
;
/* JAN: FIXME
/* JAN: FIXME
OK(fields[SYS_SEMAPHORE_WAITS_THREAD_ID]->store(,
OK(fields[SYS_SEMAPHORE_WAITS_THREAD_ID]->store(,
(longlong)os_thread_pf
(cell->thread), true));
ulint
(cell->thread), true));
*/
*/
OK
(
field_store_string
(
fields
[
SYS_SEMAPHORE_WAITS_FILE
],
innobase_basename
(
cell
->
file
)));
OK
(
field_store_string
(
fields
[
SYS_SEMAPHORE_WAITS_FILE
],
innobase_basename
(
cell
->
file
)));
OK
(
fields
[
SYS_SEMAPHORE_WAITS_LINE
]
->
store
(
cell
->
line
,
true
));
OK
(
fields
[
SYS_SEMAPHORE_WAITS_LINE
]
->
store
(
cell
->
line
,
true
));
...
@@ -1259,7 +1259,7 @@ sync_arr_fill_sys_semphore_waits_table(
...
@@ -1259,7 +1259,7 @@ sync_arr_fill_sys_semphore_waits_table(
if
(
writer
!=
RW_LOCK_NOT_LOCKED
)
{
if
(
writer
!=
RW_LOCK_NOT_LOCKED
)
{
// JAN: FIXME
// JAN: FIXME
// OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_OBJECT_NAME], rwlock->lock_name));
// OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_OBJECT_NAME], rwlock->lock_name));
OK
(
fields
[
SYS_SEMAPHORE_WAITS_WRITER_THREAD
]
->
store
(
os_thread_pf
(
rwlock
->
writer_thread
),
true
));
OK
(
fields
[
SYS_SEMAPHORE_WAITS_WRITER_THREAD
]
->
store
(
ulint
(
rwlock
->
writer_thread
),
true
));
if
(
writer
==
RW_LOCK_X
)
{
if
(
writer
==
RW_LOCK_X
)
{
OK
(
field_store_string
(
fields
[
SYS_SEMAPHORE_WAITS_RESERVATION_MODE
],
"RW_LOCK_X"
));
OK
(
field_store_string
(
fields
[
SYS_SEMAPHORE_WAITS_RESERVATION_MODE
],
"RW_LOCK_X"
));
...
...
storage/innobase/sync/sync0debug.cc
View file @
565b0dd1
...
@@ -112,7 +112,7 @@ struct LatchDebug {
...
@@ -112,7 +112,7 @@ struct LatchDebug {
const
os_thread_id_t
&
rhs
)
const
const
os_thread_id_t
&
rhs
)
const
UNIV_NOTHROW
UNIV_NOTHROW
{
{
return
(
os_thread_pf
(
lhs
)
<
os_thread_pf
(
rhs
));
return
(
ulint
(
lhs
)
<
ulint
(
rhs
));
}
}
};
};
...
@@ -537,7 +537,7 @@ LatchDebug::crash(
...
@@ -537,7 +537,7 @@ LatchDebug::crash(
get_level_name
(
latched
->
m_level
);
get_level_name
(
latched
->
m_level
);
ib
::
error
()
ib
::
error
()
<<
"Thread "
<<
os_thread_
pf
(
os_thread_get_curr_id
()
)
<<
"Thread "
<<
os_thread_
get_curr_id
(
)
<<
" already owns a latch "
<<
" already owns a latch "
<<
sync_latch_get_name
(
latch
->
m_id
)
<<
" at level"
<<
sync_latch_get_name
(
latch
->
m_id
)
<<
" at level"
<<
" "
<<
latched
->
m_level
<<
" ("
<<
latch_level_name
<<
" "
<<
latched
->
m_level
<<
" ("
<<
latch_level_name
...
...
storage/innobase/sync/sync0rw.cc
View file @
565b0dd1
...
@@ -1136,10 +1136,10 @@ rw_lock_debug_print(
...
@@ -1136,10 +1136,10 @@ rw_lock_debug_print(
{
{
ulint
rwt
=
info
->
lock_type
;
ulint
rwt
=
info
->
lock_type
;
fprintf
(
f
,
"Locked: thread
%lu file %s line %l
u "
,
fprintf
(
f
,
"Locked: thread
"
ULINTPF
" file %s line %
u "
,
static_cast
<
ulong
>
(
os_thread_pf
(
info
->
thread_id
)
),
ulint
(
info
->
thread_id
),
sync_basename
(
info
->
file_name
),
sync_basename
(
info
->
file_name
),
static_cast
<
ulong
>
(
info
->
line
)
);
info
->
line
);
switch
(
rwt
)
{
switch
(
rwt
)
{
case
RW_LOCK_S
:
case
RW_LOCK_S
:
...
@@ -1179,7 +1179,7 @@ rw_lock_t::to_string() const
...
@@ -1179,7 +1179,7 @@ rw_lock_t::to_string() const
ut_ad
(
rw_lock_validate
(
this
));
ut_ad
(
rw_lock_validate
(
this
));
msg
<<
"RW-LATCH: "
msg
<<
"RW-LATCH: "
<<
"thread id "
<<
os_thread_
pf
(
os_thread_get_curr_id
()
)
<<
"thread id "
<<
os_thread_
get_curr_id
(
)
<<
" addr: "
<<
this
<<
" addr: "
<<
this
<<
" Locked from: "
;
<<
" Locked from: "
;
...
...
storage/innobase/ut/ut0ut.cc
View file @
565b0dd1
...
@@ -59,42 +59,39 @@ ut_print_timestamp(
...
@@ -59,42 +59,39 @@ ut_print_timestamp(
/*===============*/
/*===============*/
FILE
*
file
)
/*!< in: file where to print */
FILE
*
file
)
/*!< in: file where to print */
{
{
ulint
thread_id
=
0
;
#ifndef UNIV_INNOCHECKSUM
thread_id
=
os_thread_pf
(
os_thread_get_curr_id
());
#endif
/* !UNIV_INNOCHECKSUM */
#ifdef _WIN32
#ifdef _WIN32
SYSTEMTIME
cal_tm
;
SYSTEMTIME
cal_tm
;
GetLocalTime
(
&
cal_tm
);
GetLocalTime
(
&
cal_tm
);
fprintf
(
file
,
"%d-%02d-%02d %02d:%02d:%02d %#zx"
,
(
int
)
cal_tm
.
wYear
,
(
int
)
cal_tm
.
wMonth
,
(
int
)
cal_tm
.
wDay
,
(
int
)
cal_tm
.
wHour
,
(
int
)
cal_tm
.
wMinute
,
(
int
)
cal_tm
.
wSecond
,
thread_id
);
#else
#else
struct
tm
*
cal_tm_ptr
;
time_t
tm
;
time_t
tm
;
struct
tm
cal_tm
;
struct
tm
cal_tm
;
time
(
&
tm
);
time
(
&
tm
);
localtime_r
(
&
tm
,
&
cal_tm
);
localtime_r
(
&
tm
,
&
cal_tm
);
cal_tm_ptr
=
&
cal_tm
;
fprintf
(
file
,
"%d-%02d-%02d %02d:%02d:%02d %#zx"
,
cal_tm_ptr
->
tm_year
+
1900
,
cal_tm_ptr
->
tm_mon
+
1
,
cal_tm_ptr
->
tm_mday
,
cal_tm_ptr
->
tm_hour
,
cal_tm_ptr
->
tm_min
,
cal_tm_ptr
->
tm_sec
,
thread_id
);
#endif
#endif
fprintf
(
file
,
IF_WIN
(
"%u-%02u-%02u %02u:%02u:%02u %#zx"
,
"%d-%02d-%02d %02d:%02d:%02d %#zx"
),
#ifdef _WIN32
cal_tm
.
wYear
,
cal_tm
.
wMonth
,
cal_tm
.
wDay
,
cal_tm
.
wHour
,
cal_tm
.
wMinute
,
cal_tm
.
wSecond
,
#else
cal_tm
.
tm_year
+
1900
,
cal_tm
.
tm_mon
+
1
,
cal_tm
.
tm_mday
,
cal_tm
.
tm_hour
,
cal_tm
.
tm_min
,
cal_tm
.
tm_sec
,
#endif
#ifdef UNIV_INNOCHECKSUM
ulint
{
0
}
#else
ulint
(
os_thread_get_curr_id
())
#endif
);
}
}
#ifndef UNIV_INNOCHECKSUM
#ifndef UNIV_INNOCHECKSUM
...
@@ -108,31 +105,27 @@ ut_sprintf_timestamp(
...
@@ -108,31 +105,27 @@ ut_sprintf_timestamp(
{
{
#ifdef _WIN32
#ifdef _WIN32
SYSTEMTIME
cal_tm
;
SYSTEMTIME
cal_tm
;
GetLocalTime
(
&
cal_tm
);
GetLocalTime
(
&
cal_tm
);
sprintf
(
buf
,
"%02
d%02d%02d %2d:%02d:%02d
"
,
sprintf
(
buf
,
"%02
u%02u%02u %2u:%02u:%02u
"
,
(
int
)
cal_tm
.
wYear
%
100
,
cal_tm
.
wYear
%
100
,
(
int
)
cal_tm
.
wMonth
,
cal_tm
.
wMonth
,
(
int
)
cal_tm
.
wDay
,
cal_tm
.
wDay
,
(
int
)
cal_tm
.
wHour
,
cal_tm
.
wHour
,
(
int
)
cal_tm
.
wMinute
,
cal_tm
.
wMinute
,
(
int
)
cal_tm
.
wSecond
);
cal_tm
.
wSecond
);
#else
#else
struct
tm
*
cal_tm_ptr
;
time_t
tm
;
time_t
tm
;
struct
tm
cal_tm
;
struct
tm
cal_tm
;
time
(
&
tm
);
time
(
&
tm
);
localtime_r
(
&
tm
,
&
cal_tm
);
localtime_r
(
&
tm
,
&
cal_tm
);
cal_tm_ptr
=
&
cal_tm
;
sprintf
(
buf
,
"%02d%02d%02d %2d:%02d:%02d"
,
sprintf
(
buf
,
"%02d%02d%02d %2d:%02d:%02d"
,
cal_tm
_ptr
->
tm_year
%
100
,
cal_tm
.
tm_year
%
100
,
cal_tm
_ptr
->
tm_mon
+
1
,
cal_tm
.
tm_mon
+
1
,
cal_tm
_ptr
->
tm_mday
,
cal_tm
.
tm_mday
,
cal_tm
_ptr
->
tm_hour
,
cal_tm
.
tm_hour
,
cal_tm
_ptr
->
tm_min
,
cal_tm
.
tm_min
,
cal_tm
_ptr
->
tm_sec
);
cal_tm
.
tm_sec
);
#endif
#endif
}
}
...
...
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