Debian Codegraph @

storage/innobase/include/log0meb.h

raw
1 /*****************************************************************************
2
3 Copyright (c) 2018, 2026, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the 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,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26 *****************************************************************************/
27 #ifndef log0meb_h
28 #define log0meb_h
29
30 #include "univ.i"
31
32 class THD;
33 struct SYS_VAR;
34 struct st_mysql_value;
35 class innodb_session_t;
36
37 namespace meb {
38
39 /** Performance schema key for the log consumer thread. */
40 extern mysql_pfs_key_t redo_log_archive_consumer_thread_key;
41
42 /** Performance schema key for the redo log archive file. */
43 extern mysql_pfs_key_t redo_log_archive_file_key;
44
45 /* The innodb_redo_log_archive_dirs plugin variable value. */
46 extern char *redo_log_archive_dirs;
47
48 /**
49 Check whether a valid value is given to innodb_redo_log_archive_dirs.
50 This function is registered as a callback with MySQL.
51 @param[in] thd thread handle
52 @param[in] var pointer to system variable
53 @param[out] save immediate result for update function
54 @param[in] value incoming string
55 @return 0 for valid contents
56 */
57 int validate_redo_log_archive_dirs(THD *thd [[maybe_unused]],
58 SYS_VAR *var [[maybe_unused]], void *save,
59 st_mysql_value *value);
60
61 /**
62 Initialize redo log archiving.
63 To be called when the InnoDB handlerton is initialized.
64 */
65 extern void redo_log_archive_init();
66
67 /**
68 De-initialize redo log archiving.
69 To be called when the InnoDB handlerton is de-initialized.
70 */
71 extern void redo_log_archive_deinit();
72
73 /**
74 Security function to be called when the current session ends. This
75 function invokes the stop implementation if this session has started
76 the redo log archiving. It is a safe-guard against an infinitely
77 active redo log archiving if the client goes away without
78 deactivating the logging explicitly.
79
80 @param[in] session the current ending session
81 */
82 extern void redo_log_archive_session_end(innodb_session_t *session);
83
84 /**
85 The producer produces full QUEUE_BLOCK_SIZE redo log blocks. These
86 log blocks are enqueued, and are later fetched by the consumer
87 thread.
88
89 This function does nothing, if redo log archiving is not active.
90
91 In order to produce full QUEUE_BLOCK_SIZE redo log blocks, the
92 producer scans each OS_FILE_LOG_BLOCK_SIZE log block (written by the
93 server) to check if they are,
94
95 1. empty
96 2. incomplete
97
98 The producer skips empty and incomplete log blocks, unless they
99 belong to the last flush, when the contents of its buffer are
100 completely enqueued for flushing.
101
102 @param[in] write_buf The write buffer that is being written
103 to the redo log archive file.
104 @param[in] write_size The size of the data being written.
105 */
106 extern void redo_log_archive_produce(const byte *write_buf,
107 const size_t write_size);
108
109 /**
110 @return true iff redo log archiving is active.
111 */
112 extern bool redo_log_archive_is_active();
113
114 /**
115 Register a privilege. We should move this function and other UDF
116 registration functions to some common utility file later.
117 @param[in] priv_name privilege name
118 @return status
119 @retval false success
120 @retval true failure
121 */
122 extern bool register_privilege(const char *priv_name);
123
124 } // namespace meb
125
126 #endif /* !log0meb_h */