Commit 7f504c72 authored by Jan Lindström's avatar Jan Lindström

Merge branch '10.2-vats' of https://github.com/sensssz/server into sensssz-10.2-vats

parents 33719043 02c88523
...@@ -1754,9 +1754,9 @@ RecLock::lock_alloc( ...@@ -1754,9 +1754,9 @@ RecLock::lock_alloc(
/*********************************************************************//** /*********************************************************************//**
Check if lock1 has higher priority than lock2. Check if lock1 has higher priority than lock2.
NULL has lowest priority. NULL has lowest priority.
If either is a high priority transaction, the lock has higher priority.
If neither of them is wait lock, the first one has higher priority. 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. If only one of them is a wait lock, it has lower priority.
If either is a high priority transaction, the lock has higher priority.
Otherwise, the one with an older transaction has higher priority. Otherwise, the one with an older transaction has higher priority.
@returns true if lock1 has higher priority, false otherwise. */ @returns true if lock1 has higher priority, false otherwise. */
bool bool
...@@ -1769,12 +1769,15 @@ has_higher_priority( ...@@ -1769,12 +1769,15 @@ has_higher_priority(
} else if (lock2 == NULL) { } else if (lock2 == NULL) {
return true; return true;
} }
// No preference. Compre them by wait mode and trx age. // Granted locks has higher priority.
if (!lock_get_wait(lock1)) { if (!lock_get_wait(lock1)) {
return true; return true;
} else if (!lock_get_wait(lock2)) { } else if (!lock_get_wait(lock2)) {
return false; return false;
} }
if (trx_is_high_priority(lock1->trx)) {
return false;
}
return lock1->trx->start_time_micro <= lock2->trx->start_time_micro; return lock1->trx->start_time_micro <= lock2->trx->start_time_micro;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment