MySQL 26.7.0
Source Code Documentation
log0chkp.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2026, 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/**************************************************/ /**
29
30 Redo log functions related to checkpointing and log free check.
31
32 *******************************************************/
33
34#ifndef log0chkp_h
35#define log0chkp_h
36
37#ifndef UNIV_HOTBACKUP
38
39/* pages_persistence */
41
42/* log_get_sn */
43#include "log0log.h"
44
45/* log.last_checkpoint_lsn */
46#include "log0sys.h"
47
48/* log_t&, lsn_t */
49#include "log0types.h"
50
51/* srv_threads.*, srv_read_only_mode, ... */
52#include "srv0srv.h"
53
54/* sync_check_iterate */
55#include "sync0debug.h"
56
57/* sync_allowed_latches, latch_level_t */
58#include "sync0types.h"
59
60/* ut::aligned_delete ut::aligned_new_withkey */
61#include "ut0new.h"
62
63/** @name Log - checkpointer thread */
64/** @{ */
65
66/** Checks if log checkpointer thread is active.
67@return true if and only if the log checkpointer thread is active */
70}
71
72/** @} */
73/** @name Log - checkpointer mutex */
74/** @{ */
75
76#define log_checkpointer_mutex_enter() \
77 mutex_enter(&(log_checkpointing->checkpoint_mutex))
78
79#define log_checkpointer_mutex_exit() \
80 mutex_exit(&(log_checkpointing->checkpoint_mutex))
81
82#define log_checkpointer_mutex_own() \
83 (mutex_own(&(log_checkpointing->checkpoint_mutex)) || \
84 !log_checkpointer_is_active())
85
86/** @} */
87/** @name Log - limits mutex */
88/** @{ */
89
90#define log_limits_mutex_enter() mutex_enter(&(log_checkpointing->limits_mutex))
91
92#define log_limits_mutex_exit() mutex_exit(&(log_checkpointing->limits_mutex))
93
94#define log_limits_mutex_own() mutex_own(&(log_checkpointing->limits_mutex))
95
96/** @} */
97/** @name Log - basic information about checkpoints. */
98/** @{ */
99
100/** Provides opposite checkpoint header number to the given checkpoint
101header number.
102@param[in] checkpoint_header_no the given checkpoint header number
103@return the opposite checkpoint header number */
105 Log_checkpoint_header_no checkpoint_header_no);
106
107/** @} */
108
110 private:
111 /** @name Coordination with buffer pool and oldest_lsn */
112 /** @{ */
113
114 /** Updates lsn available for checkpoint. (Never decreases it)
115 @return the updated value of m_available_for_checkpoint */
117
118 public:
119 [[nodiscard]] lsn_t get_available_for_checkpoint_lsn() const;
120 /** @} */
121 /** @name Requests to make checkpoint */
122 /** @{ */
123
124 /** Requests a checkpoint written for lsn greater or equal to provided one.
125 Caller must hold log_limits_mutex
126 @param[in] requested_lsn checkpoint should be not older than this
127 @return true iff checkpoints are enabled and request was made */
128 bool request_checkpoint(lsn_t requested_lsn);
129
130 /** Requests a fuzzy checkpoint write (for currently available lsn).
131 @param[in] sync whether request is sync (function should wait) */
132 void request_fuzzy_checkpoint(bool sync);
133
134 /** Make a checkpoint at the current lsn. Reads current lsn and waits
135 until all dirty pages have been flushed up to that lsn. Afterwards
136 requests a checkpoint write and waits until it is finished. */
138
139 private:
140 /** Returns highest requested checkpoint lsn */
142 return m_requested_checkpoint_lsn.load();
143 }
144
145 /** @} */
146 /** @name Periodical updates */
147 /** @{ */
148
149 [[nodiscard]] bool are_periodical_checkpoints_enabled() const;
150
151 /** Calculates time that elapsed since last checkpoint.
152 @return Time duration elapsed since the last checkpoint */
153 [[nodiscard]] std::chrono::steady_clock::duration time_since_checkpoint();
154
155 public:
157
158 /** @} */
159
160 /** Allocates and constructs the global log_checkpointing object */
161 static void init();
162
163 /** Destructs and deallocates the global log_checkpointing object. */
164 static void deinit();
165
166 private:
169 template <typename T>
170 friend void ut::aligned_delete(T *ptr) noexcept;
171
172 template <typename T, typename... Args>
174 std::size_t alignment, Args &&...args);
175
176 public:
177 /** @name Last known checkpoint lsn value */
178 /** @{ */
179
180 /** Updates the cached checkpoint_lsn */
181 void set_checkpoint(lsn_t checkpoint_lsn) {
182 m_checkpoint_lsn.store(checkpoint_lsn);
183 }
184
185 /** @return Cached checkpoint_lsn */
186 [[nodiscard]] lsn_t get_checkpoint() { return m_checkpoint_lsn.load(); }
187
188 /** Save the checkpoint lsn to the persistent store
189 @param[in] checkpoint_lsn checkpoint lsn to be persisted
190 @return true iff the lsn is persisted, false otherwise. */
191 [[nodiscard]] bool save_checkpoint_value(lsn_t checkpoint_lsn);
192
193 /** Fetch the checkpoint lsn from the persistent store
194 @return DB_SUCCESS or error */
195 [[nodiscard]] dberr_t load_checkpoint_value();
196
197 /** @} */
198 /** @name Making checkpoints */
199 /** @{ */
200 private:
201 /** Figures out m_available_for_checkpoint_lsn*/
202 [[nodiscard]] lsn_t determine_checkpoint_lsn();
203
204 /** Considers requesting page cleaners to execute sync flush. */
205 void consider_sync_flush();
206
207 /** Checks if checkpoint should be written. Checks time elapsed since the last
208 checkpoint, age of the last checkpoint and if there was any extra request to
209 write the checkpoint (e.g. coming from
210 log_checkpointing->request_sharp_checkpoint()).
211 @return true if checkpoint should be written */
212 bool should_checkpoint();
213
214 /** Considers writing next checkpoint. Checks if checkpoint should be written
215 (using should_checkpoint()) and writes the checkpoint if that's the case. */
216 void consider_checkpoint();
217
218 /** Makes a checkpoint. Note that this function does not flush dirty blocks
219 from the buffer pool. It only checks what is lsn of the oldest modification
220 in the buffer pool, and writes information about the lsn in log files.
221 */
222 void create_checkpoint();
223
224 /** @} */
225 /** @name The log_free_check() mechanism */
226 /** @{ */
227
228 public:
229 /** Calls ib::redo::handler->do_not_need_smaller_than(get_checkpoint_lsn()).
230 We prefer to have Log_checkpointing be the only place which calls
231 do_not_need_smaller_than() so that it is easier to reason about, and to
232 ensure that the argument passed is the checkpoint.
233 We know that ib::redo::Handler::do_not_need_smaller_than() will recompute
234 log_sys->m_free_check_limit_lsn used in wait_for_space(), based on things
235 like checkpoint_lsn, log.m_capacity etc, so we call update_limits() whenever
236 any of them changes. */
237 void update_limits();
238
239 /** @} */
240 /** @name Dirty page flushing speed control */
241 /** @{ */
242
243 /** Retrieves limitations determined by the current state of log.m_capacity.
244 These values are retrieved atomically (are consistent with each other).
245
246 @param[out] limit_for_free_check soft capacity of the redo decreased by
247 the current free check margin; this is
248 limit for size of redo until which the
249 log_free_check calls do not force waits
250 @param[out] limit_for_dirty_page_age limit for the oldest dirty page until
251 which the async (adaptive) flushing is
252 not forced to be started (it might be
253 started if turned on explicitly by the
254 innodb_adaptive_flushing); note that
255 computation of this value include doing
256 the subtraction of the current log free
257 check margin */
258 void get_limits(lsn_t &limit_for_free_check, lsn_t &limit_for_dirty_page_age);
259
260 /** Once checkpoint age exceeds this value, the flushing of pages starts to
261 be adaptive. The adaptive page flushing is becoming more and more aggressive
262 in the following range: adaptive_flush_min_age()..adaptive_flush_max_age().
263 @note This value changes only during calls to @see update or @see initialize.
264 @note Note that it must hold:
265 adaptive_flush_min_age() < adaptive_flush_max_age() <=
266 soft_logical_capacity().
267 @remarks
268 The diagram below shows how flushing / checkpointing becomes more aggressive
269 when the age of the oldest modified page gets increased:
270
271 adaptive_flush_min_age adaptive_flush_max_age aggressive_checkpoint_min_age
272 | | |
273 -------!------------------------!---------------------!----------------->age
274 regular adaptive flushing aggressive flushing aggr. checkpoints
275 @return limitation to start adaptive flushing */
276 [[nodiscard]] static lsn_t adaptive_flush_min_age();
277
278 /** Once checkpoint age exceeds that value, the flushing of pages is the most
279 aggressive possible since then. For more details @see adaptive_flush_min_age.
280 @note This value changes only during calls to @see update or @see initialize.
281 @return limitation to start furious flushing */
282 [[nodiscard]] static lsn_t adaptive_flush_max_age();
283
284 /** Once checkpoint age exceeds that value, the log checkpointer thread keeps
285 writing checkpoints aggressively (whatever the progress of last_checkpoint_lsn
286 would it make). Before that happens, checkpoints could be written periodically
287 (for more details @see adaptive_flush_min_age).
288 @note This value changes only during calls to @see update or @see initialize.
289 @note It holds: adaptive_flush_max_age() < aggressive_checkpoint_min_age().
290 @return limitation to start aggressive checkpointing */
291 [[nodiscard]] static lsn_t aggressive_checkpoint_min_age();
292 /** Computes lsn up to which sync flush of pages should be done or returns 0
293 if there is no need to execute sync flush of dirty pages now.
294 @return lsn for which we want to have oldest_lsn >= lsn in each BP,
295 or 0 if there is no need for sync flush */
296 [[nodiscard]] lsn_t get_sync_flush_lsn();
297
298 private:
299 /** @} */
300 /** @name The checkpointer thread */
301 /** @{ */
302
303 /** The actual non-static body of the static log_checkpointer() */
304 void do_work();
305
306 public:
307 /** Informs the log checkpointer that it should stop, but does not wait for it
308 to happen. */
309 void stop_thread_no_wait();
310
311 /** Informs the log checkpointer that it should stop and waits for it to
312 happen before returning to the caller */
314
315 /** Starts the log checkpointer thread. */
316 void start_thread();
317
318 /** The log checkpointer thread routine. */
319 static void log_checkpointer();
320 /** @} */
321
322 private:
323 std::atomic_bool m_thread_should_stop{};
324
325 /** Latest checkpoint lsn.
326 Read by: user threads, log_print (no protection)
327 Read by: log_writer (under writer_mutex)
328 Updated by: log_checkpointer (under both mutexes)
329 Protected by (updates only): checkpoint_mutex + writer_mutex. */
331
332 /** Latest checkpoint wall time.
333 Used by (private): log_checkpointer.
334 Protected by: checkpoint_mutex (although, its used only from one thread) */
336
337 /**
338
339 @name Fields protected by the log_limits_mutex.
340 Related to free space in the redo log.
341
342 @{ */
343
344 /** A new checkpoint could be written for this lsn value.
345 Up to this lsn value, all dirty pages have been added to flush
346 lists and flushed. Updated in the log checkpointer thread by
347 taking minimum oldest_modification out of the last dirty pages
348 from each flush list minus Buf_flush_list_added_lsns::order_lag().
349 However, it will not be bigger than the current value of
350 Buf_flush_list_added_lsns::smallest_not_added_lsn().
351 Read by: user threads when requesting fuzzy checkpoint
352 Read by: log_print() (printing status of redo)
353 Updated by: log_checkpointer
354 Protected by: limits_mutex. */
356
357 /** When this is larger than the latest checkpoint, the log checkpointer
358 thread will be forced to write a new checkpoint (unless the new latest
359 checkpoint lsn would still be smaller than this value).
360 Read by: log_checkpointer without and with limit_mutex
361 Read by: buf_flush_page_coordinator_thread under limits_mutex
362 Updated by: user threads (log_free_check() or for sharp checkpoint)
363 Protected by: limits_mutex. */
365
366 /** @} */
367
368 /** If should perform checkpoints every innodb_log_checkpoint_every ms, or
369 when doing so would help reclaim oldest redo log file.
370 Disabled during startup. Enabled in srv_start_threads.
371 Updated by: starting thread (srv_start_threads)
372 Read by: log_checkpointer */
374
375 /** THD used by the log_checkpointer thread. */
377
378 public:
379 /** Event used by the log checkpointer thread to wait for requests. */
381
382 /** Event signaled by log checkpointer when it advances m_checkpoint_lsn. */
384
385 /** Mutex which can be used to pause log checkpointer thread.
386 This is used by log_position_lock() together with log_buffer_x_lock(),
387 to pause any changes to current_lsn or last_checkpoint_lsn. */
388 alignas(ut::INNODB_CACHE_LINE_SIZE) mutable ib_mutex_t checkpoint_mutex;
389
390 /** Mutex which protects fields: m_available_for_checkpoint_lsn,
391 m_requested_checkpoint_lsn. It also synchronizes updates of
392 log_sys_t::m_free_check_limit_lsn. It protects reads and writes of
393 log_sys_t::m_writer_inside_extra_margin. It also protects the
394 srv_checkpoint_disabled (together with the checkpoint_mutex). */
395 alignas(ut::INNODB_CACHE_LINE_SIZE) mutable ib_mutex_t limits_mutex;
396};
397
399
400/** Calculates age of current checkpoint as number of bytes since
401last checkpoint. This includes bytes for headers and footers of
402all log blocks. The calculation is based on the latest written
403checkpoint lsn, and the current lsn, which points to the first
404non reserved data byte. Note that the current lsn could not fit
405the free space in the log files. This means that the checkpoint
406age could potentially be larger than capacity of the log files.
407However we do the best effort to avoid such situations, and if
408they happen, user threads wait until the space is reclaimed.
409@return checkpoint age as number of bytes */
410[[nodiscard]] inline lsn_t log_get_checkpoint_age() {
411 const lsn_t last_checkpoint_lsn = pages_persistence->get_checkpoint_lsn();
412
414
415 if (current_lsn <= last_checkpoint_lsn) {
416 /* Writes or reads have been somehow reordered.
417 Note that this function does not provide any lock,
418 and does not assume any lock existing. Therefore
419 the calculated result is already outdated when the
420 function is finished. Hence, we might assume that
421 this time we calculated age = 0, because checkpoint
422 lsn is close to current lsn if such race happened. */
423 return 0;
424 }
425
426 return current_lsn - last_checkpoint_lsn;
427}
428
430 const {
433}
434
435[[nodiscard]] inline bool
439}
440
445}
446
447/** @name Log - other functions related to checkpoints. */
448/** @{ */
449
450/** Writes checkpoint to the file containing the written checkpoint_lsn.
451The checkpoint is written to the given checkpoint header. Unless InnoDB
452is starting: checkpointer, writer and files mutexes must be acquired
453before calling this function.
454@param[in,out] log redo log
455@param[in] checkpoint_file_handle handle to opened file
456@param[in] checkpoint_header_no checkpoint header to be written
457@param[in] next_checkpoint_lsn the checkpoint lsn to write
458@return DB_SUCCESS or error */
460 log_t &log, Log_file_handle &checkpoint_file_handle,
461 Log_checkpoint_header_no checkpoint_header_no, lsn_t next_checkpoint_lsn);
462
463/** Writes the first data block to the log file using the provided handle
464to the opened log file. The block is addressed by the given checkpoint_lsn,
465filled with 0x00 and its data length points to checkpoint_lsn inside, making
466the block logically empty.
467@remarks This is used only during creation of new log files.
468@param[in,out] log redo log
469@param[in] file_handle handle to the opened log file
470@param[in] checkpoint_lsn the checkpoint lsn
471@param[in] file_start_lsn start_lsn of the file
472@return DB_SUCCESS or error */
474 Log_file_handle &file_handle,
475 lsn_t checkpoint_lsn,
476 lsn_t file_start_lsn);
477
478/** Writes the next checkpoint to the log file, by writing a single
479checkpoint header with the checkpoint lsn. Flushes the file after the
480write and updates the log.last_checkpoint_lsn.
481
482@remarks Note that two checkpoint headers are used alternately for
483consecutive checkpoints. If InnoDB crashed during the write, it would
484still have the previous checkpoint info and recovery would work.
485@param[in,out] log redo log
486@param[in] lsn writes checkpoint at this lsn
487@return DB_SUCCESS or error */
489
490/** @} */
491
492/** Updates:
493 - Innodb_redo_log_checkpoint_lsn,
494 - Innodb_redo_log_current_lsn,
495 - Innodb_redo_log_flushed_to_disk_lsn.
496They should be updated "together", to present a consistent state to the user,
497that is one in which checkpoint_lsn <= flushed_to_disk_lsn <= current_lsn.
498Calls are protected by log_checkpointer->limits_mutex, which is to avoid torn
499writes to these exposed fields, but otherwise does not enforce above
500inequalities. Instead they follow from loading atomics in the order from the
501conceptually smallest to the largest - a load synchronizes with the store, which
502in turn should happen after the conceptually larger atomic already was at least
503equal to the stored value, so can be only larger now.
504*/
506#endif /* !UNIV_HOTBACKUP */
507
508#endif /* !log0chkp_h */
Definition: log0chkp.h:109
os_event_t m_next_checkpoint_event
Event signaled by log checkpointer when it advances m_checkpoint_lsn.
Definition: log0chkp.h:383
static void deinit()
Destructs and deallocates the global log_checkpointing object.
Definition: log0chkp.cc:382
atomic_lsn_t m_requested_checkpoint_lsn
When this is larger than the latest checkpoint, the log checkpointer thread will be forced to write a...
Definition: log0chkp.h:364
void consider_sync_flush()
Considers requesting page cleaners to execute sync flush.
Definition: log0chkp.cc:755
void consider_checkpoint()
Considers writing next checkpoint.
Definition: log0chkp.cc:843
static void log_checkpointer()
The log checkpointer thread routine.
Definition: log0chkp.cc:851
Log_clock_point m_last_checkpoint_time
Latest checkpoint wall time.
Definition: log0chkp.h:335
void do_work()
The actual non-static body of the static log_checkpointer()
Definition: log0chkp.cc:853
static lsn_t aggressive_checkpoint_min_age()
Once checkpoint age exceeds that value, the log checkpointer thread keeps writing checkpoints aggress...
Definition: log0chkp.cc:685
void update_limits()
Calls ib::redo::handler->do_not_need_smaller_than(get_checkpoint_lsn()).
Definition: log0chkp.cc:951
bool are_periodical_checkpoints_enabled() const
Definition: log0chkp.h:436
void enable_periodical_checkpoints()
Definition: log0chkp.h:441
std::chrono::steady_clock::duration time_since_checkpoint()
Calculates time that elapsed since last checkpoint.
Definition: log0chkp.cc:774
static void init()
Allocates and constructs the global log_checkpointing object.
Definition: log0chkp.cc:377
static lsn_t adaptive_flush_max_age()
Once checkpoint age exceeds that value, the flushing of pages is the most aggressive possible since t...
Definition: log0chkp.cc:663
static lsn_t adaptive_flush_min_age()
Once checkpoint age exceeds this value, the flushing of pages starts to be adaptive.
Definition: log0chkp.cc:674
void stop_thread_and_wait()
Informs the log checkpointer that it should stop and waits for it to happen before returning to the c...
Definition: log0chkp.cc:943
lsn_t get_checkpoint()
Definition: log0chkp.h:186
lsn_t get_requested_checkpoint_lsn()
Returns highest requested checkpoint lsn.
Definition: log0chkp.h:141
void set_checkpoint(lsn_t checkpoint_lsn)
Updates the cached checkpoint_lsn.
Definition: log0chkp.h:181
bool should_checkpoint()
Checks if checkpoint should be written.
Definition: log0chkp.cc:779
bool m_periodical_checkpoints_enabled
If should perform checkpoints every innodb_log_checkpoint_every ms, or when doing so would help recla...
Definition: log0chkp.h:373
void get_limits(lsn_t &limit_for_free_check, lsn_t &limit_for_dirty_page_age)
Retrieves limitations determined by the current state of log.m_capacity.
Definition: log0chkp.cc:1011
ib_mutex_t checkpoint_mutex
Mutex which can be used to pause log checkpointer thread.
Definition: log0chkp.h:388
lsn_t get_available_for_checkpoint_lsn() const
Definition: log0chkp.h:429
lsn_t get_sync_flush_lsn()
Computes lsn up to which sync flush of pages should be done or returns 0 if there is no need to execu...
Definition: log0chkp.cc:689
void create_checkpoint()
Makes a checkpoint.
Definition: log0chkp.cc:416
void request_fuzzy_checkpoint(bool sync)
Requests a fuzzy checkpoint write (for currently available lsn).
Definition: log0chkp.cc:575
lsn_t update_available_for_checkpoint_lsn()
Updates lsn available for checkpoint.
Definition: log0chkp.cc:245
Log_checkpointing()
Definition: log0chkp.cc:363
void start_thread()
Starts the log checkpointer thread.
Definition: log0chkp.cc:930
bool request_checkpoint(lsn_t requested_lsn)
Requests a checkpoint written for lsn greater or equal to provided one.
Definition: log0chkp.cc:545
~Log_checkpointing()
Definition: log0chkp.cc:370
std::atomic_bool m_thread_should_stop
Definition: log0chkp.h:323
dberr_t load_checkpoint_value()
Fetch the checkpoint lsn from the persistent store.
Definition: log0chkp.cc:981
lsn_t m_available_for_checkpoint_lsn
A new checkpoint could be written for this lsn value.
Definition: log0chkp.h:355
THD * m_checkpointer_thd
THD used by the log_checkpointer thread.
Definition: log0chkp.h:376
ib_mutex_t limits_mutex
Mutex which protects fields: m_available_for_checkpoint_lsn, m_requested_checkpoint_lsn.
Definition: log0chkp.h:395
atomic_lsn_t m_checkpoint_lsn
Latest checkpoint lsn.
Definition: log0chkp.h:330
lsn_t determine_checkpoint_lsn()
Figures out m_available_for_checkpoint_lsn.
Definition: log0chkp.cc:272
void request_sharp_checkpoint()
Make a checkpoint at the current lsn.
Definition: log0chkp.cc:589
os_event_t m_event
Event used by the log checkpointer thread to wait for requests.
Definition: log0chkp.h:380
bool save_checkpoint_value(lsn_t checkpoint_lsn)
Save the checkpoint lsn to the persistent store.
Definition: log0chkp.cc:960
void stop_thread_no_wait()
Informs the log checkpointer that it should stop, but does not wait for it to happen.
Definition: log0chkp.cc:938
Handle which allows to do reads / writes for the opened file.
Definition: log0types.h:309
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
virtual Lsn peek_first_unassigned_lsn()=0
Intuitively returns the largest end_lsn assigned from an write_mtr(..,&end_lsn) call.
dberr_t
Definition: db0err.h:39
ut::unique_ptr< ib::fil::Pages_persistence_interface > pages_persistence
The implementation of persistence for the pages stored in tablespaces' nodes' storage.
Definition: fil0fil.cc:1389
#define T
Definition: jit_executor_value.cc:373
#define log_limits_mutex_own()
Definition: log0chkp.h:94
Log_checkpointing * log_checkpointing
Redo log checkpointing.
Definition: log0chkp.cc:113
#define log_limits_mutex_exit()
Definition: log0chkp.h:92
#define log_limits_mutex_enter()
Definition: log0chkp.h:90
void log_update_exported_lsns()
Updates:
Definition: log0chkp.cc:1026
dberr_t log_files_write_first_data_block_low(log_t &log, Log_file_handle &file_handle, lsn_t checkpoint_lsn, lsn_t file_start_lsn)
Writes the first data block to the log file using the provided handle to the opened log file.
Definition: log0chkp.cc:496
lsn_t log_get_checkpoint_age()
Calculates age of current checkpoint as number of bytes since last checkpoint.
Definition: log0chkp.h:410
bool log_checkpointer_is_active()
Checks if log checkpointer thread is active.
Definition: log0chkp.h:68
dberr_t log_files_next_checkpoint(log_t &log, lsn_t lsn)
Writes the next checkpoint to the log file, by writing a single checkpoint header with the checkpoint...
Definition: log0chkp.cc:284
dberr_t log_files_write_checkpoint_low(log_t &log, Log_file_handle &checkpoint_file_handle, Log_checkpoint_header_no checkpoint_header_no, lsn_t next_checkpoint_lsn)
Writes checkpoint to the file containing the written checkpoint_lsn.
Definition: log0chkp.cc:399
Log_checkpoint_header_no log_next_checkpoint_header(Log_checkpoint_header_no checkpoint_header_no)
Provides opposite checkpoint header number to the given checkpoint header number.
Definition: log0chkp.cc:387
Redo log - the main header.
Redo log - the log_sys.
Redo log basic types.
Log_checkpoint_header_no
Enumerates checkpoint headers in the redo log file.
Definition: log0types.h:95
std::chrono::time_point< Log_clock > Log_clock_point
Time point defined by the Log_clock.
Definition: log0types.h:135
std::atomic< lsn_t > atomic_lsn_t
Alias for atomic based on lsn_t.
Definition: log0types.h:82
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
Handler_interface * handler
Definition: log0log.cc:434
constexpr size_t INNODB_CACHE_LINE_SIZE
CPU cache line size.
Definition: ut0cpu_cache.h:41
T * aligned_new_withkey(PSI_memory_key_t key, std::size_t alignment, Args &&...args)
Dynamically allocates storage for an object of type T at address aligned to the requested alignment.
Definition: ut0new.h:1436
void aligned_delete(T *ptr) noexcept
Releases storage which has been dynamically allocated through any of the aligned_new_*() variants.
Definition: ut0new.h:1492
required string key
Definition: replication_asynchronous_connection_failover.proto:60
The server main program.
bool srv_thread_is_active(const IB_thread &thread)
Check if given thread is still active.
Definition: srv0srv.cc:3246
Srv_threads srv_threads
Structure with state of srv background threads.
Definition: srv0srv.cc:112
IB_thread m_log_checkpointer
Redo checkpointer thread.
Definition: srv0srv.h:176
Redo log - single data structure with state of the redo log system.
Definition: log0sys.h:77
InnoDB condition variable.
Definition: os0event.cc:63
Light-weight and type-safe wrapper around the PSI_memory_key that eliminates the possibility of intro...
Definition: ut0new.h:178
Debug checks for latches, header file.
Global types for sync.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
static uint64_t lsn
Definition: xcom_base.cc:446