76#define log_checkpointer_mutex_enter() \
77 mutex_enter(&(log_checkpointing->checkpoint_mutex))
79#define log_checkpointer_mutex_exit() \
80 mutex_exit(&(log_checkpointing->checkpoint_mutex))
82#define log_checkpointer_mutex_own() \
83 (mutex_own(&(log_checkpointing->checkpoint_mutex)) || \
84 !log_checkpointer_is_active())
90#define log_limits_mutex_enter() mutex_enter(&(log_checkpointing->limits_mutex))
92#define log_limits_mutex_exit() mutex_exit(&(log_checkpointing->limits_mutex))
94#define log_limits_mutex_own() mutex_own(&(log_checkpointing->limits_mutex))
169 template <
typename T>
172 template <
typename T,
typename... Args>
174 std::size_t alignment, Args &&...args);
415 if (current_lsn <= last_checkpoint_lsn) {
426 return current_lsn - last_checkpoint_lsn;
435[[nodiscard]]
inline bool
475 lsn_t checkpoint_lsn,
476 lsn_t file_start_lsn);
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.
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
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.
#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