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
5c657e9f
Commit
5c657e9f
authored
Oct 13, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17441 - InnoDB transition to C++11 atomics
Trivial srv_running transition.
parent
67dbfe6e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
25 deletions
+11
-25
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+8
-18
storage/innobase/include/srv0srv.h
storage/innobase/include/srv0srv.h
+1
-1
storage/innobase/srv/srv0srv.cc
storage/innobase/srv/srv0srv.cc
+1
-3
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+1
-3
No files found.
storage/innobase/handler/ha_innodb.cc
View file @
5c657e9f
...
@@ -270,7 +270,7 @@ is_partition(
...
@@ -270,7 +270,7 @@ is_partition(
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
running in innodb_read_only mode, srv_read_only_mode) */
running in innodb_read_only mode, srv_read_only_mode) */
st
_my_thread_var
*
srv_running
;
st
d
::
atomic
<
st_my_thread_var
*>
srv_running
;
/** Service thread that waits for the server shutdown and stops purge threads.
/** Service thread that waits for the server shutdown and stops purge threads.
Purge workers have THDs that are needed to calculate virtual columns.
Purge workers have THDs that are needed to calculate virtual columns.
This THDs must be destroyed rather early in the server shutdown sequence.
This THDs must be destroyed rather early in the server shutdown sequence.
...
@@ -297,16 +297,12 @@ thd_destructor_proxy(void *)
...
@@ -297,16 +297,12 @@ thd_destructor_proxy(void *)
myvar
->
current_cond
=
&
thd_destructor_cond
;
myvar
->
current_cond
=
&
thd_destructor_cond
;
mysql_mutex_lock
(
&
thd_destructor_mutex
);
mysql_mutex_lock
(
&
thd_destructor_mutex
);
my_atomic_storeptr_explicit
(
reinterpret_cast
<
void
**>
(
&
srv_running
),
srv_running
.
store
(
myvar
,
std
::
memory_order_relaxed
);
myvar
,
MY_MEMORY_ORDER_RELAXED
);
/* wait until the server wakes the THD to abort and die */
/* wait until the server wakes the THD to abort and die */
while
(
!
srv_running
->
abort
)
while
(
!
myvar
->
abort
)
mysql_cond_wait
(
&
thd_destructor_cond
,
&
thd_destructor_mutex
);
mysql_cond_wait
(
&
thd_destructor_cond
,
&
thd_destructor_mutex
);
mysql_mutex_unlock
(
&
thd_destructor_mutex
);
mysql_mutex_unlock
(
&
thd_destructor_mutex
);
my_atomic_storeptr_explicit
(
reinterpret_cast
<
void
**>
(
&
srv_running
),
srv_running
.
store
(
NULL
,
std
::
memory_order_relaxed
);
NULL
,
MY_MEMORY_ORDER_RELAXED
);
while
(
srv_fast_shutdown
==
0
&&
while
(
srv_fast_shutdown
==
0
&&
(
trx_sys
.
any_active_transactions
()
||
(
trx_sys
.
any_active_transactions
()
||
...
@@ -4262,9 +4258,7 @@ static int innodb_init(void* p)
...
@@ -4262,9 +4258,7 @@ static int innodb_init(void* p)
mysql_thread_create
(
thd_destructor_thread_key
,
mysql_thread_create
(
thd_destructor_thread_key
,
&
thd_destructor_thread
,
&
thd_destructor_thread
,
NULL
,
thd_destructor_proxy
,
NULL
);
NULL
,
thd_destructor_proxy
,
NULL
);
while
(
!
my_atomic_loadptr_explicit
(
reinterpret_cast
<
void
**>
while
(
!
srv_running
.
load
(
std
::
memory_order_relaxed
))
(
&
srv_running
),
MY_MEMORY_ORDER_RELAXED
))
os_thread_sleep
(
20
);
os_thread_sleep
(
20
);
}
}
...
@@ -4344,10 +4338,8 @@ innobase_end(handlerton*, ha_panic_function)
...
@@ -4344,10 +4338,8 @@ innobase_end(handlerton*, ha_panic_function)
}
}
}
}
st_my_thread_var
*
running
=
reinterpret_cast
<
st_my_thread_var
*>
(
st_my_thread_var
*
running
=
my_atomic_loadptr_explicit
(
srv_running
.
load
(
std
::
memory_order_relaxed
);
reinterpret_cast
<
void
**>
(
&
srv_running
),
MY_MEMORY_ORDER_RELAXED
));
if
(
!
abort_loop
&&
running
)
{
if
(
!
abort_loop
&&
running
)
{
// may be UNINSTALL PLUGIN statement
// may be UNINSTALL PLUGIN statement
running
->
abort
=
1
;
running
->
abort
=
1
;
...
@@ -17176,9 +17168,7 @@ fast_shutdown_validate(
...
@@ -17176,9 +17168,7 @@ fast_shutdown_validate(
uint
new_val
=
*
reinterpret_cast
<
uint
*>
(
save
);
uint
new_val
=
*
reinterpret_cast
<
uint
*>
(
save
);
if
(
srv_fast_shutdown
&&
!
new_val
if
(
srv_fast_shutdown
&&
!
new_val
&&
!
my_atomic_loadptr_explicit
(
reinterpret_cast
<
void
**>
&&
!
srv_running
.
load
(
std
::
memory_order_relaxed
))
{
(
&
srv_running
),
MY_MEMORY_ORDER_RELAXED
))
{
return
(
1
);
return
(
1
);
}
}
...
...
storage/innobase/include/srv0srv.h
View file @
5c657e9f
...
@@ -447,7 +447,7 @@ extern uint srv_fast_shutdown; /*!< If this is 1, do not do a
...
@@ -447,7 +447,7 @@ extern uint srv_fast_shutdown; /*!< If this is 1, do not do a
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
/** Signal to shut down InnoDB (NULL if shutdown was signaled, or if
running in innodb_read_only mode, srv_read_only_mode) */
running in innodb_read_only mode, srv_read_only_mode) */
extern
st
_my_thread_var
*
srv_running
;
extern
st
d
::
atomic
<
st_my_thread_var
*>
srv_running
;
extern
ibool
srv_innodb_status
;
extern
ibool
srv_innodb_status
;
...
...
storage/innobase/srv/srv0srv.cc
View file @
5c657e9f
...
@@ -2812,9 +2812,7 @@ srv_purge_wakeup()
...
@@ -2812,9 +2812,7 @@ srv_purge_wakeup()
srv_release_threads
(
SRV_WORKER
,
n_workers
);
srv_release_threads
(
SRV_WORKER
,
n_workers
);
}
}
}
while
(
!
my_atomic_loadptr_explicit
(
reinterpret_cast
<
void
**>
}
while
(
!
srv_running
.
load
(
std
::
memory_order_relaxed
)
(
&
srv_running
),
MY_MEMORY_ORDER_RELAXED
)
&&
(
srv_sys
.
n_threads_active
[
SRV_WORKER
]
&&
(
srv_sys
.
n_threads_active
[
SRV_WORKER
]
||
srv_sys
.
n_threads_active
[
SRV_PURGE
]));
||
srv_sys
.
n_threads_active
[
SRV_PURGE
]));
}
}
...
...
storage/innobase/srv/srv0start.cc
View file @
5c657e9f
...
@@ -2416,9 +2416,7 @@ void srv_shutdown_bg_undo_sources()
...
@@ -2416,9 +2416,7 @@ void srv_shutdown_bg_undo_sources()
/** Shut down InnoDB. */
/** Shut down InnoDB. */
void
innodb_shutdown
()
void
innodb_shutdown
()
{
{
ut_ad
(
!
my_atomic_loadptr_explicit
(
reinterpret_cast
<
void
**>
ut_ad
(
!
srv_running
.
load
(
std
::
memory_order_relaxed
));
(
&
srv_running
),
MY_MEMORY_ORDER_RELAXED
));
ut_ad
(
!
srv_undo_sources
);
ut_ad
(
!
srv_undo_sources
);
switch
(
srv_operation
)
{
switch
(
srv_operation
)
{
...
...
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