1 /*****************************************************************************
2 
3 Copyright (c) 2008, 2019, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
24 
25 *****************************************************************************/
26 
27 /** @file include/api0misc.h
28  InnoDB Native API
29 
30  3/20/2011 Jimmy Yang extracted from Embedded InnoDB
31  2008 Created by Sunny Bains
32  *******************************************************/
33 
34 #ifndef api0misc_h
35 #define api0misc_h
36 
37 #include <sys/types.h>
38 
39 #include "handler.h"
40 #include "os0file.h"
41 #include "que0que.h"
42 #include "trx0trx.h"
43 #include "univ.i"
44 
45 /** Whether binlog is enabled for applications using InnoDB APIs */
46 extern bool ib_binlog_enabled;
47 
48 /** Whether MySQL MDL is enabled for applications using InnoDB APIs */
49 extern bool ib_mdl_enabled;
50 
51 /** Whether InnoDB row lock is disabled for applications using InnoDB APIs */
52 extern bool ib_disable_row_lock;
53 
54 /** configure value for transaction isolation level */
55 extern ulong ib_trx_level_setting;
56 
57 /** configure value for background commit interval (in seconds) */
58 extern ulong ib_bk_commit_interval;
59 
60 struct ib_sdi_key {
61   const sdi_key_t *sdi_key;
62 };
63 
64 struct ib_sdi_vector {
65   sdi_vector_t *sdi_vector;
66 };
67 
68 /* Handles user errors and lock waits detected by the database engine.
69 @param[out]	new_err	possible new error encountered in lock wait, or if no
70 new error, the value of trx->error_state at the entry of this function
71 @param[in]	trx	transaction
72 @param[in]	thr	query thread
73 @param[in]	savept	savepoint or NULL
74 @param[in]	is_sdi	true if table is SDI
75 @return TRUE if it was a lock wait and we should continue running
76 the query thread. */
77 ibool ib_handle_errors(dberr_t *new_err, trx_t *trx, que_thr_t *thr,
78                        trx_savept_t *savept, bool is_sdi);
79 
80 /*************************************************************************
81 Sets a lock on a table.
82 @return error code or DB_SUCCESS */
83 dberr_t ib_trx_lock_table_with_retry(
84     trx_t *trx,           /*!< in/out: transaction */
85     dict_table_t *table,  /*!< in: table to lock */
86     enum lock_mode mode); /*!< in: lock mode */
87 
88 #endif /* api0misc_h */
89