MySQL 26.7.0
Source Code Documentation
log0helpers.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2026, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify it under
4the terms of the GNU General Public License, version 2.0, as published by the
5Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
18for more details.
19
20You should have received a copy of the GNU General Public License along with
21this program; if not, write to the Free Software Foundation, Inc.,
2251 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#pragma once
26
28#include "univ.i" //to_int
29#include "ut0core.h" //ut::Location
30#include "ut0log.h" //ib::fatal
31namespace ib::redo {
32inline void must_succeed(Status res, const ut::Location &loc) {
33 if (res != Status::SUCCESS) {
34 ib::fatal(loc) << "Redo Log Handler has failed with " << to_int(res);
35 }
36}
37inline void must_persist_all(
38 const ut::Location &loc,
39 Handler_interface::Durability desired_guarantee =
41 must_succeed(handler->persist_smaller_than(
42 handler->peek_first_unassigned_lsn(), desired_guarantee),
43 loc);
44}
45} // namespace ib::redo
46
47#ifdef UNIV_DEBUG
48inline void DBUG_INJECT_CRASH_WITH_LOG_FLUSH(const char *name) {
52 });
53}
54
55inline void DBUG_INJECT_CRASH_WITH_LOG_FLUSH(const char *prefix,
56 unsigned count) {
57 char buf[64];
58 snprintf(buf, sizeof buf, "%s_%u", prefix, count);
60}
61#else
62#define DBUG_INJECT_CRASH_WITH_LOG_FLUSH(...)
63#endif
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4753
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0log.h:247
Durability
Used by persist_smaller_than(...desired_guarantee) to let the caller specify the desired guarantee ab...
Definition: log0handler_interface.h:602
@ FULLY_PERSISTED
The default level of durability, which ensures that the data was safely written to a stable storage,...
void DBUG_INJECT_CRASH_WITH_LOG_FLUSH(const char *name)
Definition: log0helpers.h:48
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:171
#define DBUG_SUICIDE()
Definition: my_dbug.h:228
static int count
Definition: myisam_ftdump.cc:45
Definition: buf0block_hint.cc:30
Definition: log0common.h:32
Status
Additional error constants may be added to the list here, keeping in mind the following guidelines ab...
Definition: log0common.h:102
void must_succeed(Status res, const ut::Location &loc)
Definition: log0helpers.h:32
void must_persist_all(const ut::Location &loc, Handler_interface::Durability desired_guarantee=Handler_interface::Durability::FULLY_PERSISTED)
Definition: log0helpers.h:37
case opt name
Definition: sslopt-case.h:29
Definition: ut0core.h:36
Version control for database, common definitions, and include files.
constexpr auto to_int(T v) -> typename std::underlying_type< T >::type
Definition: univ.i:660
#define UT_LOCATION_HERE
Definition: ut0core.h:73
Base of InnoDB utilities.