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
61195094
Commit
61195094
authored
Aug 22, 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
8fc7c288
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
19 deletions
+34
-19
locktree/manager.cc
locktree/manager.cc
+19
-19
portability/toku_pthread.h
portability/toku_pthread.h
+15
-0
No files found.
locktree/manager.cc
View file @
61195094
...
@@ -598,33 +598,33 @@ void locktree::manager::get_status(LTM_STATUS statp) {
...
@@ -598,33 +598,33 @@ 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_COUNT
)
=
m_long_wait_escalation_count
;
STATUS_VALUE
(
LTM_LONG_WAIT_ESCALATION_TIME
)
=
m_long_wait_escalation_time
;
STATUS_VALUE
(
LTM_LONG_WAIT_ESCALATION_TIME
)
=
m_long_wait_escalation_time
;
mutex_lock
();
uint64_t
lock_requests_pending
=
0
;
uint64_t
lock_requests_pending
=
0
;
uint64_t
sto_num_eligible
=
0
;
uint64_t
sto_num_eligible
=
0
;
uint64_t
sto_end_early_count
=
0
;
uint64_t
sto_end_early_count
=
0
;
tokutime_t
sto_end_early_time
=
0
;
tokutime_t
sto_end_early_time
=
0
;
struct
lt_counters
lt_counters
=
m_lt_counters
;
size_t
num_locktrees
=
0
;
struct
lt_counters
lt_counters
=
{};
size_t
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
);
lock_requests_pending
+=
lt
->
m_lock_request_info
.
pending_lock_requests
.
size
();
add_lt_counters
(
&
lt_counters
,
&
lt
->
m_lock_request_info
.
counters
);
toku_mutex_unlock
(
&
lt
->
m_lock_request_info
.
mutex
);
sto_num_eligible
+=
lt
->
sto_txnid_is_valid_unsafe
()
?
1
:
0
;
if
(
toku_mutex_trylock
(
&
m_mutex
)
==
0
)
{
sto_end_early_count
+=
lt
->
m_sto_end_early_count
;
lt_counters
=
m_lt_counters
;
sto_end_early_time
+=
lt
->
m_sto_end_early_time
;
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
);
if
(
toku_mutex_trylock
(
&
lt
->
m_lock_request_info
.
mutex
)
==
0
)
{
lock_requests_pending
+=
lt
->
m_lock_request_info
.
pending_lock_requests
.
size
();
add_lt_counters
(
&
lt_counters
,
&
lt
->
m_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
();
}
}
mutex_unlock
();
STATUS_VALUE
(
LTM_NUM_LOCKTREES
)
=
num_locktrees
;
STATUS_VALUE
(
LTM_NUM_LOCKTREES
)
=
num_locktrees
;
STATUS_VALUE
(
LTM_LOCK_REQUESTS_PENDING
)
=
lock_requests_pending
;
STATUS_VALUE
(
LTM_LOCK_REQUESTS_PENDING
)
=
lock_requests_pending
;
STATUS_VALUE
(
LTM_STO_NUM_ELIGIBLE
)
=
sto_num_eligible
;
STATUS_VALUE
(
LTM_STO_NUM_ELIGIBLE
)
=
sto_num_eligible
;
...
...
portability/toku_pthread.h
View file @
61195094
...
@@ -213,6 +213,21 @@ toku_mutex_lock(toku_mutex_t *mutex) {
...
@@ -213,6 +213,21 @@ toku_mutex_lock(toku_mutex_t *mutex) {
#endif
#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
static
inline
void
toku_mutex_unlock
(
toku_mutex_t
*
mutex
)
{
toku_mutex_unlock
(
toku_mutex_t
*
mutex
)
{
#if TOKU_PTHREAD_DEBUG
#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