MySQL 26.7.0
Source Code Documentation
fil0innodb_pages_persistence.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
29#ifndef UNIV_HOTBACKUP
30class MetadataRecover;
31
32namespace ib::fil {
34 public:
37 uint32_t /* flags */, const char * /* path */) override {
38 /* NO OP */
39 }
40
43 const char * /* path */) override {
44 /* NO OP */
45 }
46
48 const char * /* old_path */,
49 const char * /* new_path */) override {
50 /* NO OP */
51 }
52
53 [[nodiscard]] Status init() override;
54 [[nodiscard]] Status assume_checkpoint_lsn(Lsn min_needed_lsn) override;
55 void enable_checkpointing() override;
56 void enable_periodical_checkpoints() override;
57 void disable_checkpointing() override;
58 void deinit() override;
59
61 Lsn start_lsn, Lsn end_lsn, ::Flush_observer *observer,
63 iterate_over_dirty_pages) override;
64 void page_became_dirty(struct buf_block_t *buf_block) override;
65 void persist_tablespace(Tablespace_id space_id, const trx_t *trx) override;
66 void persist_tablespaces(::Flush_observer *observer) override;
67
68 [[nodiscard]] ut::Expected<
69 std::vector<Tablespaces_nodes_interface::Tablespace_id>, Status>
70 recover_pages(Lsn &clean_shutdown_lsn) override;
71
72 [[nodiscard]] Status recover_tables() override;
73
74 void page_is_to_be_evicted(Tablespace_id space_id, Page_number page_no,
75 Lsn modification_lsn) override;
76
77 [[nodiscard]] Lsn get_checkpoint_lsn() const override;
78 void request_sharp_checkpoint() override;
79
80 [[nodiscard]] ib::Sys_var_handler_interface &config_handler() override;
81
82 [[nodiscard]] ib::Monitoring_interface &get_monitoring() override;
83
84 private:
85 /** PTM information gathered during recover_pages() to be applied during
86 recover_tables() */
88
89 /** Scan on disk tablespace files in recover() which is called during server
90 bootstrap. */
91 [[nodiscard]] dberr_t scan_tablespaces();
92};
93
94} // namespace ib::fil
95
96#endif /* !UNIV_HOTBACKUP */
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:283
Class to parse persistent dynamic metadata redo log, store and merge them and apply them to in-memory...
Definition: log0recv.h:332
Interface for repoting values of some INFORMATION_SCHEMA.INNODB_METRICS.
Definition: srv0monitoring_interface.h:30
Definition: ha0sys_var_handler_interface.h:36
Interface for handling operations related to page persistence.
Definition: fil0pages_persistence_interface.h:44
ib::redo::Lsn Lsn
Definition: fil0pages_persistence_interface.h:51
Tablespace_node_handle_interface::Page_number Page_number
Type used for numbering the pages in the tablespace.
Definition: fil0pages_persistence_interface.h:47
Tablespaces_nodes_interface::Tablespace_id Tablespace_id
Type used for giving the tablespaces unique number.
Definition: fil0pages_persistence_interface.h:50
Definition: fil0innodb_pages_persistence.h:33
ib::Monitoring_interface & get_monitoring() override
Returns an object responsible for reporting values of monitors related to pages persistence,...
Definition: fil0innodb_pages_persistence.cc:370
Lsn get_checkpoint_lsn() const override
Returns the checkpoint lsn.
Definition: fil0innodb_pages_persistence.cc:51
void enable_periodical_checkpoints() override
From now on, not only advancing the min needed lsn is permitted, but also encouraged.
Definition: fil0innodb_pages_persistence.cc:87
void redo_rename_tablespace(Tablespace_id, const char *, const char *) override
Redo a rename operation for a tablespace.
Definition: fil0innodb_pages_persistence.h:47
void request_sharp_checkpoint() override
The caller request the implementation to ensure that when it returns, it no longer needs the redo log...
Definition: fil0innodb_pages_persistence.cc:316
Status init() override
Allocate and construct helper data structures and start persisting changes to pages,...
Definition: fil0innodb_pages_persistence.cc:55
ut::Expected< std::vector< Tablespaces_nodes_interface::Tablespace_id >, Status > recover_pages(Lsn &clean_shutdown_lsn) override
Run recovery of all tablespaces assuming they already contain all the changes at least up to the prov...
Definition: fil0innodb_pages_persistence.cc:120
void deinit() override
Deinitialize whatever was initialized in init().
Definition: fil0innodb_pages_persistence.cc:320
void page_became_dirty(struct buf_block_t *buf_block) override
A callback that is called from buf_flush_note_oldest_modification() once for each page that became di...
Definition: fil0innodb_pages_persistence.cc:47
MetadataRecover * m_dict_metadata
PTM information gathered during recover_pages() to be applied during recover_tables()
Definition: fil0innodb_pages_persistence.h:87
void mtr_has_dirtied_pages(Lsn start_lsn, Lsn end_lsn, ::Flush_observer *observer, ut::Function_reference< void(ut::Function_reference< void(buf_block_t *)>)> iterate_over_dirty_pages) override
The caller informs that it is now committing an mtr which has dirtied some pages.
Definition: fil0innodb_pages_persistence.cc:91
void persist_tablespace(Tablespace_id space_id, const trx_t *trx) override
Makes sure that for a specified tablespace all changes to pages are persisted.
Definition: fil0innodb_pages_persistence.cc:295
Status recover_tables() override
Run recovery of tables (in particular: mysql.innodb_dynamic_metadata) based on information gathered d...
Definition: fil0innodb_pages_persistence.cc:255
void disable_checkpointing() override
From now on, the implementation is no longer permitted to bump the min needed lsn.
Definition: fil0innodb_pages_persistence.cc:325
void redo_create_tablespace(Tablespaces_nodes_interface::Tablespace_id, uint32_t, const char *) override
Redo a create tablespace storage operation for a tablespace.
Definition: fil0innodb_pages_persistence.h:35
void redo_delete_tablespace(Tablespaces_nodes_interface::Tablespace_id, const char *) override
Redo a delete tablespace storage operation for a tablespace.
Definition: fil0innodb_pages_persistence.h:41
ib::Sys_var_handler_interface & config_handler() override
Returns an object responsible for handling updates of dynamic sys-vars related to pages persistence,...
Definition: fil0innodb_pages_persistence.cc:333
void persist_tablespaces(::Flush_observer *observer) override
Makes sure that all changes to pages that are observed by a specified flush observer are persisted.
Definition: fil0innodb_pages_persistence.cc:305
dberr_t scan_tablespaces()
Scan on disk tablespace files in recover() which is called during server bootstrap.
Definition: fil0innodb_pages_persistence.cc:375
Status assume_checkpoint_lsn(Lsn min_needed_lsn) override
The caller asks the implementation to assume that redo log below min_needed_lsn is not available and ...
Definition: fil0innodb_pages_persistence.cc:72
void page_is_to_be_evicted(Tablespace_id space_id, Page_number page_no, Lsn modification_lsn) override
A callback that is called once the page is freed from the BufferPool.
Definition: fil0innodb_pages_persistence.cc:329
void enable_checkpointing() override
From now on, the implementation is permitted to bump the min needed lsn value reported and persisted ...
Definition: fil0innodb_pages_persistence.cc:83
uint32_t Tablespace_id
Type used for giving the tablespaces unique number.
Definition: fil0tablespaces_nodes_interface.h:40
C++23 std::expected.
Definition: ut0expected.h:74
Definition: ut0function_reference.h:29
dberr_t
Definition: db0err.h:39
Definition: fil0fil.cc:1392
Status
Additional error constants may be added to the list here, keeping in mind the following guidelines ab...
Definition: log0common.h:102
The buffer control block structure.
Definition: buf0buf.h:1756
Definition: trx0trx.h:670