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