Debian Codegraph @

storage/innobase/include/srv0conc.h

raw
1 /*****************************************************************************
2
3 Copyright (c) 2011, 2026, Oracle and/or its affiliates.
4
5 Portions of this file contain modifications contributed and copyrighted by
6 Google, Inc. Those modifications are gratefully acknowledged and are described
7 briefly in the InnoDB documentation. The contributions by Google are
8 incorporated with their permission, and subject to the conditions contained in
9 the file COPYING.Google.
10
11 Portions of this file contain modifications contributed and copyrighted
12 by Percona Inc.. Those modifications are
13 gratefully acknowledged and are described briefly in the InnoDB
14 documentation. The contributions by Percona Inc. are incorporated with
15 their permission, and subject to the conditions contained in the file
16 COPYING.Percona.
17
18 This program is free software; you can redistribute it and/or modify it under
19 the terms of the GNU General Public License, version 2.0, as published by the
20 Free Software Foundation.
21
22 This program is designed to work with certain software (including
23 but not limited to OpenSSL) that is licensed under separate terms,
24 as designated in a particular file or component or in included license
25 documentation. The authors of MySQL hereby grant you an additional
26 permission to link the program and your derivative works with the
27 separately licensed software that they have either included with
28 the program or referenced in the documentation.
29
30 This program is distributed in the hope that it will be useful, but WITHOUT
31 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
32 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
33 for more details.
34
35 You should have received a copy of the GNU General Public License along with
36 this program; if not, write to the Free Software Foundation, Inc.,
37 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
38
39 *****************************************************************************/
40
41 /** @file include/srv0conc.h
42
43 InnoDB concurrency manager header file
44
45 Created 2011/04/18 Sunny Bains
46 *******************************************************/
47
48 #ifndef srv_conc_h
49 #define srv_conc_h
50
51 /** We are prepared for a situation that we have this many threads waiting for
52 a semaphore inside InnoDB. */
53
54 extern uint32_t srv_max_n_threads;
55
56 /** The following controls how many threads we let inside InnoDB concurrently:
57 threads waiting for locks are not counted into the number because otherwise
58 we could get a deadlock. Value of 0 will disable the concurrency check. */
59
60 extern ulong srv_thread_concurrency;
61
62 struct row_prebuilt_t;
63 /** Puts an OS thread to wait if there are too many concurrent threads
64 (>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue.
65 @param[in,out] prebuilt row prebuilt handler
66 @return Innodb error code. */
67 dberr_t srv_conc_enter_innodb(row_prebuilt_t *prebuilt);
68
69 /** This lets a thread enter InnoDB regardless of the number of threads inside
70 InnoDB. This must be called when a thread ends a lock wait. */
71 void srv_conc_force_enter_innodb(trx_t *trx); /*!< in: transaction object
72 associated with the thread */
73
74 /** This must be called when a thread exits InnoDB in a lock wait or at the
75 end of an SQL statement. */
76 void srv_conc_force_exit_innodb(trx_t *trx); /*!< in: transaction object
77 associated with the thread */
78
79 /** Get the count of threads waiting inside InnoDB. */
80 int32_t srv_conc_get_waiting_threads(void);
81
82 /** Get the count of threads active inside InnoDB. */
83 int32_t srv_conc_get_active_threads(void);
84
85 #endif /* srv_conc_h */