MySQL 8.0.40
Source Code Documentation
|
Redo log - single data structure with state of the redo log system. More...
#include <log0sys.h>
Public Attributes | |
Users writing to log buffer | |
os_event_t | sn_lock_event |
Event used for locking sn. More... | |
rw_lock_t * | sn_lock_inst |
The rw_lock instance only for the debug info list. More... | |
atomic_sn_t | sn |
Current sn value. More... | |
atomic_sn_t | sn_locked |
Intended sn value while x-locked. More... | |
ib_mutex_t | sn_x_lock_mutex |
Mutex which can be used for x-lock sn value. More... | |
ut::aligned_array_pointer< byte, LOG_BUFFER_ALIGNMENT > | buf |
Aligned log buffer. More... | |
atomic_sn_t | buf_size_sn |
Size of the log buffer expressed in number of data bytes, that is excluding bytes for headers and footers of log blocks. More... | |
size_t | buf_size |
Size of the log buffer expressed in number of total bytes, that is including bytes for headers and footers of log blocks. More... | |
struct PSI_rwlock * | pfs_psi |
The instrumentation hook. More... | |
Link_buf< lsn_t > | recent_written |
The recent written buffer. More... | |
std::atomic_bool | writer_threads_paused |
Used for pausing the log writer threads. More... | |
lsn_t | current_ready_waiting_lsn |
Some threads waiting for the ready for write lsn by closer_event. More... | |
int64_t | current_ready_waiting_sig_count |
current_ready_waiting_lsn is waited using this sig_count. More... | |
Link_buf< lsn_t > | recent_closed |
The recent closed buffer. More... | |
Users <=> writer | |
atomic_sn_t | buf_limit_sn |
Maximum sn up to which there is free space in both the log buffer and the log files. More... | |
atomic_lsn_t | write_lsn |
Up to this lsn, data has been written to disk (fsync not required). More... | |
os_event_t * | write_events |
Unaligned pointer to array with events, which are used for notifications sent from the log write notifier thread to user threads. More... | |
size_t | write_events_size |
Number of entries in the array with writer_events. More... | |
std::atomic< uint64_t > | write_to_file_requests_total |
Approx. More... | |
std::atomic< std::chrono::microseconds > | write_to_file_requests_interval |
How often redo write/flush is requested in average. More... | |
Users <=> flusher | |
os_event_t * | flush_events |
Unaligned pointer to array with events, which are used for notifications sent from the log flush notifier thread to user threads. More... | |
size_t | flush_events_size |
Number of entries in the array with events. More... | |
os_event_t | old_flush_event |
This event is in the reset state when a flush is running; a thread should wait for this without owning any of redo mutexes, but NOTE that to reset this event, the thread MUST own the writer_mutex. More... | |
atomic_lsn_t | flushed_to_disk_lsn |
Up to this lsn data has been flushed to disk (fsynced). More... | |
Log flusher thread | |
Log_clock_point | last_flush_start_time |
Last flush start time. More... | |
Log_clock_point | last_flush_end_time |
Last flush end time. More... | |
double | flush_avg_time |
Flushing average time (in microseconds). More... | |
ib_mutex_t | flusher_mutex |
Mutex which can be used to pause log flusher thread. More... | |
os_event_t | flusher_event |
Log writer thread | |
uint32_t | write_ahead_buf_size |
Size of buffer used for the write-ahead (in bytes). More... | |
ut::aligned_array_pointer< byte, LOG_WRITE_AHEAD_BUFFER_ALIGNMENT > | write_ahead_buf |
Aligned buffer used for some of redo log writes. More... | |
os_offset_t | write_ahead_end_offset |
Up to this file offset in the log files, the write-ahead has been done or is not required (for any other reason). More... | |
Log_file | m_current_file {m_files_ctx, m_encryption_metadata} |
File within which write_lsn is located, so the newest file in m_files in the same time - updates are protected by the m_files_mutex. More... | |
Log_file_handle | m_current_file_handle {m_encryption_metadata} |
Handle for the opened m_current_file. More... | |
bool | m_writer_inside_extra_margin |
True iff the log writer has entered extra writer margin and still hasn't exited since then. More... | |
uint64_t | n_log_ios |
Number of performed IO operations (only for printing stats). More... | |
ib_mutex_t | writer_mutex |
Mutex which can be used to pause log writer thread. More... | |
THD * | m_writer_thd |
THD used by the log_writer thread. More... | |
os_event_t | writer_event |
lsn_t | m_oldest_need_lsn_lowerbound |
A recently seen value of log_consumer_get_oldest()->get_consumed_lsn(). More... | |
Log closer thread | |
os_event_t | closer_event |
Event used by the log closer thread to wait for tasks. More... | |
ib_mutex_t | closer_mutex |
Mutex which can be used to pause log closer thread. More... | |
Log flusher <=> flush_notifier | |
os_event_t | flush_notifier_event |
Event used by the log flusher thread to notify the log flush notifier thread, that it should proceed with notifying user threads waiting for the advanced flushed_to_disk_lsn (because it has been advanced). More... | |
int64_t | current_flush_sig_count |
The next flushed_to_disk_lsn can be waited using this sig_count. More... | |
ib_mutex_t | flush_notifier_mutex |
Mutex which can be used to pause log flush notifier thread. More... | |
Log writer <=> write_notifier | |
ib_mutex_t | write_notifier_mutex |
Mutex which can be used to pause log write notifier thread. More... | |
os_event_t | write_notifier_event |
Event used by the log writer thread to notify the log write notifier thread, that it should proceed with notifying user threads waiting for the advanced write_lsn (because it has been advanced). More... | |
Log files management | |
ib_mutex_t | m_files_mutex |
Mutex protecting set of existing log files and their meta data. More... | |
Log_files_context | m_files_ctx |
Context for all operations on redo log files from log0files_io.h. More... | |
Log_files_dict | m_files {m_files_ctx} |
The in-memory dictionary of log files. More... | |
size_t | m_unused_files_count |
Number of existing unused files (those with _tmp suffix). More... | |
os_offset_t | m_unused_file_size |
Size of each unused redo log file, to which recently all unused redo log files became resized. More... | |
Log_files_capacity | m_capacity |
Capacity limits for the redo log. More... | |
bool | m_requested_files_consumption |
True iff log_writer is waiting for a next log file available. More... | |
Log_files_stats | m_files_stats |
Statistics related to redo log files consumption and creation. More... | |
os_event_t | m_files_governor_event |
Event used by log files governor thread to wait. More... | |
os_event_t | m_files_governor_iteration_event |
Event used by other threads to wait until log files governor finished its next iteration. More... | |
std::atomic_bool | m_no_more_dummy_records_requested |
False if log files governor thread is allowed to add new redo records. More... | |
std::atomic_bool | m_no_more_dummy_records_promised |
False if the log files governor thread is allowed to add new dummy redo records. More... | |
THD * | m_files_governor_thd |
THD used by the log_files_governor thread. More... | |
os_event_t | m_file_removed_event |
Event used for waiting on next file available. More... | |
byte | m_encryption_buf [OS_FILE_LOG_BLOCK_SIZE] |
Buffer that contains encryption meta data encrypted with master key. More... | |
Encryption_metadata | m_encryption_metadata |
Encryption metadata. More... | |
Consumers | |
ut::unordered_set< Log_consumer * > | m_consumers |
Set of registered redo log consumers. More... | |
Maintenance | |
std::atomic_bool | should_stop_threads |
Used for stopping the log background threads. More... | |
os_event_t | writer_threads_resume_event |
Event used for pausing the log writer threads. More... | |
atomic_lsn_t | write_notifier_resume_lsn |
Used for resuming write notifier thread. More... | |
atomic_lsn_t | flush_notifier_resume_lsn |
Used for resuming flush notifier thread. More... | |
uint64_t | n_log_ios_old |
Number of total I/O operations performed when we printed the statistics last time. More... | |
time_t | last_printout_time |
Wall time when we printed the statistics last time. More... | |
Recovery | |
lsn_t | recovered_lsn |
Lsn from which recovery has been started. More... | |
Log_format | m_format |
Format of the redo log: e.g., Log_format::CURRENT. More... | |
std::string | m_creator_name |
Log creator name. More... | |
Log_flags | m_log_flags |
Log flags. More... | |
Log_uuid | m_log_uuid |
Log UUID. More... | |
lsn_t | m_scanned_lsn |
Used only in recovery: recovery scan succeeded up to this lsn. More... | |
bool | disable_redo_writes |
When this is set, writing to the redo log should be disabled. More... | |
Fields protected by the log_limits_mutex. | |
Related to free space in the redo log. | |
ib_mutex_t | limits_mutex |
Mutex which protects fields: available_for_checkpoint_lsn, requested_checkpoint_lsn. More... | |
lsn_t | available_for_checkpoint_lsn |
A new checkpoint could be written for this lsn value. More... | |
lsn_t | requested_checkpoint_lsn |
When this is larger than the latest checkpoint, the log checkpointer thread will be forced to write a new checkpoint (unless the new latest checkpoint lsn would still be smaller than this value). More... | |
lsn_t | dict_max_allowed_checkpoint_lsn |
Maximum lsn allowed for checkpoint by dict_persist or zero. More... | |
bool | periodical_checkpoints_enabled |
If should perform checkpoints every innodb_log_checkpoint_every ms. More... | |
std::atomic_bool | m_allow_checkpoints |
If checkpoints are allowed. More... | |
atomic_lsn_t | free_check_limit_lsn |
Maximum lsn up to which there is free space in the redo log. More... | |
atomic_sn_t | concurrency_margin |
Margin used in calculation of. More... | |
std::atomic< bool > | concurrency_margin_is_safe |
True iff current concurrency_margin isn't truncated because of too small redo log capacity. More... | |
atomic_sn_t | dict_persist_margin |
Margin used in calculation of. More... | |
Log checkpointer thread | |
os_event_t | checkpointer_event |
Event used by the log checkpointer thread to wait for requests. More... | |
ib_mutex_t | checkpointer_mutex |
Mutex which can be used to pause log checkpointer thread. More... | |
atomic_lsn_t | last_checkpoint_lsn |
Latest checkpoint lsn. More... | |
Log_checkpoint_header_no | next_checkpoint_header_no |
Next checkpoint header to use. More... | |
os_event_t | next_checkpoint_event |
Event signaled when last_checkpoint_lsn is advanced by the log_checkpointer thread. More... | |
Log_clock_point | last_checkpoint_time |
Latest checkpoint wall time. More... | |
Log_checkpoint_consumer | m_checkpoint_consumer {*this} |
Redo log consumer which is always registered and which is responsible for protecting redo log records at lsn >= last_checkpoint_lsn. More... | |
THD * | m_checkpointer_thd |
THD used by the log_checkpointer thread. More... | |
Redo log - single data structure with state of the redo log system.
In future, one could consider splitting this to multiple data structures.
lsn_t log_t::available_for_checkpoint_lsn |
A new checkpoint could be written for this lsn value.
Up to this lsn value, all dirty pages have been added to flush lists and flushed. Updated in the log checkpointer thread by taking minimum oldest_modification out of the last dirty pages from each flush list. However it will not be bigger than the current value of log.buf_dirty_pages_added_up_to_lsn. Read by: user threads when requesting fuzzy checkpoint Read by: log_print() (printing status of redo) Updated by: log_checkpointer Protected by: limits_mutex.
ut::aligned_array_pointer<byte, LOG_BUFFER_ALIGNMENT> log_t::buf |
Aligned log buffer.
Committing mini-transactions write there redo records, and the log_writer thread writes the log buffer to disk in background. Protected by: locking sn not to add.
atomic_sn_t log_t::buf_limit_sn |
Maximum sn up to which there is free space in both the log buffer and the log files.
This is limitation for the end of any write to the log buffer. Threads, which are limited need to wait, and possibly they hold latches of dirty pages making a deadlock possible. Protected by: writer_mutex (writes).
size_t log_t::buf_size |
Size of the log buffer expressed in number of total bytes, that is including bytes for headers and footers of log blocks.
atomic_sn_t log_t::buf_size_sn |
Size of the log buffer expressed in number of data bytes, that is excluding bytes for headers and footers of log blocks.
os_event_t log_t::checkpointer_event |
Event used by the log checkpointer thread to wait for requests.
|
mutable |
Mutex which can be used to pause log checkpointer thread.
This is used by log_position_lock() together with log_buffer_x_lock(), to pause any changes to current_lsn or last_checkpoint_lsn.
os_event_t log_t::closer_event |
Event used by the log closer thread to wait for tasks.
|
mutable |
Mutex which can be used to pause log closer thread.
atomic_sn_t log_t::concurrency_margin |
Margin used in calculation of.
std::atomic<bool> log_t::concurrency_margin_is_safe |
True iff current concurrency_margin isn't truncated because of too small redo log capacity.
Protected by (updates only): limits_mutex.
int64_t log_t::current_flush_sig_count |
The next flushed_to_disk_lsn can be waited using this sig_count.
lsn_t log_t::current_ready_waiting_lsn |
Some threads waiting for the ready for write lsn by closer_event.
int64_t log_t::current_ready_waiting_sig_count |
current_ready_waiting_lsn is waited using this sig_count.
lsn_t log_t::dict_max_allowed_checkpoint_lsn |
Maximum lsn allowed for checkpoint by dict_persist or zero.
This will be set by dict_persist_to_dd_table_buffer(), which should be always called before really making a checkpoint. If non-zero, up to this lsn value, dynamic metadata changes have been written back to mysql.innodb_dynamic_metadata under dict_persist->mutex protection. All dynamic metadata changes after this lsn have to be kept in redo logs, but not discarded. If zero, just ignore it. Updated by: DD (when persisting dynamic meta data) Updated by: log_checkpointer (reset when checkpoint is written) Protected by: limits_mutex.
atomic_sn_t log_t::dict_persist_margin |
Margin used in calculation of.
bool log_t::disable_redo_writes |
When this is set, writing to the redo log should be disabled.
We check for this in functions that write to the redo log.
double log_t::flush_avg_time |
Flushing average time (in microseconds).
os_event_t* log_t::flush_events |
Unaligned pointer to array with events, which are used for notifications sent from the log flush notifier thread to user threads.
The notifications are sent when flushed_to_disk_lsn is advanced. User threads wait for flushed_to_disk_lsn >= lsn, for some lsn. Log flusher advances the flushed_to_disk_lsn and notifies the log flush notifier, which notifies all users interested in nearby lsn values (lsn belonging to the same log block). Note that false wake-ups are possible, in which case user threads simply retry waiting.
size_t log_t::flush_events_size |
Number of entries in the array with events.
os_event_t log_t::flush_notifier_event |
Event used by the log flusher thread to notify the log flush notifier thread, that it should proceed with notifying user threads waiting for the advanced flushed_to_disk_lsn (because it has been advanced).
|
mutable |
Mutex which can be used to pause log flush notifier thread.
atomic_lsn_t log_t::flush_notifier_resume_lsn |
Used for resuming flush notifier thread.
atomic_lsn_t log_t::flushed_to_disk_lsn |
Up to this lsn data has been flushed to disk (fsynced).
os_event_t log_t::flusher_event |
|
mutable |
Mutex which can be used to pause log flusher thread.
atomic_lsn_t log_t::free_check_limit_lsn |
Maximum lsn up to which there is free space in the redo log.
Threads check this limit and compare to current lsn, when they are outside mini-transactions and hold no latches. The formula used to compute the limitation takes into account maximum size of mtr and thread concurrency to include proper margins and avoid issues with race condition (in which all threads check the limitation and then all proceed with their mini-transactions). Also extra margin is there for dd table buffer cache (dict_persist_margin). Read by: user threads (log_free_check()) Updated by: log_checkpointer (after update of checkpoint_lsn) Updated by: log_writer (after pausing/resuming user threads) Updated by: DD (after update of dict_persist_margin) Protected by (updates only): limits_mutex.
atomic_lsn_t log_t::last_checkpoint_lsn |
Latest checkpoint lsn.
Read by: user threads, log_print (no protection) Read by: log_writer (under writer_mutex) Updated by: log_checkpointer (under both mutexes) Protected by (updates only): checkpointer_mutex + writer_mutex.
Log_clock_point log_t::last_checkpoint_time |
Latest checkpoint wall time.
Used by (private): log_checkpointer.
Log_clock_point log_t::last_flush_end_time |
Last flush end time.
Updated just after fsync is finished. If smaller than start time, then flush operation is pending.
Log_clock_point log_t::last_flush_start_time |
Last flush start time.
Updated just before fsync starts.
|
mutable |
Wall time when we printed the statistics last time.
|
mutable |
Mutex which protects fields: available_for_checkpoint_lsn, requested_checkpoint_lsn.
It also synchronizes updates of: free_check_limit_lsn, concurrency_margin, dict_persist_margin. It protects reads and writes of m_writer_inside_extra_margin. It also protects the srv_checkpoint_disabled (together with the checkpointer_mutex).
std::atomic_bool log_t::m_allow_checkpoints |
If checkpoints are allowed.
When this is set to false, neither new checkpoints might be written nor lsn available for checkpoint might be updated. This is useful in recovery period, when neither flush lists can be trusted nor DD dynamic metadata redo records might be reclaimed. This is never set from true to false after log_start().
Log_files_capacity log_t::m_capacity |
Capacity limits for the redo log.
Responsible for resize. Mutex protection is decided per each Log_files_capacity method.
Log_checkpoint_consumer log_t::m_checkpoint_consumer {*this} |
Redo log consumer which is always registered and which is responsible for protecting redo log records at lsn >= last_checkpoint_lsn.
THD* log_t::m_checkpointer_thd |
THD used by the log_checkpointer thread.
ut::unordered_set<Log_consumer *> log_t::m_consumers |
Set of registered redo log consumers.
Note, that this object is not responsible for freeing them (does not claim to be owner). If you wanted to register or unregister a redo log consumer, then please use following functions:
std::string log_t::m_creator_name |
Log creator name.
Log_file log_t::m_current_file {m_files_ctx, m_encryption_metadata} |
File within which write_lsn is located, so the newest file in m_files in the same time - updates are protected by the m_files_mutex.
This field exists, because the log_writer thread needs to locate offsets each time it writes data blocks to disk, but we do not want to acquire and release the m_files_mutex for each such write, because that would slow down the log_writer thread a lot. Instead of that, the log_writer uses this object to locate the offsets.
Updates of this field require two mutexes: writer_mutex and m_files_mutex. Its m_id is updated only when the write_lsn moves to the next log file.
Log_file_handle log_t::m_current_file_handle {m_encryption_metadata} |
Handle for the opened m_current_file.
The log_writer uses this handle to do writes (protected by writer_mutex). The log_flusher uses this handle to do fsyncs (protected by flusher_mutex). Both these threads might use this handle in parallel. The required synchronization between writes and fsyncs will happen on the OS side. When m_current_file is repointed to other file, this field is also updated, in the same critical section. Updates of this field are protected by: writer_mutex, m_files_mutex and flusher_mutex acquired all together. The reason for flusher_mutex is to avoid a need to acquire / release m_files_mutex in the log_flusher thread for each fsync. Instead of that, the log_flusher thread keeps the log_flusher_mutex, which is released less often, but still prevents from updates of this field.
byte log_t::m_encryption_buf[OS_FILE_LOG_BLOCK_SIZE] |
Buffer that contains encryption meta data encrypted with master key.
Protected by: m_files_mutex
Encryption_metadata log_t::m_encryption_metadata |
Encryption metadata.
This member is passed to Log_file_handle objects created for redo log files. In particular, the m_current_file_handle has a reference to this field. When encryption metadata is updated, it needs to be written to the redo log file's header. Also, each write performed by the log_writer thread needs to use m_encryption_metadata (it's passed by reference to the m_current_file_handle) and the log_writer does not acquire m_files_mutex for its writes (it is a hot path and it's better to keep it shorter). Therefore it's been decided that updates of this field require both m_files_mutex and writer_mutex. Protected by: m_files_mutex, writer_mutex
os_event_t log_t::m_file_removed_event |
Event used for waiting on next file available.
Used by log writer thread to wait when it needs to produce a next log file but there are no free (consumed) log files available.
Log_files_dict log_t::m_files {m_files_ctx} |
The in-memory dictionary of log files.
Protected by: m_files_mutex.
Log_files_context log_t::m_files_ctx |
Context for all operations on redo log files from log0files_io.h.
os_event_t log_t::m_files_governor_event |
Event used by log files governor thread to wait.
os_event_t log_t::m_files_governor_iteration_event |
Event used by other threads to wait until log files governor finished its next iteration.
This is useful when some sys_var gets changed to wait until log files governor re-computed everything and then check if the concurrency_margin is safe to emit warning if needed (the warning would still belong to the sys_var's SET GLOBAL statement then).
THD* log_t::m_files_governor_thd |
THD used by the log_files_governor thread.
|
mutable |
Mutex protecting set of existing log files and their meta data.
Log_files_stats log_t::m_files_stats |
Statistics related to redo log files consumption and creation.
Protected by: m_files_mutex.
Log_format log_t::m_format |
Format of the redo log: e.g., Log_format::CURRENT.
Log_flags log_t::m_log_flags |
Log flags.
Log_uuid log_t::m_log_uuid |
Log UUID.
std::atomic_bool log_t::m_no_more_dummy_records_promised |
False if the log files governor thread is allowed to add new dummy redo records.
This is set to true only by the log_files_governor thread, and after it observed
std::atomic_bool log_t::m_no_more_dummy_records_requested |
False if log files governor thread is allowed to add new redo records.
This is set as intention, to tell the log files governor about what it is allowed to do. To ensure that the log_files_governor is aware of what has been told, user needs to wait on
lsn_t log_t::m_oldest_need_lsn_lowerbound |
A recently seen value of log_consumer_get_oldest()->get_consumed_lsn().
It serves as a lower bound for future values of this expression, because it is guaranteed to be monotonic in time: each individual consumer can only go forward, and new consumers must start at least from checkpoint lsn, and the checkpointer is always one of the consumers. Protected by: writer_mutex.
bool log_t::m_requested_files_consumption |
True iff log_writer is waiting for a next log file available.
Protected by: m_files_mutex.
lsn_t log_t::m_scanned_lsn |
Used only in recovery: recovery scan succeeded up to this lsn.
os_offset_t log_t::m_unused_file_size |
Size of each unused redo log file, to which recently all unused redo log files became resized.
Expressed in bytes.
size_t log_t::m_unused_files_count |
Number of existing unused files (those with _tmp suffix).
Protected by: m_files_mutex.
bool log_t::m_writer_inside_extra_margin |
True iff the log writer has entered extra writer margin and still hasn't exited since then.
Each time the log_writer enters that margin, it pauses all user threads at log_free_check() calls and emits warning to the log. When the writer exits the extra margin, notice is emitted. Protected by: log_limits_mutex and writer_mutex.
THD* log_t::m_writer_thd |
THD used by the log_writer thread.
uint64_t log_t::n_log_ios |
Number of performed IO operations (only for printing stats).
|
mutable |
Number of total I/O operations performed when we printed the statistics last time.
os_event_t log_t::next_checkpoint_event |
Event signaled when last_checkpoint_lsn is advanced by the log_checkpointer thread.
Log_checkpoint_header_no log_t::next_checkpoint_header_no |
Next checkpoint header to use.
Updated by: log_checkpointer Protected by: checkpointer_mutex
os_event_t log_t::old_flush_event |
This event is in the reset state when a flush is running; a thread should wait for this without owning any of redo mutexes, but NOTE that to reset this event, the thread MUST own the writer_mutex.
bool log_t::periodical_checkpoints_enabled |
If should perform checkpoints every innodb_log_checkpoint_every ms.
Disabled during startup / shutdown. Enabled in srv_start_threads. Updated by: starting thread (srv_start_threads) Read by: log_checkpointer
struct PSI_rwlock* log_t::pfs_psi |
The instrumentation hook.
lfence
to limit MACHINE_CLEARS. The recent written buffer.
Protected by: locking sn not to add.
lsn_t log_t::recovered_lsn |
Lsn from which recovery has been started.
lsn_t log_t::requested_checkpoint_lsn |
When this is larger than the latest checkpoint, the log checkpointer thread will be forced to write a new checkpoint (unless the new latest checkpoint lsn would still be smaller than this value).
Read by: log_checkpointer Updated by: user threads (log_free_check() or for sharp checkpoint) Protected by: limits_mutex.
std::atomic_bool log_t::should_stop_threads |
Used for stopping the log background threads.
atomic_sn_t log_t::sn |
Current sn value.
Used to reserve space in the redo log, and used to acquire an exclusive access to the log buffer. Represents number of data bytes that have ever been reserved. Bytes of headers and footers of log blocks are not included. Its highest bit is used for locking the access to the log buffer.
os_event_t log_t::sn_lock_event |
Event used for locking sn.
rw_lock_t* log_t::sn_lock_inst |
The rw_lock instance only for the debug info list.
atomic_sn_t log_t::sn_locked |
Intended sn value while x-locked.
|
mutable |
Mutex which can be used for x-lock sn value.
ut::aligned_array_pointer<byte, LOG_WRITE_AHEAD_BUFFER_ALIGNMENT> log_t::write_ahead_buf |
Aligned buffer used for some of redo log writes.
Data is copied there from the log buffer and written to disk, in following cases:
uint32_t log_t::write_ahead_buf_size |
Size of buffer used for the write-ahead (in bytes).
os_offset_t log_t::write_ahead_end_offset |
Up to this file offset in the log files, the write-ahead has been done or is not required (for any other reason).
os_event_t* log_t::write_events |
Unaligned pointer to array with events, which are used for notifications sent from the log write notifier thread to user threads.
The notifications are sent when write_lsn is advanced. User threads wait for write_lsn >= lsn, for some lsn. Log writer advances the write_lsn and notifies the log write notifier, which notifies all users interested in nearby lsn values (lsn belonging to the same log block). Note that false wake-ups are possible, in which case user threads simply retry waiting.
size_t log_t::write_events_size |
Number of entries in the array with writer_events.
atomic_lsn_t log_t::write_lsn |
Up to this lsn, data has been written to disk (fsync not required).
Protected by: writer_mutex (writes).
os_event_t log_t::write_notifier_event |
Event used by the log writer thread to notify the log write notifier thread, that it should proceed with notifying user threads waiting for the advanced write_lsn (because it has been advanced).
|
mutable |
Mutex which can be used to pause log write notifier thread.
atomic_lsn_t log_t::write_notifier_resume_lsn |
Used for resuming write notifier thread.
std::atomic<std::chrono::microseconds> log_t::write_to_file_requests_interval |
How often redo write/flush is requested in average.
Measures in microseconds. Log threads do not spin when the write/flush requests are not frequent.
std::atomic<uint64_t> log_t::write_to_file_requests_total |
Approx.
number of requests to write/flush redo since startup.
os_event_t log_t::writer_event |
|
mutable |
Mutex which can be used to pause log writer thread.
std::atomic_bool log_t::writer_threads_paused |
Used for pausing the log writer threads.
When paused, each user thread should write log as in the former version.
os_event_t log_t::writer_threads_resume_event |
Event used for pausing the log writer threads.