MySQL 8.3.0
Source Code Documentation
lock0types.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1996, 2023, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/lock0types.h
28 The transaction lock system global types
29
30 Created 5/7/1996 Heikki Tuuri
31 *******************************************************/
32
33#include "univ.i"
34
35#ifndef lock0types_h
36#define lock0types_h
37
38#define lock_t ib_lock_t
39
40struct lock_t;
41struct lock_sys_t;
42struct lock_table_t;
43
45 SELECT_ORDINARY, /* default behaviour */
46 SELECT_SKIP_LOCKED, /* skip the row if row is locked */
47 SELECT_NOWAIT /* return immediately if row is locked */
48};
49
50/* Basic lock modes */
52 LOCK_IS = 0, /* intention shared */
53 LOCK_IX, /* intention exclusive */
54 LOCK_S, /* shared */
55 LOCK_X, /* exclusive */
56 LOCK_AUTO_INC, /* locks the auto-inc counter of a table
57 in an exclusive mode */
58 LOCK_NONE, /* this is used elsewhere to note consistent read */
59 LOCK_NUM = LOCK_NONE, /* number of lock modes */
60 LOCK_NONE_UNSET = 255
61};
62
63/** Convert the given enum value into string.
64@param[in] mode the lock mode
65@return human readable string of the given enum value */
66inline const char *lock_mode_string(enum lock_mode mode) {
67 switch (mode) {
68 case LOCK_IS:
69 return ("LOCK_IS");
70 case LOCK_IX:
71 return ("LOCK_IX");
72 case LOCK_S:
73 return ("LOCK_S");
74 case LOCK_X:
75 return ("LOCK_X");
76 case LOCK_AUTO_INC:
77 return ("LOCK_AUTO_INC");
78 case LOCK_NONE:
79 return ("LOCK_NONE");
80 case LOCK_NONE_UNSET:
81 return ("LOCK_NONE_UNSET");
82 default:
84 }
85}
86typedef UT_LIST_BASE_NODE_T_EXTERN(lock_t, trx_locks) trx_lock_list_t;
87
88typedef uint32_t trx_schedule_weight_t;
89#endif /* lock0types_h */
uint32_t trx_schedule_weight_t
Definition: lock0types.h:88
const char * lock_mode_string(enum lock_mode mode)
Convert the given enum value into string.
Definition: lock0types.h:66
typedef UT_LIST_BASE_NODE_T_EXTERN(lock_t, trx_locks) trx_lock_list_t
select_mode
Definition: lock0types.h:44
@ SELECT_SKIP_LOCKED
Definition: lock0types.h:46
@ SELECT_NOWAIT
Definition: lock0types.h:47
@ SELECT_ORDINARY
Definition: lock0types.h:45
lock_mode
Definition: lock0types.h:51
@ LOCK_NONE
Definition: lock0types.h:58
@ LOCK_IX
Definition: lock0types.h:53
@ LOCK_AUTO_INC
Definition: lock0types.h:56
@ LOCK_IS
Definition: lock0types.h:52
@ LOCK_S
Definition: lock0types.h:54
@ LOCK_NONE_UNSET
Definition: lock0types.h:60
@ LOCK_X
Definition: lock0types.h:55
@ LOCK_NUM
Definition: lock0types.h:59
mode
Definition: file_handle.h:59
The lock system struct.
Definition: lock0lock.h:1019
Lock struct; protected by lock_sys latches.
Definition: lock0priv.h:135
A table lock.
Definition: lock0priv.h:52
Version control for database, common definitions, and include files.
#define ut_error
Abort execution.
Definition: ut0dbg.h:100