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
5dc7ad87
Commit
5dc7ad87
authored
Oct 12, 2016
by
sensssz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce conflict during in-order replication.
parent
55d2bff8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+15
-0
storage/xtradb/lock/lock0lock.cc
storage/xtradb/lock/lock0lock.cc
+15
-0
No files found.
storage/innobase/lock/lock0lock.cc
View file @
5dc7ad87
...
...
@@ -388,6 +388,9 @@ extern "C" int thd_need_wait_for(const MYSQL_THD thd);
extern
"C"
int
thd_need_ordering_with
(
const
MYSQL_THD
thd
,
const
MYSQL_THD
other_thd
);
extern
"C"
int
thd_deadlock_victim_preference
(
const
MYSQL_THD
thd1
,
const
MYSQL_THD
thd2
);
/** Stack to use during DFS search. Currently only a single stack is required
because there is no parallel deadlock check. This stack is protected by
the lock_sys_t::mutex. */
...
...
@@ -1988,6 +1991,8 @@ wsrep_print_wait_locks(
/*********************************************************************//**
Check if lock1 has higher priority than lock2.
NULL has lowest priority.
Respect the preference of the upper server layer to reduce conflict
during in-order parallel replication.
If neither of them is wait lock, the first one has higher priority.
If only one of them is a wait lock, it has lower priority.
Otherwise, the one with an older transaction has higher priority.
...
...
@@ -2002,6 +2007,16 @@ has_higher_priority(
}
else
if
(
lock2
==
NULL
)
{
return
true
;
}
// Ask the upper server layer if any of the two trx should be prefered.
int
preference
=
thd_deadlock_victim_preference
(
lock1
->
thd
,
lock2
->
thd
);
if
(
preference
==
-
1
)
{
// lock1 is preferred as a victim, so lock2 has higher priority
return
false
;
}
else
if
(
preference
==
1
)
{
// lock2 is preferred as a victim, so lock1 has higher priority
return
true
;
}
// No preference. Compre them by wait mode and trx age.
if
(
!
lock_get_wait
(
lock1
))
{
return
true
;
}
else
if
(
!
lock_get_wait
(
lock2
))
{
...
...
storage/xtradb/lock/lock0lock.cc
View file @
5dc7ad87
...
...
@@ -388,6 +388,9 @@ extern "C" int thd_need_wait_for(const MYSQL_THD thd);
extern
"C"
int
thd_need_ordering_with
(
const
MYSQL_THD
thd
,
const
MYSQL_THD
other_thd
);
extern
"C"
int
thd_deadlock_victim_preference
(
const
MYSQL_THD
thd1
,
const
MYSQL_THD
thd2
);
/** Stack to use during DFS search. Currently only a single stack is required
because there is no parallel deadlock check. This stack is protected by
the lock_sys_t::mutex. */
...
...
@@ -2011,6 +2014,8 @@ wsrep_print_wait_locks(
/*********************************************************************//**
Check if lock1 has higher priority than lock2.
NULL has lowest priority.
Respect the preference of the upper server layer to reduce conflict
during in-order parallel replication.
If neither of them is wait lock, the first one has higher priority.
If only one of them is a wait lock, it has lower priority.
Otherwise, the one with an older transaction has higher priority.
...
...
@@ -2025,6 +2030,16 @@ has_higher_priority(
}
else
if
(
lock2
==
NULL
)
{
return
true
;
}
// Ask the upper server layer if any of the two trx should be prefered.
int
preference
=
thd_deadlock_victim_preference
(
lock1
->
thd
,
lock2
->
thd
);
if
(
preference
==
-
1
)
{
// lock1 is preferred as a victim, so lock2 has higher priority
return
false
;
}
else
if
(
preference
==
1
)
{
// lock2 is preferred as a victim, so lock1 has higher priority
return
true
;
}
// No preference. Compre them by wait mode and trx age.
if
(
!
lock_get_wait
(
lock1
))
{
return
true
;
}
else
if
(
!
lock_get_wait
(
lock2
))
{
...
...
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