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