MySQL 8.0.31
Source Code Documentation
srv0conc.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2011, 2022, Oracle and/or its affiliates.
4
5Portions of this file contain modifications contributed and copyrighted by
6Google, Inc. Those modifications are gratefully acknowledged and are described
7briefly in the InnoDB documentation. The contributions by Google are
8incorporated with their permission, and subject to the conditions contained in
9the file COPYING.Google.
10
11Portions of this file contain modifications contributed and copyrighted
12by Percona Inc.. Those modifications are
13gratefully acknowledged and are described briefly in the InnoDB
14documentation. The contributions by Percona Inc. are incorporated with
15their permission, and subject to the conditions contained in the file
16COPYING.Percona.
17
18This program is free software; you can redistribute it and/or modify it under
19the terms of the GNU General Public License, version 2.0, as published by the
20Free Software Foundation.
21
22This program is also distributed with certain software (including but not
23limited to OpenSSL) that is licensed under separate terms, as designated in a
24particular file or component or in included license documentation. The authors
25of MySQL hereby grant you an additional permission to link the program and
26your derivative works with the separately licensed software that they have
27included with MySQL.
28
29This program is distributed in the hope that it will be useful, but WITHOUT
30ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
31FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
32for more details.
33
34You should have received a copy of the GNU General Public License along with
35this program; if not, write to the Free Software Foundation, Inc.,
3651 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37
38*****************************************************************************/
39
40/** @file include/srv0conc.h
41
42 InnoDB concurrency manager header file
43
44 Created 2011/04/18 Sunny Bains
45 *******************************************************/
46
47#ifndef srv_conc_h
48#define srv_conc_h
49
50/** We are prepared for a situation that we have this many threads waiting for
51a semaphore inside InnoDB. innobase_start_or_create_for_mysql() sets the
52value. */
53
54extern uint32_t srv_max_n_threads;
55
56/** The following controls how many threads we let inside InnoDB concurrently:
57threads waiting for locks are not counted into the number because otherwise
58we could get a deadlock. Value of 0 will disable the concurrency check. */
59
60extern ulong srv_thread_concurrency;
61
62struct 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. */
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. */
71void 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. */
76void 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. */
81
82/** Get the count of threads active inside InnoDB. */
83int32_t srv_conc_get_active_threads(void);
84
85#endif /* srv_conc_h */
dberr_t
Definition: db0err.h:38
int32_t srv_conc_get_active_threads(void)
Get the count of threads active inside InnoDB.
Definition: srv0conc.cc:284
void srv_conc_force_exit_innodb(trx_t *trx)
This must be called when a thread exits InnoDB in a lock wait or at the end of an SQL statement.
Definition: srv0conc.cc:258
ulong srv_thread_concurrency
The following controls how many threads we let inside InnoDB concurrently: threads waiting for locks ...
Definition: srv0conc.cc:70
int32_t srv_conc_get_waiting_threads(void)
Get the count of threads waiting inside InnoDB.
Definition: srv0conc.cc:279
dberr_t srv_conc_enter_innodb(row_prebuilt_t *prebuilt)
Puts an OS thread to wait if there are too many concurrent threads (>= srv_thread_concurrency) inside...
Definition: srv0conc.cc:217
uint32_t srv_max_n_threads
We are prepared for a situation that we have this many threads waiting for a semaphore inside InnoDB.
Definition: os0thread.cc:52
void srv_conc_force_enter_innodb(trx_t *trx)
This lets a thread enter InnoDB regardless of the number of threads inside InnoDB.
Definition: srv0conc.cc:233
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:514
trx_t * trx
current transaction handle
Definition: row0mysql.h:522
Definition: trx0trx.h:680