37#ifndef log0files_dict_h
38#define log0files_dict_h
191 lsn_t end_lsn, F functor) {
193 ut_a(start_lsn <= end_lsn);
194 if (start_lsn == end_lsn) {
198 auto begin = files.
find(start_lsn);
200 ut_a(begin->m_start_lsn <= start_lsn);
202 auto end = files.
find(end_lsn - 1);
204 ut_a(end_lsn <= end->m_end_lsn);
207 ut_a(
end == files.
end() || end_lsn <= end->m_start_lsn);
218 lsn_t &lsn_capacity);
Definition: log0files_dict.h:63
bool operator==(const Const_iterator &rhs) const
Definition: log0files_dict.cc:223
Const_iterator & operator++()
Definition: log0files_dict.cc:201
std::ptrdiff_t difference_type
Definition: log0files_dict.h:67
const Log_file * operator->() const
Definition: log0files_dict.cc:197
Log_files_dict::Log_files_map_iterator m_it
Definition: log0files_dict.h:82
Const_iterator & operator--()
Definition: log0files_dict.cc:212
std::bidirectional_iterator_tag iterator_category
Definition: log0files_dict.h:65
Const_iterator(Log_files_dict::Log_files_map_iterator it)
Definition: log0files_dict.cc:189
bool operator!=(const Const_iterator &rhs) const
Definition: log0files_dict.cc:228
const Log_file & operator*() const
Definition: log0files_dict.cc:193
In-memory dictionary of meta data of existing log files.
Definition: log0files_dict.h:57
Const_iterator begin() const
Definition: log0files_dict.cc:233
const Log_files_context & ctx() const
Definition: log0files_dict.cc:67
const Log_file & front() const
Definition: log0files_dict.cc:169
typename Log_files_map::const_iterator Log_files_map_iterator
Definition: log0files_dict.h:60
Log_files_map m_files_by_id
Meta information about each existing redo log file.
Definition: log0files_dict.h:173
void set_size(Log_file_id file_id, os_offset_t new_size)
Changes size of the file.
Definition: log0files_dict.cc:152
Const_iterator file(Log_file_id file_id) const
Provides log file for the given file id.
Definition: log0files_dict.cc:99
void clear()
Clears the whole dictionary.
Definition: log0files_dict.cc:69
ut::map< Log_file_id, Log_file > Log_files_map
Definition: log0files_dict.h:59
Log_files_dict(Log_files_context &files_ctx)
Constructs an empty dictionary.
Definition: log0files_dict.cc:54
void erase(Log_file_id file_id)
Removes the meta data about the given log file (which denotes the file does not exist anymore) from t...
Definition: log0files_dict.cc:71
const Log_file & back() const
Definition: log0files_dict.cc:174
Log_files_dict & operator=(Log_files_dict &&other)
Definition: log0files_dict.cc:61
Const_iterator end() const
Definition: log0files_dict.cc:237
Const_iterator find(lsn_t lsn) const
Searches for an existing log file, that contains the provided lsn.
Definition: log0files_dict.cc:80
void set_full(Log_file_id file_id)
Marks a given log file as full.
Definition: log0files_dict.cc:140
void add(Log_file_id file_id, os_offset_t size_in_bytes, lsn_t start_lsn, bool full, bool consumed, Encryption_metadata &encryption_metadata)
Add meta data for the existing log file.
Definition: log0files_dict.cc:109
bool empty() const
Definition: log0files_dict.cc:167
void set_consumed(Log_file_id file_id)
Marks a given log file as consumed.
Definition: log0files_dict.cc:134
void set_incomplete(Log_file_id file_id)
Marks a given log file as incomplete (undo marking as full).
Definition: log0files_dict.cc:146
const Log_files_context & m_files_ctx
Context within which log files exist.
Definition: log0files_dict.h:170
constexpr lsn_t LOG_START_LSN
The counting of lsn's starts from this value: this must be non-zero.
Definition: log0constants.h:153
bool log_file_compute_logical_capacity(os_offset_t file_size_in_bytes, lsn_t &lsn_capacity)
Computes logical capacity for the given physical size of the redo log file.
Definition: log0files_dict.cc:251
size_t log_files_number_of_existing_files(const Log_files_dict &files)
Counts the total number of existing log files.
Definition: log0files_dict.cc:279
Log_files_dict::Const_iterator log_files_find_largest(const Log_files_dict &files)
Finds the largest existing log file (with the largest m_size_in_bytes).
Definition: log0files_dict.cc:306
os_offset_t log_files_size_of_existing_files(const Log_files_dict &files)
Computes the total size of the existing log files (sum of sizes).
Definition: log0files_dict.cc:288
void log_files_for_each(const Log_files_dict &files, F functor)
Definition: log0files_dict.h:177
bool log_file_compute_end_lsn(lsn_t start_lsn, os_offset_t file_size_in_bytes, lsn_t &end_lsn)
Computes end_lsn for the given: start_lsn and size of the redo log file.
Definition: log0files_dict.cc:261
size_t log_files_number_of_consumed_files(const Log_files_dict &files)
Counts the total number of existing and marked as consumed log files.
Definition: log0files_dict.cc:283
lsn_t log_files_capacity_of_existing_files(const Log_files_dict &files)
Computes the total capacity of the existing log files (sum of capacities).
Definition: log0files_dict.cc:295
size_t Log_file_id
Log file id (0 for ib_redo0)
Definition: log0types.h:66
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
void for_each(const Shards< COUNT > &shards, Function &&f) noexcept
Iterate over the shards.
Definition: ut0counter.h:323
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2893
The interface to the operating system file io.
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:84
Meta information about single log file.
Definition: log0types.h:454
Configures path to the root directory, where redo subdirectory might be located (or redo log files if...
Definition: log0types.h:204
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:57
static uint64_t lsn
Definition: xcom_base.cc:446