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
788b3ee8
Commit
788b3ee8
authored
Mar 13, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce the diff from 5.7 in DeadlockChecker::search()
This is a non-functional change.
parent
bd7ed1b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
50 deletions
+43
-50
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+43
-50
No files found.
storage/innobase/lock/lock0lock.cc
View file @
788b3ee8
...
...
@@ -305,8 +305,8 @@ class DeadlockChecker {
/** This is to avoid malloc/free calls. */
static
state_t
s_states
[
MAX_STACK_SIZE
];
/** Set if thd_rpl_deadlock_check() should be called for waits. */
bool
m_report_waiters
;
/** Set if thd_rpl_deadlock_check() should be called for waits. */
const
bool
m_report_waiters
;
};
/** Counter to mark visited nodes during deadlock search. */
...
...
@@ -7611,7 +7611,6 @@ DeadlockChecker::search()
const
lock_t
*
lock
=
get_first_lock
(
&
heap_no
);
for
(;;)
{
/* We should never visit the same sub-tree more than once. */
ut_ad
(
lock
==
NULL
||
!
is_visited
(
lock
));
...
...
@@ -7626,7 +7625,9 @@ DeadlockChecker::search()
if
(
lock
==
NULL
)
{
break
;
}
else
if
(
lock
==
m_wait_lock
)
{
}
if
(
lock
==
m_wait_lock
)
{
/* We can mark this subtree as searched */
ut_ad
(
lock
->
trx
->
lock
.
deadlock_mark
<=
m_mark_start
);
...
...
@@ -7641,62 +7642,58 @@ DeadlockChecker::search()
/* Backtrack */
lock
=
NULL
;
continue
;
}
}
else
if
(
!
lock_has_to_wait
(
m_wait_lock
,
lock
))
{
if
(
!
lock_has_to_wait
(
m_wait_lock
,
lock
))
{
/* No conflict, next lock */
lock
=
get_next_lock
(
lock
,
heap_no
);
continue
;
}
}
else
if
(
lock
->
trx
==
m_start
)
{
if
(
lock
->
trx
==
m_start
)
{
/* Found a cycle. */
notify
(
lock
);
return
select_victim
();
}
return
(
select_victim
());
}
else
if
(
is_too_deep
())
{
if
(
is_too_deep
())
{
/* Search too deep to continue. */
m_too_deep
=
true
;
return
(
m_start
);
}
else
{
/* We do not need to report autoinc locks to the upper
layer. These locks are released before commit, so they
can not cause deadlocks with binlog-fixed commit
order. */
if
(
m_report_waiters
&&
(
lock_get_type_low
(
lock
)
!=
LOCK_TABLE
||
lock_get_mode
(
lock
)
!=
LOCK_AUTO_INC
))
{
thd_rpl_deadlock_check
(
m_start
->
mysql_thd
,
lock
->
trx
->
mysql_thd
);
}
if
(
lock
->
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
/* Another trx ahead has requested a lock in an
incompatible mode, and is itself waiting for a lock. */
return
m_start
;
}
++
m_cost
;
/* We do not need to report autoinc locks to the upper
layer. These locks are released before commit, so they
can not cause deadlocks with binlog-fixed commit
order. */
if
(
m_report_waiters
&&
(
lock_get_type_low
(
lock
)
!=
LOCK_TABLE
||
lock_get_mode
(
lock
)
!=
LOCK_AUTO_INC
))
{
thd_rpl_deadlock_check
(
m_start
->
mysql_thd
,
lock
->
trx
->
mysql_thd
);
}
if
(
!
push
(
lock
,
heap_no
))
{
m_too_deep
=
true
;
return
(
m_start
);
}
if
(
lock
->
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
/* Another trx ahead has requested a lock in an
incompatible mode, and is itself waiting for a lock. */
++
m_cost
;
m_wait_lock
=
lock
->
trx
->
lock
.
wait_lock
;
if
(
!
push
(
lock
,
heap_no
))
{
m_too_deep
=
true
;
return
m_start
;
}
lock
=
get_first_lock
(
&
heap_no
)
;
m_wait_lock
=
lock
->
trx
->
lock
.
wait_lock
;
if
(
is_visited
(
lock
))
{
lock
=
get_next_lock
(
lock
,
heap_no
);
}
lock
=
get_first_lock
(
&
heap_no
);
}
else
{
if
(
is_visited
(
lock
))
{
lock
=
get_next_lock
(
lock
,
heap_no
);
}
}
else
{
lock
=
get_next_lock
(
lock
,
heap_no
);
}
}
...
...
@@ -7783,17 +7780,13 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
trx_mutex_exit
(
trx
);
const
trx_t
*
victim_trx
;
THD
*
start_mysql_thd
;
bool
report_waits
=
false
;
start_mysql_thd
=
trx
->
mysql_thd
;
if
(
start_mysql_thd
&&
thd_need_wait_reports
(
start_mysql_thd
))
report_waits
=
true
;
const
bool
report_waiters
=
trx
->
mysql_thd
&&
thd_need_wait_reports
(
trx
->
mysql_thd
);
/* Try and resolve as many deadlocks as possible. */
do
{
DeadlockChecker
checker
(
trx
,
lock
,
s_lock_mark_counter
,
report_waits
);
DeadlockChecker
checker
(
trx
,
lock
,
s_lock_mark_counter
,
report_waiters
);
victim_trx
=
checker
.
search
();
...
...
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