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
90635c6f
Commit
90635c6f
authored
Feb 23, 2015
by
Jan Lindström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-7620: Transaction lock wait is missing number of lock
waits and total wait time.
parent
8366ce47
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
0 deletions
+68
-0
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0trx.h
+13
-0
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+20
-0
storage/xtradb/include/trx0trx.h
storage/xtradb/include/trx0trx.h
+15
-0
storage/xtradb/lock/lock0lock.cc
storage/xtradb/lock/lock0lock.cc
+20
-0
No files found.
storage/innobase/include/trx0trx.h
View file @
90635c6f
...
...
@@ -1009,6 +1009,19 @@ struct trx_t{
/*------------------------------*/
char
detailed_error
[
256
];
/*!< detailed error message for last
error, or empty. */
/* Lock wait statistics */
ulint
n_rec_lock_waits
;
/*!< Number of record lock waits,
might not be exactly correct. */
ulint
n_table_lock_waits
;
/*!< Number of table lock waits,
might not be exactly correct. */
ulint
total_rec_lock_wait_time
;
/*!< Total rec lock wait time up
to this moment. */
ulint
total_table_lock_wait_time
;
/*!< Total table lock wait time
up to this moment. */
};
/* Transaction isolation levels (trx->isolation_level) */
...
...
storage/innobase/lock/lock0lock.cc
View file @
90635c6f
...
...
@@ -2034,6 +2034,8 @@ lock_rec_enqueue_waiting(
MONITOR_INC
(
MONITOR_LOCKREC_WAIT
);
trx
->
n_rec_lock_waits
++
;
return
(
DB_LOCK_WAIT
);
}
...
...
@@ -2454,6 +2456,15 @@ lock_grant(
}
}
/* Cumulate total lock wait time for statistics */
if
(
lock_get_type_low
(
lock
)
&
LOCK_TABLE
)
{
lock
->
trx
->
total_table_lock_wait_time
+=
(
ulint
)
difftime
(
ut_time
(),
lock
->
trx
->
lock
.
wait_started
);
}
else
{
lock
->
trx
->
total_rec_lock_wait_time
+=
(
ulint
)
difftime
(
ut_time
(),
lock
->
trx
->
lock
.
wait_started
);
}
trx_mutex_exit
(
lock
->
trx
);
}
...
...
@@ -4458,6 +4469,7 @@ lock_table_enqueue_waiting(
trx
->
lock
.
wait_started
=
ut_time
();
trx
->
lock
.
was_chosen_as_deadlock_victim
=
FALSE
;
trx
->
n_table_lock_waits
++
;
ut_a
(
que_thr_stop
(
thr
));
...
...
@@ -5458,6 +5470,14 @@ loop:
trx
->
read_view
->
up_limit_id
);
}
/* Total trx lock waits and times */
fprintf
(
file
,
"Trx #rec lock waits %lu #table lock waits %lu
\n
"
,
trx
->
n_rec_lock_waits
,
trx
->
n_table_lock_waits
);
fprintf
(
file
,
"Trx total rec lock wait time %lu SEC
\n
"
,
trx
->
total_rec_lock_wait_time
);
fprintf
(
file
,
"Trx total table lock wait time %lu SEC
\n
"
,
trx
->
total_table_lock_wait_time
);
if
(
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
fprintf
(
file
,
...
...
storage/xtradb/include/trx0trx.h
View file @
90635c6f
/*****************************************************************************
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 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
...
...
@@ -1058,6 +1059,20 @@ struct trx_t{
#define DPAH_SIZE 8192
byte
*
distinct_page_access_hash
;
ibool
take_stats
;
/* Lock wait statistics */
ulint
n_rec_lock_waits
;
/*!< Number of record lock waits,
might not be exactly correct. */
ulint
n_table_lock_waits
;
/*!< Number of table lock waits,
might not be exactly correct. */
ulint
total_rec_lock_wait_time
;
/*!< Total rec lock wait time up
to this moment. */
ulint
total_table_lock_wait_time
;
/*!< Total table lock wait time
up to this moment. */
};
/* Transaction isolation levels (trx->isolation_level) */
...
...
storage/xtradb/lock/lock0lock.cc
View file @
90635c6f
...
...
@@ -2055,6 +2055,8 @@ lock_rec_enqueue_waiting(
MONITOR_INC
(
MONITOR_LOCKREC_WAIT
);
trx
->
n_rec_lock_waits
++
;
return
(
DB_LOCK_WAIT
);
}
...
...
@@ -2474,6 +2476,15 @@ lock_grant(
}
}
/* Cumulate total lock wait time for statistics */
if
(
lock_get_type_low
(
lock
)
&
LOCK_TABLE
)
{
lock
->
trx
->
total_table_lock_wait_time
+=
(
ulint
)
difftime
(
ut_time
(),
lock
->
trx
->
lock
.
wait_started
);
}
else
{
lock
->
trx
->
total_rec_lock_wait_time
+=
(
ulint
)
difftime
(
ut_time
(),
lock
->
trx
->
lock
.
wait_started
);
}
trx_mutex_exit
(
lock
->
trx
);
}
...
...
@@ -4484,6 +4495,7 @@ lock_table_enqueue_waiting(
trx
->
lock
.
wait_started
=
ut_time
();
trx
->
lock
.
was_chosen_as_deadlock_victim
=
FALSE
;
trx
->
n_table_lock_waits
++
;
if
(
UNIV_UNLIKELY
(
trx
->
take_stats
))
{
ut_usectime
(
&
sec
,
&
ms
);
...
...
@@ -5495,6 +5507,14 @@ loop:
trx
->
read_view
->
up_limit_id
);
}
/* Total trx lock waits and times */
fprintf
(
file
,
"Trx #rec lock waits %lu #table lock waits %lu
\n
"
,
trx
->
n_rec_lock_waits
,
trx
->
n_table_lock_waits
);
fprintf
(
file
,
"Trx total rec lock wait time %lu SEC
\n
"
,
trx
->
total_rec_lock_wait_time
);
fprintf
(
file
,
"Trx total table lock wait time %lu SEC
\n
"
,
trx
->
total_table_lock_wait_time
);
if
(
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
fprintf
(
file
,
...
...
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