Skip to content

Commit e15e879

Browse files
committed
Remove the unreachable error DB_QUE_THR_SUSPENDED
1 parent 84129fb commit e15e879

File tree

8 files changed

+35
-99
lines changed

8 files changed

+35
-99
lines changed

storage/innobase/include/db0err.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2015, 2017, MariaDB Corporation.
4+
Copyright (c) 2015, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -43,7 +43,6 @@ enum dberr_t {
4343
DB_DEADLOCK,
4444
DB_ROLLBACK,
4545
DB_DUPLICATE_KEY,
46-
DB_QUE_THR_SUSPENDED,
4746
DB_MISSING_HISTORY, /*!< required history data has been
4847
deleted due to lack of space in
4948
rollback segment */

storage/innobase/include/lock0lock.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, MariaDB Corporation.
4+
Copyright (c) 2017, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
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
285285
be suspended for some reason; if not, then puts the transaction and
286286
the query thread to the lock wait state and inserts a waiting request
287287
for a gap x-lock to the lock queue.
288-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
288+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
289289
dberr_t
290290
lock_rec_insert_check_and_lock(
291291
/*===========================*/
@@ -309,7 +309,7 @@ first tests if the query thread should anyway be suspended for some
309309
reason; if not, then puts the transaction and the query thread to the
310310
lock wait state and inserts a waiting request for a record x-lock to the
311311
lock queue.
312-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
312+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
313313
dberr_t
314314
lock_clust_rec_modify_check_and_lock(
315315
/*=================================*/
@@ -325,7 +325,7 @@ lock_clust_rec_modify_check_and_lock(
325325
/*********************************************************************//**
326326
Checks if locks of other transactions prevent an immediate modify
327327
(delete mark or delete unmark) of a secondary index record.
328-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
328+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
329329
dberr_t
330330
lock_sec_rec_modify_check_and_lock(
331331
/*===============================*/
@@ -345,8 +345,7 @@ lock_sec_rec_modify_check_and_lock(
345345
/*********************************************************************//**
346346
Like lock_clust_rec_read_check_and_lock(), but reads a
347347
secondary index record.
348-
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
349-
or DB_QUE_THR_SUSPENDED */
348+
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
350349
dberr_t
351350
lock_sec_rec_read_check_and_lock(
352351
/*=============================*/
@@ -374,8 +373,7 @@ if the query thread should anyway be suspended for some reason; if not, then
374373
puts the transaction and the query thread to the lock wait state and inserts a
375374
waiting request for a record lock to the lock queue. Sets the requested mode
376375
lock on the record.
377-
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
378-
or DB_QUE_THR_SUSPENDED */
376+
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
379377
dberr_t
380378
lock_clust_rec_read_check_and_lock(
381379
/*===============================*/
@@ -405,7 +403,7 @@ waiting request for a record lock to the lock queue. Sets the requested mode
405403
lock on the record. This is an alternative version of
406404
lock_clust_rec_read_check_and_lock() that does not require the parameter
407405
"offsets".
408-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
406+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
409407
dberr_t
410408
lock_clust_rec_read_check_and_lock_alt(
411409
/*===================================*/
@@ -460,7 +458,7 @@ lock_sec_rec_cons_read_sees(
460458
/*********************************************************************//**
461459
Locks the specified database table in the mode given. If the lock cannot
462460
be granted immediately, the query thread is put to wait.
463-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
461+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
464462
dberr_t
465463
lock_table(
466464
/*=======*/

storage/innobase/include/lock0prdt.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
4+
Copyright (c) 2018, MariaDB Corporation.
45
56
This program is free software; you can redistribute it and/or modify it under
67
the terms of the GNU General Public License as published by the Free Software
@@ -36,7 +37,7 @@ typedef struct lock_prdt {
3637

3738
/*********************************************************************//**
3839
Acquire a predicate lock on a block
39-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
40+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
4041
dberr_t
4142
lock_prdt_lock(
4243
/*===========*/
@@ -56,7 +57,7 @@ lock_prdt_lock(
5657

5758
/*********************************************************************//**
5859
Acquire a "Page" lock on a block
59-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
60+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
6061
dberr_t
6162
lock_place_prdt_page_lock(
6263
/*======================*/
@@ -129,7 +130,7 @@ lock_prdt_update_parent(
129130
/*********************************************************************//**
130131
Checks if locks of other transactions prevent an immediate insert of
131132
a predicate record.
132-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
133+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
133134
dberr_t
134135
lock_prdt_insert_check_and_lock(
135136
/*============================*/

storage/innobase/include/lock0priv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2015, 2016, MariaDB Corporation
4+
Copyright (c) 2015, 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -715,7 +715,7 @@ class RecLock {
715715
@param[in, out] wait_for The lock that the the joining
716716
transaction is waiting for
717717
@param[in] prdt Predicate [optional]
718-
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
718+
@return DB_LOCK_WAIT, DB_DEADLOCK, or
719719
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
720720
there was a deadlock, but another transaction was chosen
721721
as a victim, and we got the lock immediately: no need to
@@ -843,7 +843,7 @@ class RecLock {
843843
/**
844844
Check and resolve any deadlocks
845845
@param[in, out] lock The lock being acquired
846-
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
846+
@return DB_LOCK_WAIT, DB_DEADLOCK, or
847847
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
848848
there was a deadlock, but another transaction was chosen
849849
as a victim, and we got the lock immediately: no need to

storage/innobase/lock/lock0lock.cc

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ RecLock::check_deadlock_result(const trx_t* victim_trx, lock_t* lock)
19991999
/**
20002000
Check and resolve any deadlocks
20012001
@param[in, out] lock The lock being acquired
2002-
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
2002+
@return DB_LOCK_WAIT, DB_DEADLOCK, or
20032003
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
20042004
there was a deadlock, but another transaction was chosen
20052005
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.
20972097
@param[in, out] wait_for The lock that the joining transaction is
20982098
waiting for
20992099
@param[in] prdt Predicate [optional]
2100-
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
2100+
@return DB_LOCK_WAIT, DB_DEADLOCK, or
21012101
DB_SUCCESS_LOCKED_REC; DB_SUCCESS_LOCKED_REC means that
21022102
there was a deadlock, but another transaction was chosen
21032103
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
23802380
low-level function which does NOT look at implicit locks! Checks lock
23812381
compatibility within explicit locks. This function sets a normal next-key
23822382
lock, or in the case of a page supremum record, a gap type lock.
2383-
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
2384-
or DB_QUE_THR_SUSPENDED */
2383+
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
23852384
static
23862385
dberr_t
23872386
lock_rec_lock_slow(
@@ -2467,8 +2466,7 @@ possible, enqueues a waiting lock request. This is a low-level function
24672466
which does NOT look at implicit locks! Checks lock compatibility within
24682467
explicit locks. This function sets a normal next-key lock, or in the case
24692468
of a page supremum record, a gap type lock.
2470-
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
2471-
or DB_QUE_THR_SUSPENDED */
2469+
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
24722470
static
24732471
dberr_t
24742472
lock_rec_lock(
@@ -4446,7 +4444,7 @@ lock_table_remove_low(
44464444
/*********************************************************************//**
44474445
Enqueues a waiting request for a table lock which cannot be granted
44484446
immediately. Checks for deadlocks.
4449-
@return DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED, or
4447+
@return DB_LOCK_WAIT, DB_DEADLOCK, or
44504448
DB_SUCCESS; DB_SUCCESS means that there was a deadlock, but another
44514449
transaction was chosen as a victim, and we got the lock immediately:
44524450
no need to wait then */
@@ -4468,16 +4466,7 @@ lock_table_enqueue_waiting(
44684466

44694467
trx = thr_get_trx(thr);
44704468
ut_ad(trx_mutex_own(trx));
4471-
4472-
/* Test if there already is some other reason to suspend thread:
4473-
we do not enqueue a lock request if the query thread should be
4474-
stopped anyway */
4475-
4476-
if (que_thr_stop(thr)) {
4477-
ut_error;
4478-
4479-
return(DB_QUE_THR_SUSPENDED);
4480-
}
4469+
ut_a(!que_thr_stop(thr));
44814470

44824471
switch (trx_get_dict_operation(trx)) {
44834472
case TRX_DICT_OP_NONE:
@@ -4583,7 +4572,7 @@ lock_table_other_has_incompatible(
45834572
/*********************************************************************//**
45844573
Locks the specified database table in the mode given. If the lock cannot
45854574
be granted immediately, the query thread is put to wait.
4586-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
4575+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
45874576
dberr_t
45884577
lock_table(
45894578
/*=======*/
@@ -4805,32 +4794,8 @@ lock_table_for_trx(
48054794
} else {
48064795
que_thr_stop_for_mysql(thr);
48074796

4808-
if (err != DB_QUE_THR_SUSPENDED) {
4809-
bool was_lock_wait;
4810-
4811-
was_lock_wait = row_mysql_handle_errors(
4812-
&err, trx, thr, NULL);
4813-
4814-
if (was_lock_wait) {
4815-
goto run_again;
4816-
}
4817-
} else {
4818-
que_thr_t* run_thr;
4819-
que_node_t* parent;
4820-
4821-
parent = que_node_get_parent(thr);
4822-
4823-
run_thr = que_fork_start_command(
4824-
static_cast<que_fork_t*>(parent));
4825-
4826-
ut_a(run_thr == thr);
4827-
4828-
/* There was a lock wait but the thread was not
4829-
in a ready to run or running state. */
4830-
trx->error_state = DB_LOCK_WAIT;
4831-
4797+
if (row_mysql_handle_errors(&err, trx, thr, NULL)) {
48324798
goto run_again;
4833-
48344799
}
48354800
}
48364801

@@ -6498,7 +6463,7 @@ a record. If they do, first tests if the query thread should anyway
64986463
be suspended for some reason; if not, then puts the transaction and
64996464
the query thread to the lock wait state and inserts a waiting request
65006465
for a gap x-lock to the lock queue.
6501-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
6466+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
65026467
dberr_t
65036468
lock_rec_insert_check_and_lock(
65046469
/*===========================*/
@@ -6739,7 +6704,7 @@ first tests if the query thread should anyway be suspended for some
67396704
reason; if not, then puts the transaction and the query thread to the
67406705
lock wait state and inserts a waiting request for a record x-lock to the
67416706
lock queue.
6742-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
6707+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
67436708
dberr_t
67446709
lock_clust_rec_modify_check_and_lock(
67456710
/*=================================*/
@@ -6797,7 +6762,7 @@ lock_clust_rec_modify_check_and_lock(
67976762
/*********************************************************************//**
67986763
Checks if locks of other transactions prevent an immediate modify (delete
67996764
mark or delete unmark) of a secondary index record.
6800-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
6765+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
68016766
dberr_t
68026767
lock_sec_rec_modify_check_and_lock(
68036768
/*===============================*/
@@ -6882,8 +6847,7 @@ lock_sec_rec_modify_check_and_lock(
68826847
/*********************************************************************//**
68836848
Like lock_clust_rec_read_check_and_lock(), but reads a
68846849
secondary index record.
6885-
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
6886-
or DB_QUE_THR_SUSPENDED */
6850+
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
68876851
dberr_t
68886852
lock_sec_rec_read_check_and_lock(
68896853
/*=============================*/
@@ -6961,8 +6925,7 @@ if the query thread should anyway be suspended for some reason; if not, then
69616925
puts the transaction and the query thread to the lock wait state and inserts a
69626926
waiting request for a record lock to the lock queue. Sets the requested mode
69636927
lock on the record.
6964-
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, DB_DEADLOCK,
6965-
or DB_QUE_THR_SUSPENDED */
6928+
@return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, DB_LOCK_WAIT, or DB_DEADLOCK */
69666929
dberr_t
69676930
lock_clust_rec_read_check_and_lock(
69686931
/*===============================*/
@@ -7036,7 +6999,7 @@ waiting request for a record lock to the lock queue. Sets the requested mode
70366999
lock on the record. This is an alternative version of
70377000
lock_clust_rec_read_check_and_lock() that does not require the parameter
70387001
"offsets".
7039-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
7002+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
70407003
dberr_t
70417004
lock_clust_rec_read_check_and_lock_alt(
70427005
/*===================================*/

storage/innobase/lock/lock0prdt.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
4+
Copyright (c) 2018, MariaDB Corporation.
45
56
This program is free software; you can redistribute it and/or modify it under
67
the terms of the GNU General Public License as published by the Free Software
@@ -502,7 +503,7 @@ lock_prdt_add_to_queue(
502503
/*********************************************************************//**
503504
Checks if locks of other transactions prevent an immediate insert of
504505
a predicate record.
505-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
506+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
506507
dberr_t
507508
lock_prdt_insert_check_and_lock(
508509
/*============================*/
@@ -785,7 +786,7 @@ lock_init_prdt_from_mbr(
785786

786787
/*********************************************************************//**
787788
Acquire a predicate lock on a block
788-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
789+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
789790
dberr_t
790791
lock_prdt_lock(
791792
/*===========*/
@@ -900,7 +901,7 @@ lock_prdt_lock(
900901

901902
/*********************************************************************//**
902903
Acquire a "Page" lock on a block
903-
@return DB_SUCCESS, DB_LOCK_WAIT, DB_DEADLOCK, or DB_QUE_THR_SUSPENDED */
904+
@return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */
904905
dberr_t
905906
lock_place_prdt_page_lock(
906907
/*======================*/
@@ -1049,4 +1050,3 @@ lock_prdt_page_free_from_discard(
10491050
lock = next_lock;
10501051
}
10511052
}
1052-

storage/innobase/row/row0mysql.cc

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,30 +3155,7 @@ row_mysql_lock_table(
31553155
} else {
31563156
que_thr_stop_for_mysql(thr);
31573157

3158-
if (err != DB_QUE_THR_SUSPENDED) {
3159-
ibool was_lock_wait;
3160-
3161-
was_lock_wait = row_mysql_handle_errors(
3162-
&err, trx, thr, NULL);
3163-
3164-
if (was_lock_wait) {
3165-
goto run_again;
3166-
}
3167-
} else {
3168-
que_thr_t* run_thr;
3169-
que_node_t* parent;
3170-
3171-
parent = que_node_get_parent(thr);
3172-
3173-
run_thr = que_fork_start_command(
3174-
static_cast<que_fork_t*>(parent));
3175-
3176-
ut_a(run_thr == thr);
3177-
3178-
/* There was a lock wait but the thread was not
3179-
in a ready to run or running state. */
3180-
trx->error_state = DB_LOCK_WAIT;
3181-
3158+
if (row_mysql_handle_errors(&err, trx, thr, NULL)) {
31823159
goto run_again;
31833160
}
31843161
}

storage/innobase/ut/ut0ut.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,6 @@ ut_strerr(
582582
return("Rollback");
583583
case DB_DUPLICATE_KEY:
584584
return("Duplicate key");
585-
case DB_QUE_THR_SUSPENDED:
586-
return("The queue thread has been suspended");
587585
case DB_MISSING_HISTORY:
588586
return("Required history data has been deleted");
589587
case DB_CLUSTER_NOT_FOUND:

0 commit comments

Comments
 (0)