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
f6da2b49
Commit
f6da2b49
authored
Oct 23, 2016
by
sensssz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo changes to XtraDB.
parent
0064d85d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
465 deletions
+53
-465
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+0
-29
storage/xtradb/include/lock0lock.h
storage/xtradb/include/lock0lock.h
+0
-11
storage/xtradb/include/trx0trx.h
storage/xtradb/include/trx0trx.h
+0
-2
storage/xtradb/lock/lock0lock.cc
storage/xtradb/lock/lock0lock.cc
+53
-421
storage/xtradb/trx/trx0trx.cc
storage/xtradb/trx/trx0trx.cc
+0
-2
No files found.
storage/xtradb/handler/ha_innodb.cc
View file @
f6da2b49
...
...
@@ -348,22 +348,6 @@ static TYPELIB innodb_empty_free_list_algorithm_typelib = {
NULL
};
/** Possible values of the parameter innodb_lock_schedule_algorithm */
static
const
char
*
innodb_lock_schedule_algorithm_names
[]
=
{
"fcfs"
,
"vats"
,
NullS
};
/** Used to define an enumerate type of the system variable
innodb_lock_schedule_algorithm. */
static
TYPELIB
innodb_lock_schedule_algorithm_typelib
=
{
array_elements
(
innodb_lock_schedule_algorithm_names
)
-
1
,
"innodb_lock_schedule_algorithm_typelib"
,
innodb_lock_schedule_algorithm_names
,
NULL
};
/* The following counter is used to convey information to InnoDB
about server activity: in case of normal DML ops it is not
sensible to call srv_active_wake_master_thread after each
...
...
@@ -20406,18 +20390,6 @@ static MYSQL_SYSVAR_ENUM(empty_free_list_algorithm,
innodb_srv_empty_free_list_algorithm_validate
,
NULL
,
SRV_EMPTY_FREE_LIST_BACKOFF
,
&
innodb_empty_free_list_algorithm_typelib
);
static
MYSQL_SYSVAR_ENUM
(
lock_schedule_algorithm
,
innodb_lock_schedule_algorithm
,
PLUGIN_VAR_RQCMDARG
,
"The algorithm Innodb uses for deciding which locks to grant next when"
" a lock is released. Possible values are"
" FCFS"
" grant the locks in First-Come-First-Served order;"
" VATS"
" use the Variance-Aware-Transaction-Scheduling algorithm, which"
" uses an Eldest-Transaction-First heuristic."
,
NULL
,
NULL
,
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS
,
&
innodb_lock_schedule_algorithm_typelib
);
static
MYSQL_SYSVAR_LONG
(
buffer_pool_instances
,
innobase_buffer_pool_instances
,
PLUGIN_VAR_RQCMDARG
|
PLUGIN_VAR_READONLY
,
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability"
,
...
...
@@ -21311,7 +21283,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR
(
ft_sort_pll_degree
),
MYSQL_SYSVAR
(
large_prefix
),
MYSQL_SYSVAR
(
force_load_corrupted
),
MYSQL_SYSVAR
(
lock_schedule_algorithm
),
MYSQL_SYSVAR
(
locks_unsafe_for_binlog
),
MYSQL_SYSVAR
(
lock_wait_timeout
),
#ifdef UNIV_LOG_ARCHIVE
...
...
storage/xtradb/include/lock0lock.h
View file @
f6da2b49
...
...
@@ -47,17 +47,6 @@ extern ibool lock_print_waits;
extern
ulint
srv_n_lock_deadlock_count
;
/** Alternatives for innodb_lock_schedule_algorithm, which can be changed by
setting innodb_lock_schedule_algorithm. */
enum
innodb_lock_schedule_algorithm_t
{
/*!< First Come First Served */
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS
,
/*!< Variance-Aware-Transaction-Scheduling */
INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
};
extern
ulong
innodb_lock_schedule_algorithm
;
/*********************************************************************//**
Gets the size of a lock struct.
@return size in bytes */
...
...
storage/xtradb/include/trx0trx.h
View file @
f6da2b49
...
...
@@ -876,8 +876,6 @@ struct trx_t{
time_t
start_time
;
/*!< time the trx state last time became
TRX_STATE_ACTIVE */
clock_t
start_time_micro
;
/*!< start time of the transaction
in microseconds. */
trx_id_t
id
;
/*!< transaction id */
XID
xid
;
/*!< X/Open XA transaction
identification to identify a
...
...
storage/xtradb/lock/lock0lock.cc
View file @
f6da2b49
...
...
@@ -378,25 +378,6 @@ struct lock_stack_t {
const
lock_t
*
lock
;
/*!< Current lock */
const
lock_t
*
wait_lock
;
/*!< Waiting for lock */
ulint
heap_no
;
/*!< heap number if rec lock */
/*********************************************************************//**
Checks if a waiting record lock request still has to wait in a queue.
@return lock that is causing the wait */
static
const
lock_t
*
lock_rec_has_to_wait_in_queue
(
/*==========================*/
const
lock_t
*
wait_lock
);
/*!< in: waiting record lock */
/*************************************************************//**
Grants a lock to a waiting lock request and releases the waiting transaction.
The caller must hold lock_sys->mutex. */
static
void
lock_grant
(
/*=======*/
lock_t
*
lock
,
/*!< in/out: waiting lock request */
bool
owns_trx_mutex
);
/*!< in: whether lock->trx->mutex is owned */
};
extern
"C"
void
thd_rpl_deadlock_check
(
MYSQL_THD
thd
,
MYSQL_THD
other_thd
);
...
...
@@ -404,11 +385,6 @@ extern "C" int thd_need_wait_reports(const MYSQL_THD thd);
extern
"C"
int
thd_need_ordering_with
(
const
MYSQL_THD
thd
,
const
MYSQL_THD
other_thd
);
/** Lock scheduling algorithm */
ulong
innodb_lock_schedule_algorithm
=
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS
;
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. */
...
...
@@ -2029,163 +2005,6 @@ wsrep_print_wait_locks(
}
#endif
/* WITH_WSREP */
/*********************************************************************//**
Check if lock1 has higher priority than lock2.
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 only one of them is a wait lock, it has lower priority.
Otherwise, the one with an older transaction has higher priority.
@returns true if lock1 has higher priority, false otherwise. */
bool
has_higher_priority
(
lock_t
*
lock1
,
lock_t
*
lock2
)
{
if
(
lock1
==
NULL
)
{
return
false
;
}
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
->
trx
->
mysql_thd
,
lock2
->
trx
->
mysql_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
;
}
if
(
trx_is_high_priority
(
lock1
->
trx
))
{
return
true
;
}
if
(
trx_is_high_priority
(
lock2
->
trx
))
{
return
false
;
}
// No preference. Compre them by wait mode and trx age.
if
(
!
lock_get_wait
(
lock1
))
{
return
true
;
}
else
if
(
!
lock_get_wait
(
lock2
))
{
return
false
;
}
return
lock1
->
trx
->
start_time_micro
<=
lock2
->
trx
->
start_time_micro
;
}
/*********************************************************************//**
Insert a lock to the hash list according to the mode (whether it is a wait
lock) and the age of the transaction the it is associated with.
If the lock is not a wait lock, insert it to the head of the hash list.
Otherwise, insert it to the middle of the wait locks according to the age of
the transaciton. */
static
dberr_t
lock_rec_insert_by_trx_age
(
lock_t
*
in_lock
)
/*!< in: lock to be insert */
{
ulint
space
;
ulint
page_no
;
ulint
rec_fold
;
hash_table_t
*
hash
;
hash_cell_t
*
cell
;
lock_t
*
node
;
lock_t
*
next
;
space
=
in_lock
->
un_member
.
rec_lock
.
space
;
page_no
=
in_lock
->
un_member
.
rec_lock
.
page_no
;
rec_fold
=
lock_rec_fold
(
space
,
page_no
);
hash
=
lock_hash_get
(
in_lock
->
type_mode
);
cell
=
hash_get_nth_cell
(
hash
,
hash_calc_hash
(
rec_fold
,
hash
));
node
=
(
lock_t
*
)
cell
->
node
;
// If in_lock is not a wait lock, we insert it to the head of the list.
if
(
node
==
NULL
||
!
lock_get_wait
(
in_lock
)
||
has_higher_priority
(
in_lock
,
node
))
{
cell
->
node
=
in_lock
;
in_lock
->
hash
=
node
;
if
(
lock_get_wait
(
in_lock
))
{
lock_grant
(
in_lock
,
true
);
return
DB_SUCCESS_LOCKED_REC
;
}
return
DB_SUCCESS
;
}
while
(
node
!=
NULL
&&
has_higher_priority
((
lock_t
*
)
node
->
hash
,
in_lock
))
{
node
=
(
lock_t
*
)
node
->
hash
;
}
next
=
(
lock_t
*
)
node
->
hash
;
node
->
hash
=
in_lock
;
in_lock
->
hash
=
next
;
if
(
lock_get_wait
(
in_lock
)
&&
!
lock_rec_has_to_wait_in_queue
(
in_lock
))
{
lock_grant
(
in_lock
,
true
);
if
(
cell
->
node
!=
in_lock
)
{
// Move it to the front of the queue
node
->
hash
=
in_lock
->
hash
;
next
=
(
lock_t
*
)
cell
->
node
;
cell
->
node
=
in_lock
;
in_lock
->
hash
=
next
;
}
return
DB_SUCCESS_LOCKED_REC
;
}
return
DB_SUCCESS
;
}
static
bool
lock_queue_validate
(
const
lock_t
*
in_lock
)
/*!< in: lock whose hash list is to be validated */
{
ulint
space
;
ulint
page_no
;
ulint
rec_fold
;
hash_cell_t
*
cell
;
lock_t
*
next
;
bool
wait_lock
=
false
;
if
(
in_lock
==
NULL
)
{
return
true
;
}
space
=
in_lock
->
un_member
.
rec_lock
.
space
;
page_no
=
in_lock
->
un_member
.
rec_lock
.
page_no
;
rec_fold
=
lock_rec_fold
(
space
,
page_no
);
cell
=
hash_get_nth_cell
(
lock_sys
->
rec_hash
,
hash_calc_hash
(
rec_fold
,
lock_sys
->
rec_hash
));
next
=
(
lock_t
*
)
cell
->
node
;
while
(
next
!=
NULL
)
{
// If this is a granted lock, check that there's no wait lock before it.
if
(
!
lock_get_wait
(
next
))
{
ut_ad
(
!
wait_lock
);
}
else
{
wait_lock
=
true
;
}
next
=
next
->
hash
;
}
return
true
;
}
static
void
lock_rec_insert_to_head
(
lock_t
*
in_lock
,
/*!< in: lock to be insert */
ulint
rec_fold
)
/*!< in: rec_fold of the page */
{
hash_cell_t
*
cell
;
lock_t
*
node
;
if
(
in_lock
==
NULL
)
{
return
;
}
cell
=
hash_get_nth_cell
(
lock_sys
->
rec_hash
,
hash_calc_hash
(
rec_fold
,
lock_sys
->
rec_hash
));
node
=
(
lock_t
*
)
cell
->
node
;
if
(
node
!=
in_lock
)
{
cell
->
node
=
in_lock
;
in_lock
->
hash
=
node
;
}
}
/*********************************************************************//**
Creates a new record lock and inserts it to the lock queue. Does NOT check
for deadlocks or lock compatibility!
...
...
@@ -2213,7 +2032,6 @@ lock_rec_create(
lock_t
*
lock
;
ulint
page_no
;
ulint
space
;
ulint
rec_fold
;
ulint
n_bits
;
ulint
n_bytes
;
const
page_t
*
page
;
...
...
@@ -2228,7 +2046,6 @@ lock_rec_create(
space
=
buf_block_get_space
(
block
);
page_no
=
buf_block_get_page_no
(
block
);
rec_fold
=
lock_rec_fold
(
space
,
page_no
);
page
=
block
->
frame
;
btr_assert_not_corrupted
(
block
,
index
);
...
...
@@ -2351,28 +2168,12 @@ lock_rec_create(
}
trx_mutex_exit
(
c_lock
->
trx
);
}
else
{
if
(
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
&&
!
thd_is_replication_slave_thread
(
trx
->
mysql_thd
))
{
if
(
type_mode
&
LOCK_WAIT
)
{
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
rec_fold
,
lock
);
}
else
{
lock_rec_insert_to_head
(
lock
,
rec_fold
);
}
}
else
{
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
rec_fold
,
lock
);
}
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
lock_rec_fold
(
space
,
page_no
),
lock
);
}
#else
if
(
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
&&
!
thd_is_replication_slave_thread
(
trx
->
mysql_thd
))
{
if
(
type_mode
&
LOCK_WAIT
)
{
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
rec_fold
,
lock
);
}
else
{
lock_rec_insert_to_head
(
lock
,
rec_fold
);
}
}
else
{
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
rec_fold
,
lock
);
}
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
lock_rec_fold
(
space
,
page_no
),
lock
);
#endif
/* WITH_WSREP */
lock_sys
->
rec_num
++
;
...
...
@@ -2499,17 +2300,15 @@ lock_rec_enqueue_waiting(
return
(
DB_DEADLOCK
);
}
dberr_t
result
;
if
(
trx
->
lock
.
wait_lock
==
NULL
)
{
}
else
if
(
trx
->
lock
.
wait_lock
==
NULL
)
{
/* If there was a deadlock but we chose another
transaction as a victim, it is possible that we
already have the lock now granted! */
result
=
DB_SUCCESS_LOCKED_REC
;
}
else
{
return
(
DB_SUCCESS_LOCKED_REC
);
}
trx
->
lock
.
que_state
=
TRX_QUE_LOCK_WAIT
;
trx
->
lock
.
was_chosen_as_deadlock_victim
=
FALSE
;
...
...
@@ -2534,26 +2333,7 @@ lock_rec_enqueue_waiting(
trx
->
n_rec_lock_waits
++
;
result
=
DB_LOCK_WAIT
;
}
// Move it only when it does not cause a deadlock.
if
(
err
!=
DB_DEADLOCK
&&
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
&&
!
thd_is_replication_slave_thread
(
lock
->
trx
->
mysql_thd
)
&&
!
trx_is_high_priority
(
lock
->
trx
))
{
HASH_DELETE
(
lock_t
,
hash
,
lock_hash_get
(
lock
->
type_mode
),
m_rec_id
.
fold
(),
lock
);
dberr_t
res
=
lock_rec_insert_by_trx_age
(
lock
);
if
(
res
!=
DB_SUCCESS
)
{
return
res
;
}
}
return
(
result
);
return
(
DB_LOCK_WAIT
);
}
/*********************************************************************//**
...
...
@@ -2985,17 +2765,13 @@ static
void
lock_grant
(
/*=======*/
lock_t
*
lock
,
/*!< in/out: waiting lock request */
bool
owns_trx_mutex
)
/*!< in: whether lock->trx->mutex is owned */
lock_t
*
lock
)
/*!< in/out: waiting lock request */
{
ut_ad
(
lock_mutex_own
());
ut_ad
(
trx_mutex_own
(
lock
->
trx
)
==
owns_trx_mutex
);
lock_reset_lock_and_trx_wait
(
lock
);
if
(
!
owns_trx_mutex
)
{
trx_mutex_enter
(
lock
->
trx
);
}
if
(
lock_get_mode
(
lock
)
==
LOCK_AUTO_INC
)
{
dict_table_t
*
table
=
lock
->
un_member
.
tab_lock
.
table
;
...
...
@@ -3044,9 +2820,7 @@ lock_grant(
lock
->
wait_time
=
(
ulint
)
difftime
(
ut_time
(),
lock
->
requested_time
);
if
(
!
owns_trx_mutex
)
{
trx_mutex_exit
(
lock
->
trx
);
}
}
/*************************************************************//**
...
...
@@ -3084,65 +2858,6 @@ lock_rec_cancel(
trx_mutex_exit
(
lock
->
trx
);
}
static
void
lock_grant_and_move_on_page
(
hash_table_t
*
lock_hash
,
ulint
space
,
ulint
page_no
)
{
lock_t
*
lock
;
lock_t
*
previous
;
ulint
rec_fold
=
lock_rec_fold
(
space
,
page_no
);
previous
=
(
lock_t
*
)
hash_get_nth_cell
(
lock_hash
,
hash_calc_hash
(
rec_fold
,
lock_hash
))
->
node
;
if
(
previous
==
NULL
)
{
return
;
}
if
(
previous
->
un_member
.
rec_lock
.
space
==
space
&&
previous
->
un_member
.
rec_lock
.
page_no
==
page_no
)
{
lock
=
previous
;
}
else
{
while
(
previous
->
hash
&&
(
previous
->
hash
->
un_member
.
rec_lock
.
space
!=
space
||
previous
->
hash
->
un_member
.
rec_lock
.
page_no
!=
page_no
))
{
previous
=
previous
->
hash
;
}
lock
=
previous
->
hash
;
}
ut_ad
(
previous
->
hash
==
lock
||
previous
==
lock
);
/* Grant locks if there are no conflicting locks ahead.
Move granted locks to the head of the list. */
for
(;
lock
!=
NULL
;)
{
/* If the lock is a wait lock on this page, and it does not need to wait. */
if
((
lock
->
un_member
.
rec_lock
.
space
==
space
)
&&
(
lock
->
un_member
.
rec_lock
.
page_no
==
page_no
)
&&
lock_get_wait
(
lock
)
&&
!
lock_rec_has_to_wait_in_queue
(
lock
))
{
lock_grant
(
lock
,
false
);
if
(
previous
!=
NULL
)
{
/* Move the lock to the head of the list. */
HASH_GET_NEXT
(
hash
,
previous
)
=
HASH_GET_NEXT
(
hash
,
lock
);
lock_rec_insert_to_head
(
lock
,
rec_fold
);
}
else
{
/* Already at the head of the list. */
previous
=
lock
;
}
/* Move on to the next lock. */
lock
=
static_cast
<
lock_t
*>
(
HASH_GET_NEXT
(
hash
,
previous
));
}
else
{
previous
=
lock
;
lock
=
static_cast
<
lock_t
*>
(
HASH_GET_NEXT
(
hash
,
lock
));
}
}
}
/*************************************************************//**
Removes a record lock request, waiting or granted, from the queue and
grants locks to other transactions in the queue if they now are entitled
...
...
@@ -3160,8 +2875,6 @@ lock_rec_dequeue_from_page(
{
ulint
space
;
ulint
page_no
;
ulint
rec_fold
;
lock_t
*
previous
=
NULL
;
lock_t
*
lock
;
trx_lock_t
*
trx_lock
;
...
...
@@ -3173,7 +2886,6 @@ lock_rec_dequeue_from_page(
space
=
in_lock
->
un_member
.
rec_lock
.
space
;
page_no
=
in_lock
->
un_member
.
rec_lock
.
page_no
;
rec_fold
=
lock_rec_fold
(
space
,
page_no
);
in_lock
->
index
->
table
->
n_rec_locks
--
;
...
...
@@ -3186,16 +2898,11 @@ lock_rec_dequeue_from_page(
MONITOR_INC
(
MONITOR_RECLOCK_REMOVED
);
MONITOR_DEC
(
MONITOR_NUM_RECLOCK
);
if
(
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS
||
thd_is_replication_slave_thread
(
in_lock
->
trx
->
mysql_thd
))
{
/* Check if waiting locks in the queue can now be granted:
grant locks if there are no conflicting locks ahead. Stop at
the first X lock that is waiting or has been granted. */
/* Check if waiting locks in the queue can now be granted: grant
locks if there are no conflicting locks ahead. Stop at the first
X lock that is waiting or has been granted. */
for
(
lock
=
lock_rec_get_first_on_page_addr
(
lock_hash
,
space
,
page_no
);
for
(
lock
=
lock_rec_get_first_on_page_addr
(
space
,
page_no
);
lock
!=
NULL
;
lock
=
lock_rec_get_next_on_page
(
lock
))
{
...
...
@@ -3204,12 +2911,8 @@ lock_rec_dequeue_from_page(
/* Grant the lock */
ut_ad
(
lock
->
trx
!=
in_lock
->
trx
);
lock_grant
(
lock
,
false
);
}
lock_grant
(
lock
);
}
}
else
{
lock_grant_and_move_on_page
(
space
,
page_no
);
}
}
...
...
@@ -4415,8 +4118,7 @@ lock_get_first_lock(
}
ut_a
(
lock
!=
NULL
);
ut_a
(
lock
!=
ctx
->
wait_lock
||
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
);
ut_a
(
lock
!=
ctx
->
wait_lock
);
ut_ad
(
lock_get_type_low
(
lock
)
==
lock_get_type_low
(
ctx
->
wait_lock
));
return
(
lock
);
...
...
@@ -5514,72 +5216,12 @@ lock_table_dequeue(
/* Grant the lock */
ut_ad
(
in_lock
->
trx
!=
lock
->
trx
);
lock_grant
(
lock
,
false
);
lock_grant
(
lock
);
}
}
}
/*=========================== LOCK RELEASE ==============================*/
static
void
lock_grant_and_move_on_rec
(
hash_table_t
*
lock_hash
,
lock_t
*
first_lock
,
ulint
heap_no
)
{
lock_t
*
lock
;
lock_t
*
previous
;
ulint
space
;
ulint
page_no
;
ulint
rec_fold
;
space
=
first_lock
->
un_member
.
rec_lock
.
space
;
page_no
=
first_lock
->
un_member
.
rec_lock
.
page_no
;
rec_fold
=
lock_rec_fold
(
space
,
page_no
);
previous
=
(
lock_t
*
)
hash_get_nth_cell
(
lock_hash
,
hash_calc_hash
(
rec_fold
,
lock_hash
))
->
node
;
if
(
previous
==
NULL
)
{
return
;
}
if
(
previous
==
first_lock
)
{
lock
=
previous
;
}
else
{
while
(
previous
->
hash
&&
previous
->
hash
!=
first_lock
)
{
previous
=
previous
->
hash
;
}
lock
=
previous
->
hash
;
}
/* Grant locks if there are no conflicting locks ahead.
Move granted locks to the head of the list. */
for
(;
lock
!=
NULL
;)
{
/* If the lock is a wait lock on this page, and it does not need to wait. */
if
(
lock
->
un_member
.
rec_lock
.
space
==
space
&&
lock
->
un_member
.
rec_lock
.
page_no
==
page_no
&&
lock_rec_get_nth_bit
(
lock
,
heap_no
)
&&
lock_get_wait
(
lock
)
&&
!
lock_rec_has_to_wait_in_queue
(
lock
))
{
lock_grant
(
lock
,
false
);
if
(
previous
!=
NULL
)
{
/* Move the lock to the head of the list. */
HASH_GET_NEXT
(
hash
,
previous
)
=
HASH_GET_NEXT
(
hash
,
lock
);
lock_rec_insert_to_head
(
lock
,
rec_fold
);
}
else
{
/* Already at the head of the list. */
previous
=
lock
;
}
/* Move on to the next lock. */
lock
=
static_cast
<
lock_t
*>
(
HASH_GET_NEXT
(
hash
,
previous
));
}
else
{
previous
=
lock
;
lock
=
static_cast
<
lock_t
*>
(
HASH_GET_NEXT
(
hash
,
lock
));
}
}
}
/*************************************************************//**
Removes a granted record lock of a transaction from the queue and grants
...
...
@@ -5643,10 +5285,6 @@ lock_rec_unlock(
ut_a
(
!
lock_get_wait
(
lock
));
lock_rec_reset_nth_bit
(
lock
,
heap_no
);
if
(
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS
||
thd_is_replication_slave_thread
(
lock
->
trx
->
mysql_thd
))
{
/* Check if we can now grant waiting lock requests */
for
(
lock
=
first_lock
;
lock
!=
NULL
;
...
...
@@ -5656,11 +5294,8 @@ lock_rec_unlock(
/* Grant the lock */
ut_ad
(
trx
!=
lock
->
trx
);
lock_grant
(
lock
,
false
);
}
lock_grant
(
lock
);
}
}
else
{
lock_grant_and_move_on_rec
(
first_lock
,
heap_no
);
}
lock_mutex_exit
();
...
...
@@ -6714,9 +6349,6 @@ lock_rec_queue_validate(
}
}
ut_ad
(
innodb_lock_schedule_algorithm
==
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS
||
lock_queue_validate
(
lock
));
func_exit:
if
(
!
locked_lock_trx_sys
)
{
lock_mutex_exit
();
...
...
storage/xtradb/trx/trx0trx.cc
View file @
f6da2b49
...
...
@@ -1117,8 +1117,6 @@ trx_start_low(
trx
->
start_time
=
ut_time
();
trx
->
start_time_micro
=
clock
();
MONITOR_INC
(
MONITOR_TRX_ACTIVE
);
}
...
...
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