MySQL 8.0.40
Source Code Documentation
arch0log.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2017, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/arch0log.h
29 Innodb interface for log archive
30
31 *******************************************************/
32
33#ifndef ARCH_LOG_INCLUDE
34#define ARCH_LOG_INCLUDE
35
36#include "arch0arch.h"
37
38/** File Node Iterator callback
39@param[in] file_name NULL terminated file name
40@param[in] file_size size of file in bytes
41@param[in] read_offset offset to start reading from
42@param[in] ctx context passed by caller
43@return error code */
44using Log_Arch_Cbk = int(char *file_name, uint64_t file_size,
45 uint64_t read_offset, void *ctx);
46
47/** Redo Log archiver client context */
49 public:
50 /** Constructor: Initialize elementsf */
56
57 /** Get redo file size for archived log file
58 @return size of file in bytes */
60
61 /** Get redo header and trailer size
62 @param[out] header_sz redo header size
63 @param[out] trailer_sz redo trailer size */
64 void get_header_size(uint &header_sz, uint &trailer_sz) const;
65
66 /** Start redo log archiving
67 @param[out] header buffer for redo header (caller must allocate)
68 @param[in] len buffer length
69 @return error code */
70 int start(byte *header, uint len);
71
72 /** Stop redo log archiving. Exact trailer length is returned as out
73 parameter which could be less than the redo block size.
74 @param[out] trailer redo trailer. Caller must allocate buffer.
75 @param[in,out] len trailer length
76 @param[out] offset trailer block offset
77 @return error code */
78 int stop(byte *trailer, uint32_t &len, uint64_t &offset);
79
80 /** Get archived data file details
81 @param[in] cbk_func callback called for each file
82 @param[in] ctx callback function context
83 @return error code */
84 int get_files(Log_Arch_Cbk *cbk_func, void *ctx);
85
86 /** Release archived data so that system can purge it */
87 void release();
88
89 private:
90 /** Archiver client state */
92
93 /** Archive group the client is attached to */
95
96 /** Start LSN for archived data */
98
99 /** Stop LSN for archived data */
101};
102
103#endif /* ARCH_LOG_INCLUDE */
Common interface for redo log and dirty page archiver system.
Arch_Client_State
Archiver client state.
Definition: arch0arch.h:114
@ ARCH_CLIENT_STATE_INIT
Client is initialized.
Definition: arch0arch.h:116
int(char *file_name, uint64_t file_size, uint64_t read_offset, void *ctx) Log_Arch_Cbk
File Node Iterator callback.
Definition: arch0log.h:45
Contiguous archived data for redo log or page tracking.
Definition: arch0arch.h:843
Redo Log archiver client context.
Definition: arch0log.h:48
int stop(byte *trailer, uint32_t &len, uint64_t &offset)
Stop redo log archiving.
Definition: arch0log.cc:79
Arch_Group * m_group
Archive group the client is attached to.
Definition: arch0log.h:94
int start(byte *header, uint len)
Start redo log archiving.
Definition: arch0log.cc:56
Arch_Client_State m_state
Archiver client state.
Definition: arch0log.h:91
os_offset_t get_archived_file_size() const
Get redo file size for archived log file.
Definition: arch0log.cc:46
Log_Arch_Client_Ctx()
Constructor: Initialize elementsf.
Definition: arch0log.h:51
void get_header_size(uint &header_sz, uint &trailer_sz) const
Get redo header and trailer size.
Definition: arch0log.cc:50
int get_files(Log_Arch_Cbk *cbk_func, void *ctx)
Get archived data file details.
Definition: arch0log.cc:112
lsn_t m_end_lsn
Stop LSN for archived data.
Definition: arch0log.h:100
lsn_t m_begin_lsn
Start LSN for archived data.
Definition: arch0log.h:97
void release()
Release archived data so that system can purge it.
Definition: arch0log.cc:179
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
constexpr lsn_t LSN_MAX
Maximum possible lsn value is slightly higher than the maximum sn value, because lsn sequence enumera...
Definition: log0constants.h:159
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
static size_t file_size
Definition: mysql_config_editor.cc:71
std::string file_name(Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0pre_8_0_30.cc:94
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:84
unsigned int uint
Definition: uca9-dump.cc:75