diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-03-13 11:07:34 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-03-16 15:50:03 +0200 |
commit | e15e879fae949a05de549a6676ae66d4f7f8c566 (patch) | |
tree | d919a0e26f3a5ed4376d55226db70a2ac55dfbd3 | |
parent | 84129fb1b52a0631f05ba193f464665c5b369e77 (diff) | |
download | mariadb-git-e15e879fae949a05de549a6676ae66d4f7f8c566.tar.gz |
Remove the unreachable error DB_QUE_THR_SUSPENDED
-rw-r--r-- | storage/innobase/include/db0err.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/lock0lock.h | 18 | ||||
-rw-r--r-- | storage/innobase/include/lock0prdt.h | 7 | ||||
-rw-r--r-- | storage/innobase/include/lock0priv.h | 6 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 65 | ||||
-rw-r--r-- | storage/innobase/lock/lock0prdt.cc | 8 | ||||
-rw-r--r-- | storage/innobase/row/row0mysql.cc | 25 | ||||
-rw-r--r-- | storage/innobase/ut/ut0ut.cc | 2 |
8 files changed, 35 insertions, 99 deletions
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index ef6f8b39abb..ec8e29d458c 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -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 */ diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 026aac1b367..03535b6aaed 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -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( /*=======*/ diff --git a/storage/innobase/include/lock0prdt.h b/storage/innobase/include/lock0prdt.h index 878d575ddc7..e4e37776d22 100644 --- a/storage/innobase/include/lock0prdt.h +++ b/storage/innobase/include/lock0prdt.h @@ -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( /*============================*/ diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index 185779e476f..43f59151991 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -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 diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 819e53e14cc..db079abf10f 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -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( /*===================================*/ diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc index 0e79dd5b460..f6859b70297 100644 --- a/storage/innobase/lock/lock0prdt.cc +++ b/storage/innobase/lock/lock0prdt.cc @@ -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; } } - diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index c7414d9c766..49a042acc20 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -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; } } diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 2a64d77da6f..f655c800901 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -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: |