mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Remove the unreachable error DB_QUE_THR_SUSPENDED
This commit is contained in:
parent
84129fb1b5
commit
e15e879fae
8 changed files with 35 additions and 99 deletions
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2017, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2018, 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
|
||||
|
@ -43,7 +43,6 @@ enum dberr_t {
|
|||
DB_DEADLOCK,
|
||||
DB_ROLLBACK,
|
||||
DB_DUPLICATE_KEY,
|
||||
DB_QUE_THR_SUSPENDED,
|
||||
DB_MISSING_HISTORY, /*!< required history data has been
|
||||
deleted due to lack of space in
|
||||
rollback segment */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2018, 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
|
||||
|
@ -285,7 +285,7 @@ a record. If they do, first tests if the query thread should anyway
|
|||
be suspended for some reason; if not, then puts the transaction and
|
||||
the query thread to the lock wait state and inserts a waiting request
|
||||
for a gap x-lock to the lock queue.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_rec_insert_check_and_lock(
|
||||
/*===========================*/
|
||||
|
@ -309,7 +309,7 @@ first tests if the query thread should anyway be suspended for some
|
|||
reason; if not, then puts the transaction and the query thread to the
|
||||
lock wait state and inserts a waiting request for a record x-lock to the
|
||||
lock queue.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_clust_rec_modify_check_and_lock(
|
||||
/*=================================*/
|
||||
|
@ -325,7 +325,7 @@ lock_clust_rec_modify_check_and_lock(
|
|||
/*********************************************************************//**
|
||||
Checks if locks of other transactions prevent an immediate modify
|
||||
(delete mark or delete unmark) of a secondary index record.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_sec_rec_modify_check_and_lock(
|
||||
/*===============================*/
|
||||
|
@ -345,8 +345,7 @@ lock_sec_rec_modify_check_and_lock(
|
|||
/*********************************************************************//**
|
||||
Like lock_clust_rec_read_check_and_lock(), but reads a
|
||||
secondary index record.
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
|
||||
or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_sec_rec_read_check_and_lock(
|
||||
/*=============================*/
|
||||
|
@ -374,8 +373,7 @@ if the query thread should anyway be suspended for some reason; if not, then
|
|||
puts the transaction and the query thread to the lock wait state and inserts a
|
||||
waiting request for a record lock to the lock queue. Sets the requested mode
|
||||
lock on the record.
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
|
||||
or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_clust_rec_read_check_and_lock(
|
||||
/*===============================*/
|
||||
|
@ -405,7 +403,7 @@ waiting request for a record lock to the lock queue. Sets the requested mode
|
|||
lock on the record. This is an alternative version of
|
||||
lock_clust_rec_read_check_and_lock() that does not require the parameter
|
||||
"offsets".
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_clust_rec_read_check_and_lock_alt(
|
||||
/*===================================*/
|
||||
|
@ -460,7 +458,7 @@ lock_sec_rec_cons_read_sees(
|
|||
/*********************************************************************//**
|
||||
Locks the specified database table in the mode given. If the lock cannot
|
||||
be granted immediately, the query thread is put to wait.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_table(
|
||||
/*=======*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2018, 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
|
||||
|
@ -36,7 +37,7 @@ typedef struct lock_prdt {
|
|||
|
||||
/*********************************************************************//**
|
||||
Acquire a predicate lock on a block
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_prdt_lock(
|
||||
/*===========*/
|
||||
|
@ -56,7 +57,7 @@ lock_prdt_lock(
|
|||
|
||||
/*********************************************************************//**
|
||||
Acquire a "Page" lock on a block
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_place_prdt_page_lock(
|
||||
/*======================*/
|
||||
|
@ -129,7 +130,7 @@ lock_prdt_update_parent(
|
|||
/*********************************************************************//**
|
||||
Checks if locks of other transactions prevent an immediate insert of
|
||||
a predicate record.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_prdt_insert_check_and_lock(
|
||||
/*============================*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2016, MariaDB Corporation
|
||||
Copyright (c) 2015, 2018, 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
|
||||
|
@ -715,7 +715,7 @@ public:
|
|||
@param[in, out] wait_for The lock that the the joining
|
||||
transaction is waiting for
|
||||
@param[in] prdt Predicate [optional]
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or
|
||||
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
|
||||
there was a deadlock, but another transaction was chosen
|
||||
as a victim, and we got the lock immediately: no need to
|
||||
|
@ -843,7 +843,7 @@ private:
|
|||
/**
|
||||
Check and resolve any deadlocks
|
||||
@param[in, out] lock The lock being acquired
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or
|
||||
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
|
||||
there was a deadlock, but another transaction was chosen
|
||||
as a victim, and we got the lock immediately: no need to
|
||||
|
|
|
@ -1999,7 +1999,7 @@ RecLock::check_deadlock_result(const trx_t* victim_trx, lock_t* lock)
|
|||
/**
|
||||
Check and resolve any deadlocks
|
||||
@param[in, out] lock The lock being acquired
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or
|
||||
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
|
||||
there was a deadlock, but another transaction was chosen
|
||||
as a victim, and we got the lock immediately: no need to
|
||||
|
@ -2097,7 +2097,7 @@ queue is itself waiting roll it back, also do a deadlock check and resolve.
|
|||
@param[in, out] wait_for The lock that the joining transaction is
|
||||
waiting for
|
||||
@param[in] prdt Predicate [optional]
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or
|
||||
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
|
||||
there was a deadlock, but another transaction was chosen
|
||||
as a victim, and we got the lock immediately: no need to
|
||||
|
@ -2380,8 +2380,7 @@ This is the general, and slower, routine for locking a record. This is a
|
|||
low-level function which does NOT look at implicit locks! Checks lock
|
||||
compatibility within explicit locks. This function sets a normal next-key
|
||||
lock, or in the case of a page supremum record, a gap type lock.
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
|
||||
or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
static
|
||||
dberr_t
|
||||
lock_rec_lock_slow(
|
||||
|
@ -2467,8 +2466,7 @@ possible, enqueues a waiting lock request. This is a low-level function
|
|||
which does NOT look at implicit locks! Checks lock compatibility within
|
||||
explicit locks. This function sets a normal next-key lock, or in the case
|
||||
of a page supremum record, a gap type lock.
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
|
||||
or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
static
|
||||
dberr_t
|
||||
lock_rec_lock(
|
||||
|
@ -4446,7 +4444,7 @@ lock_table_remove_low(
|
|||
/*********************************************************************//**
|
||||
Enqueues a waiting request for a table lock which cannot be granted
|
||||
immediately. Checks for deadlocks.
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
|
||||
@return DB_LOCK_WAIT, DB_DEADLOCK, or
|
||||
DB_SUCCESS; DB_SUCCESS means that there was a deadlock, but another
|
||||
transaction was chosen as a victim, and we got the lock immediately:
|
||||
no need to wait then */
|
||||
|
@ -4468,16 +4466,7 @@ lock_table_enqueue_waiting(
|
|||
|
||||
trx = thr_get_trx(thr);
|
||||
ut_ad(trx_mutex_own(trx));
|
||||
|
||||
/* Test if there already is some other reason to suspend thread:
|
||||
we do not enqueue a lock request if the query thread should be
|
||||
stopped anyway */
|
||||
|
||||
if (que_thr_stop(thr)) {
|
||||
ut_error;
|
||||
|
||||
return(DB_QUE_THR_SUSPENDED);
|
||||
}
|
||||
ut_a(!que_thr_stop(thr));
|
||||
|
||||
switch (trx_get_dict_operation(trx)) {
|
||||
case TRX_DICT_OP_NONE:
|
||||
|
@ -4583,7 +4572,7 @@ lock_table_other_has_incompatible(
|
|||
/*********************************************************************//**
|
||||
Locks the specified database table in the mode given. If the lock cannot
|
||||
be granted immediately, the query thread is put to wait.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_table(
|
||||
/*=======*/
|
||||
|
@ -4805,32 +4794,8 @@ run_again:
|
|||
} else {
|
||||
que_thr_stop_for_mysql(thr);
|
||||
|
||||
if (err != DB_QUE_THR_SUSPENDED) {
|
||||
bool was_lock_wait;
|
||||
|
||||
was_lock_wait = row_mysql_handle_errors(
|
||||
&err, trx, thr, NULL);
|
||||
|
||||
if (was_lock_wait) {
|
||||
goto run_again;
|
||||
}
|
||||
} else {
|
||||
que_thr_t* run_thr;
|
||||
que_node_t* parent;
|
||||
|
||||
parent = que_node_get_parent(thr);
|
||||
|
||||
run_thr = que_fork_start_command(
|
||||
static_cast<que_fork_t*>(parent));
|
||||
|
||||
ut_a(run_thr == thr);
|
||||
|
||||
/* There was a lock wait but the thread was not
|
||||
in a ready to run or running state. */
|
||||
trx->error_state = DB_LOCK_WAIT;
|
||||
|
||||
if (row_mysql_handle_errors(&err, trx, thr, NULL)) {
|
||||
goto run_again;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6498,7 +6463,7 @@ a record. If they do, first tests if the query thread should anyway
|
|||
be suspended for some reason; if not, then puts the transaction and
|
||||
the query thread to the lock wait state and inserts a waiting request
|
||||
for a gap x-lock to the lock queue.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_rec_insert_check_and_lock(
|
||||
/*===========================*/
|
||||
|
@ -6739,7 +6704,7 @@ first tests if the query thread should anyway be suspended for some
|
|||
reason; if not, then puts the transaction and the query thread to the
|
||||
lock wait state and inserts a waiting request for a record x-lock to the
|
||||
lock queue.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_clust_rec_modify_check_and_lock(
|
||||
/*=================================*/
|
||||
|
@ -6797,7 +6762,7 @@ lock_clust_rec_modify_check_and_lock(
|
|||
/*********************************************************************//**
|
||||
Checks if locks of other transactions prevent an immediate modify (delete
|
||||
mark or delete unmark) of a secondary index record.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_sec_rec_modify_check_and_lock(
|
||||
/*===============================*/
|
||||
|
@ -6882,8 +6847,7 @@ lock_sec_rec_modify_check_and_lock(
|
|||
/*********************************************************************//**
|
||||
Like lock_clust_rec_read_check_and_lock(), but reads a
|
||||
secondary index record.
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
|
||||
or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_sec_rec_read_check_and_lock(
|
||||
/*=============================*/
|
||||
|
@ -6961,8 +6925,7 @@ if the query thread should anyway be suspended for some reason; if not, then
|
|||
puts the transaction and the query thread to the lock wait state and inserts a
|
||||
waiting request for a record lock to the lock queue. Sets the requested mode
|
||||
lock on the record.
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
|
||||
or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_clust_rec_read_check_and_lock(
|
||||
/*===============================*/
|
||||
|
@ -7036,7 +6999,7 @@ waiting request for a record lock to the lock queue. Sets the requested mode
|
|||
lock on the record. This is an alternative version of
|
||||
lock_clust_rec_read_check_and_lock() that does not require the parameter
|
||||
"offsets".
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_clust_rec_read_check_and_lock_alt(
|
||||
/*===================================*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2018, 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
|
||||
|
@ -502,7 +503,7 @@ lock_prdt_add_to_queue(
|
|||
/*********************************************************************//**
|
||||
Checks if locks of other transactions prevent an immediate insert of
|
||||
a predicate record.
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_prdt_insert_check_and_lock(
|
||||
/*============================*/
|
||||
|
@ -785,7 +786,7 @@ lock_init_prdt_from_mbr(
|
|||
|
||||
/*********************************************************************//**
|
||||
Acquire a predicate lock on a block
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_prdt_lock(
|
||||
/*===========*/
|
||||
|
@ -900,7 +901,7 @@ lock_prdt_lock(
|
|||
|
||||
/*********************************************************************//**
|
||||
Acquire a "Page" lock on a block
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
|
||||
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
|
||||
dberr_t
|
||||
lock_place_prdt_page_lock(
|
||||
/*======================*/
|
||||
|
@ -1049,4 +1050,3 @@ lock_prdt_page_free_from_discard(
|
|||
lock = next_lock;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3155,30 +3155,7 @@ run_again:
|
|||
} else {
|
||||
que_thr_stop_for_mysql(thr);
|
||||
|
||||
if (err != DB_QUE_THR_SUSPENDED) {
|
||||
ibool was_lock_wait;
|
||||
|
||||
was_lock_wait = row_mysql_handle_errors(
|
||||
&err, trx, thr, NULL);
|
||||
|
||||
if (was_lock_wait) {
|
||||
goto run_again;
|
||||
}
|
||||
} else {
|
||||
que_thr_t* run_thr;
|
||||
que_node_t* parent;
|
||||
|
||||
parent = que_node_get_parent(thr);
|
||||
|
||||
run_thr = que_fork_start_command(
|
||||
static_cast<que_fork_t*>(parent));
|
||||
|
||||
ut_a(run_thr == thr);
|
||||
|
||||
/* There was a lock wait but the thread was not
|
||||
in a ready to run or running state. */
|
||||
trx->error_state = DB_LOCK_WAIT;
|
||||
|
||||
if (row_mysql_handle_errors(&err, trx, thr, NULL)) {
|
||||
goto run_again;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -582,8 +582,6 @@ ut_strerr(
|
|||
return("Rollback");
|
||||
case DB_DUPLICATE_KEY:
|
||||
return("Duplicate key");
|
||||
case DB_QUE_THR_SUSPENDED:
|
||||
return("The queue thread has been suspended");
|
||||
case DB_MISSING_HISTORY:
|
||||
return("Required history data has been deleted");
|
||||
case DB_CLUSTER_NOT_FOUND:
|
||||
|
|
Loading…
Reference in a new issue