469 return ~LOG_BLOCK_FLUSH_BIT_MASK &
617 field = field & ~LOG_BLOCK_ENCRYPT_BIT_MASK;
Handle which allows to do reads / writes for the opened file.
Definition: log0types.h:309
dberr_t
Definition: db0err.h:39
constexpr uint32_t LOG_BLOCK_FLUSH_BIT_MASK
Mask used to get the highest bit in the hdr_no field.
Definition: log0constants.h:257
constexpr uint32_t LOG_BLOCK_HDR_DATA_LEN
Offset to number of bytes written to this block (also header bytes).
Definition: log0constants.h:263
constexpr uint32_t LOG_BLOCK_FIRST_REC_GROUP
Offset to "first_rec_group offset" stored in the log block header.
Definition: log0constants.h:280
constexpr uint32_t LOG_BLOCK_HDR_NO
Offset to hdr_no, which is a log block number and must be > 0.
Definition: log0constants.h:253
constexpr uint32_t LOG_BLOCK_EPOCH_NO
Offset to epoch_no stored in this log block.
Definition: log0constants.h:294
constexpr uint32_t LOG_NO_CHECKSUM_MAGIC
Magic value to use instead of log checksums when they are disabled.
Definition: log0constants.h:150
constexpr uint32_t LOG_BLOCK_ENCRYPT_BIT_MASK
Mask used to get the highest bit in the data len field, this bit is to indicate if this block is encr...
Definition: log0constants.h:267
constexpr uint32_t LOG_BLOCK_TRL_SIZE
Size of the log block footer (trailer) in bytes.
Definition: log0constants.h:306
constexpr uint32_t LOG_BLOCK_MAX_NO
Maximum allowed block's number (stored in hdr_no) increased by 1.
Definition: log0constants.h:260
constexpr uint32_t LOG_BLOCK_CHECKSUM
4 byte checksum of the log block contents.
Definition: log0constants.h:303
dberr_t log_data_blocks_write(Log_file_handle &file_handle, os_offset_t write_offset, size_t write_size, const byte *buf)
Writes the formatted log blocks with redo records to the log file.
Definition: log0files_io.cc:669
void log_block_set_epoch_no(byte *log_block, uint32_t no)
Sets a log block epoch_no.
Definition: log0files_io.h:526
void log_block_set_data_len(byte *log_block, uint32_t len)
Sets the log block data length.
Definition: log0files_io.h:495
std::pair< dberr_t, ut::vector< Log_file_id > > log_remove_files(const Log_files_context &ctx)
Removes existing log files.
Definition: log0files_io.cc:974
dberr_t log_data_blocks_read(Log_file_handle &file_handle, os_offset_t read_offset, size_t read_size, byte *buf)
Reads log blocks with redo records from the log file, starting at the given offset.
Definition: log0files_io.cc:676
uint32_t log_block_calc_checksum(const byte *log_block)
Calculates the checksum for a log block.
Definition: log0files_io.h:553
void log_block_set_encrypt_bit(byte *log_block, bool val)
Sets value of a log block encrypt bit (true or false).
Definition: log0files_io.h:609
uint32_t log_block_get_hdr_no(const byte *log_block)
Gets a log block number stored in the header.
Definition: log0files_io.h:468
bool log_data_block_header_deserialize(const byte *buf, Log_data_block_header &header)
Deserializes the log data block header stored in the buffer.
Definition: log0files_io.h:640
std::pair< dberr_t, ut::vector< Log_file_id > > log_remove_unused_files(const Log_files_context &ctx)
Removes all temporary log files in the directory.
Definition: log0files_io.cc:917
bool log_block_get_encrypt_bit(const byte *log_block)
Gets value of a log block encrypt bit (true or false).
Definition: log0files_io.h:597
std::string log_directory_path(const Log_files_context &ctx)
Provides path to directory with redo log files.
Definition: log0files_io.cc:693
uint32_t log_block_get_data_len(const byte *log_block)
Gets a log block data length.
Definition: log0files_io.h:488
dberr_t log_checkpoint_header_read(Log_file_handle &file_handle, Log_checkpoint_header_no checkpoint_header_no, byte *buf)
Reads the serialized log checkpoint header to the buffer.
Definition: log0files_io.cc:622
dberr_t log_remove_file(const Log_files_context &ctx, Log_file_id file_id)
Removes a log file, if it existed.
Definition: log0files_io.cc:954
dberr_t log_create_unused_file(const Log_files_context &ctx, Log_file_id file_id, os_offset_t size_in_bytes)
Creates a new temporary log file and resizes the file to the given size.
Definition: log0files_io.cc:996
void log_block_set_checksum(byte *log_block, uint32_t checksum)
Sets value of a log block checksum field.
Definition: log0files_io.h:581
uint32_t log_block_get_checksum(const byte *log_block)
Gets value of a log block checksum field.
Definition: log0files_io.h:573
Log_checksum_algorithm_atomic_ptr log_checksum_algorithm_ptr
Atomic pointer to the log checksum calculation function.
Definition: log0files_io.cc:79
dberr_t log_encryption_header_write(Log_file_handle &file_handle, const byte *buf)
Writes the serialized encryption meta data to the log file.
Definition: log0files_io.cc:557
void log_file_header_reset_flag(Log_flags &log_flags, uint32_t bit)
Resets a specific flag in the mask built of redo log flags.
Definition: log0files_io.cc:539
void log_block_store_checksum(byte *log_block)
Stores a 4-byte checksum to the trailer checksum field of a log block.
Definition: log0files_io.h:590
void log_file_header_set_flag(Log_flags &log_flags, uint32_t bit)
Sets a specific flag in the mask built of redo log flags.
Definition: log0files_io.cc:535
dberr_t log_rename_unused_file(const Log_files_context &ctx, Log_file_id old_unused_file_id, Log_file_id new_unused_file_id)
Renames the unused file to another unused file.
Definition: log0files_io.cc:866
dberr_t log_file_header_write(Log_file_handle &file_handle, const Log_file_header &header)
Serializes and writes the log file header to the log file.
Definition: log0files_io.cc:497
bool log_checkpoint_header_deserialize(const byte *buf, Log_checkpoint_header &header)
Deserializes the log checkpoint header stored in the buffer.
Definition: log0files_io.cc:585
dberr_t log_mark_file_as_unused(const Log_files_context &ctx, Log_file_id file_id)
Renames a non-temporary log file to the temporary log file.
Definition: log0files_io.cc:883
dberr_t log_collect_existing_files(const Log_files_context &ctx, bool read_only, ut::vector< Log_file_id_and_size > &found)
Searches for all possible log files existing on disk in the log directory.
Definition: log0files_io.cc:1159
uint32_t log_block_calc_checksum_none(const byte *)
Calculates the checksum for a log block using the "no-op" algorithm.
Definition: log0files_io.h:566
dberr_t log_resize_file(const Log_files_context &ctx, Log_file_id file_id, os_offset_t size_in_bytes)
Resizes an existing log file to the given size.
Definition: log0files_io.cc:1099
std::string log_file_path(const Log_files_context &ctx, Log_file_id file_id)
Provides full path to the log file, e.g.
Definition: log0files_io.cc:730
void log_block_set_hdr_no(byte *log_block, uint32_t n)
Sets the log block number stored in the header.
Definition: log0files_io.h:478
dberr_t log_checkpoint_header_write(Log_file_handle &file_handle, Log_checkpoint_header_no checkpoint_header_no, const Log_checkpoint_header &header)
Serializes and writes the log checkpoint header to the log file.
Definition: log0files_io.cc:592
uint32_t log_block_get_first_rec_group(const byte *log_block)
Gets an offset to the beginning of the first group of log records in a given log block.
Definition: log0files_io.h:504
bool log_file_header_check_flag(Log_flags log_flags, uint32_t bit)
Checks if a specific flag is set in the mask built of redo log flags.
Definition: log0files_io.cc:543
dberr_t log_list_existing_files(const Log_files_context &ctx, ut::vector< Log_file_id > &ret)
List existing log files in the directory (does not include unused files).
Definition: log0files_io.cc:834
uint32_t log_block_get_epoch_no(const byte *log_block)
Gets a log block epoch_no.
Definition: log0files_io.h:519
bool log_file_header_deserialize(const byte *buf, Log_file_header &header)
Deserializes the log file header stored in the buffer.
Definition: log0files_io.cc:472
void log_checkpoint_header_serialize(const Log_checkpoint_header &header, byte *buf)
Serializes the log checkpoint header to the buffer.
Definition: log0files_io.cc:576
dberr_t log_file_header_read(Log_file_handle &file_handle, byte *buf)
Reads the serialized log file header to the buffer.
Definition: log0files_io.cc:508
std::string log_file_name(const Log_files_context &ctx, Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0files_io.cc:716
dberr_t log_mark_file_as_in_use(const Log_files_context &ctx, Log_file_id file_id)
Renames a temporary log file to the non-temporary log file.
Definition: log0files_io.cc:876
Log_uuid log_generate_uuid()
Generate unique identifier for the redo log files.
Definition: log0files_io.cc:1188
uint32_t log_block_convert_lsn_to_epoch_no(lsn_t lsn)
Converts a lsn to a log block epoch number.
Definition: log0files_io.h:534
uint32_t log_block_calc_checksum_crc32(const byte *log_block)
Calculates the checksum for a log block using the MySQL 5.7 algorithm.
Definition: log0files_io.h:560
uint32_t log_block_convert_lsn_to_hdr_no(lsn_t lsn)
Converts a lsn to a log block number.
Definition: log0files_io.h:545
std::string log_file_path_for_unused_file(const Log_files_context &ctx, Log_file_id file_id)
Provides full path to the temporary log file, e.g.
Definition: log0files_io.cc:734
void log_block_set_first_rec_group(byte *log_block, uint32_t offset)
Sets an offset to the beginning of the first group of log records in a given log block.
Definition: log0files_io.h:512
dberr_t log_resize_unused_file(const Log_files_context &ctx, Log_file_id file_id, os_offset_t size_in_bytes)
Resizes an existing temporary log file to the given size.
Definition: log0files_io.cc:1092
dberr_t log_remove_unused_file(const Log_files_context &ctx, Log_file_id file_id)
Removes a temporary log file, if it existed.
Definition: log0files_io.cc:911
void log_file_header_serialize(const Log_file_header &header, byte *buf)
Serializes the log file header to the buffer.
Definition: log0files_io.cc:453
dberr_t log_encryption_header_read(Log_file_handle &file_handle, byte *buf)
Reads the serialized encryption meta data from the log file.
Definition: log0files_io.cc:562
dberr_t log_list_existing_unused_files(const Log_files_context &ctx, ut::vector< Log_file_id > &ret)
List existing unused log files in the directory.
Definition: log0files_io.cc:828
bool log_header_checksum_is_ok(const byte *buf)
Computes checksum of the given header and verifies if the checksum is the same as the one stored in t...
Definition: log0files_io.cc:81
void log_data_block_header_serialize(const Log_data_block_header &header, byte *buf)
Serializes the log data block header to the redo log block buffer which already contains redo log dat...
Definition: log0files_io.h:627
size_t Log_file_id
Log file id (0 for ib_redo0)
Definition: log0types.h:66
Log_checkpoint_header_no
Enumerates checkpoint headers in the redo log file.
Definition: log0types.h:95
uint32_t Log_uuid
Number which tries to uniquely identify a created set of redo log files.
Definition: log0types.h:76
std::atomic< uint32_t(*)(const byte *log_block)> Log_checksum_algorithm_atomic_ptr
Function used to calculate checksums of log blocks.
Definition: log0types.h:129
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
uint32_t Log_flags
Log flags (stored in file header of log file).
Definition: log0types.h:69
Utilities for converting data from the database file to the machine format.
static uint16_t mach_read_from_2(const byte *b)
The following function is used to fetch data from 2 consecutive bytes.
static uint32_t mach_read_from_4(const byte *b)
The following function is used to fetch data from 4 consecutive bytes.
static void mach_write_to_2(byte *b, ulint n)
The following function is used to store data in two consecutive bytes.
static void mach_write_to_4(byte *b, ulint n)
The following function is used to store data in 4 consecutive bytes.
Definition: buf0block_hint.cc:30
constexpr value_type read_only
Definition: classic_protocol_constants.h:213
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
constexpr uint32_t OS_FILE_LOG_BLOCK_SIZE
The next value should be smaller or equal to the smallest sector size used on any disk.
Definition: os0file.h:192
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:87
Configures path to the root directory, where redo subdirectory might be located (or redo log files if...
Definition: log0types.h:204
ut_crc32_func_t ut_crc32
Pointer to standard-compliant CRC32-C (using the GF(2) primitive polynomial 0x11EDC6F41) calculation ...
Definition: crc32.cc:101
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
static uint64_t lsn
Definition: xcom_base.cc:446
int n
Definition: xcom_base.cc:509