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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ff5a25cc
Commit
ff5a25cc
authored
Aug 21, 2014
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FT-584 use trylock inside of the lock tree manager get_status function so that it is non-blocking
parent
4cb144d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
21 deletions
+35
-21
locktree/manager.cc
locktree/manager.cc
+20
-21
portability/toku_pthread.h
portability/toku_pthread.h
+15
-0
No files found.
locktree/manager.cc
View file @
ff5a25cc
...
...
@@ -530,32 +530,31 @@ void locktree_manager::get_status(LTM_STATUS statp) {
STATUS_VALUE
(
LTM_LONG_WAIT_ESCALATION_COUNT
)
=
m_long_wait_escalation_count
;
STATUS_VALUE
(
LTM_LONG_WAIT_ESCALATION_TIME
)
=
m_long_wait_escalation_time
;
mutex_lock
();
uint64_t
lock_requests_pending
=
0
;
uint64_t
sto_num_eligible
=
0
;
uint64_t
sto_end_early_count
=
0
;
tokutime_t
sto_end_early_time
=
0
;
size_t
num_locktrees
=
0
;
struct
lt_counters
lt_counters
=
{};
struct
lt_counters
lt_counters
=
m_lt_counters
;
size_t
num_locktrees
=
m_locktree_map
.
size
();
if
(
toku_mutex_trylock
(
&
m_mutex
)
==
0
)
{
lt_counters
=
m_lt_counters
;
num_locktrees
=
m_locktree_map
.
size
();
for
(
size_t
i
=
0
;
i
<
num_locktrees
;
i
++
)
{
locktree
*
lt
;
int
r
=
m_locktree_map
.
fetch
(
i
,
&
lt
);
invariant_zero
(
r
);
toku_mutex_lock
(
&
lt
->
m_lock_request_info
.
mutex
);
if
(
toku_mutex_trylock
(
&
lt
->
m_lock_request_info
.
mutex
)
==
0
)
{
lock_requests_pending
+=
lt
->
m_lock_request_info
.
pending_lock_requests
.
size
();
lt_counters
.
add
(
lt
->
get_lock_request_info
()
->
counters
);
toku_mutex_unlock
(
&
lt
->
m_lock_request_info
.
mutex
);
}
sto_num_eligible
+=
lt
->
sto_txnid_is_valid_unsafe
()
?
1
:
0
;
sto_end_early_count
+=
lt
->
m_sto_end_early_count
;
sto_end_early_time
+=
lt
->
m_sto_end_early_time
;
}
mutex_unlock
();
}
STATUS_VALUE
(
LTM_NUM_LOCKTREES
)
=
num_locktrees
;
STATUS_VALUE
(
LTM_LOCK_REQUESTS_PENDING
)
=
lock_requests_pending
;
...
...
portability/toku_pthread.h
View file @
ff5a25cc
...
...
@@ -212,6 +212,21 @@ toku_mutex_lock(toku_mutex_t *mutex) {
#endif
}
static
inline
int
toku_mutex_trylock
(
toku_mutex_t
*
mutex
)
{
int
r
=
pthread_mutex_trylock
(
&
mutex
->
pmutex
);
#if TOKU_PTHREAD_DEBUG
if
(
r
==
0
)
{
invariant
(
mutex
->
valid
);
invariant
(
!
mutex
->
locked
);
invariant
(
mutex
->
owner
==
0
);
mutex
->
locked
=
true
;
mutex
->
owner
=
pthread_self
();
}
#endif
return
r
;
}
static
inline
void
toku_mutex_unlock
(
toku_mutex_t
*
mutex
)
{
#if TOKU_PTHREAD_DEBUG
...
...
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