MySQL 8.0.39
Source Code Documentation
log0files_io.cc File Reference
#include <fcntl.h>
#include <unistd.h>
#include <algorithm>
#include <cstring>
#include <limits>
#include <sstream>
#include "log0files_io.h"
#include "log0pre_8_0_30.h"
#include "log0types.h"
#include "mach0data.h"
#include "my_dbug.h"
#include "os0file.h"
#include "ut0new.h"
#include "ut0rnd.h"
#include "srv0srv.h"

Classes

struct  Log_file_block
 Used for reads/writes to redo files within this module. More...
 

Functions

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 that header. More...
 
Log - file header read/write.
static void log_file_header_validate (const Log_file_header &header)
 Asserts that the provided file header seems correct. More...
 
static Log_flags log_file_header_flag_bit (uint32_t bit)
 Converts flag number to the mask with this flag turned on. More...
 
void log_file_header_serialize (const Log_file_header &header, byte *buf)
 Serializes the log file header to the buffer. More...
 
bool log_file_header_deserialize (const byte *buf, Log_file_header &header)
 Deserializes the log file header stored in the buffer. More...
 
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. More...
 
dberr_t log_file_header_write (Log_file_handle &file_handle, const byte *buf)
 Writes the serialized log file header to the log file. More...
 
dberr_t log_file_header_read (Log_file_handle &file_handle, byte *buf)
 Reads the serialized log file header to the buffer. More...
 
dberr_t log_file_header_read (Log_file_handle &file_handle, Log_file_header &header)
 Reads and deserializes the log file header. More...
 
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. More...
 
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. More...
 
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. More...
 
Log - checkpoint header read/write.
static os_offset_t log_checkpoint_header_offset (Log_checkpoint_header_no checkpoint_header_no)
 Computes offset from the beginning of the redo file to the checkpoint header for provided checkpoint header number. More...
 
void log_checkpoint_header_serialize (const Log_checkpoint_header &header, byte *buf)
 Serializes the log checkpoint header to the buffer. More...
 
bool log_checkpoint_header_deserialize (const byte *buf, Log_checkpoint_header &header)
 Deserializes the log checkpoint header stored in the buffer. More...
 
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. More...
 
dberr_t log_checkpoint_header_write (Log_file_handle &file_handle, Log_checkpoint_header_no checkpoint_header_no, const byte *buf)
 Writes the serialized checkpoint header to the log file. More...
 
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. More...
 
dberr_t log_checkpoint_header_read (Log_file_handle &file_handle, Log_checkpoint_header_no checkpoint_header_no, Log_checkpoint_header &header)
 Reads and deserializes the log checkpoint header. More...
 
Log data blocks
static void log_data_blocks_validate (os_offset_t offset, os_offset_t size)
 Asserts that the provided <offset, size> defines one or more redo data blocks within a log file. More...
 
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. More...
 
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. More...
 
Log - file creation / deletion
static dberr_t log_rename_file_low (const Log_files_context &context, const std::string &old_file_path, const std::string &new_file_path, int err_msg_id)
 Renames the log file. More...
 
static dberr_t log_remove_file_low (const Log_files_context &context, const std::string &file_path, int err_msg_id)
 Delete the log file at the provided file path. More...
 
static dberr_t log_resize_file_low (const std::string &file_path, os_offset_t size_in_bytes, int err_msg_id)
 Resizes the log file at the provided file path. More...
 
static dberr_t log_check_file (const Log_files_context &ctx, Log_file_id file_id, bool read_only, os_offset_t &size_in_bytes)
 Checks if a log file exists and can be opened with srv_read_only_mode mode. More...
 
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. More...
 
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. More...
 
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. More...
 
dberr_t log_remove_unused_file (const Log_files_context &ctx, Log_file_id file_id)
 Removes a temporary log file, if it existed. More...
 
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. More...
 
dberr_t log_remove_file (const Log_files_context &ctx, Log_file_id file_id)
 Removes a log file, if it existed. More...
 
std::pair< dberr_t, Log_file_idlog_remove_file (const Log_files_context &ctx)
 Removes a single existing log file (if it existed). More...
 
std::pair< dberr_t, ut::vector< Log_file_id > > log_remove_files (const Log_files_context &ctx)
 Removes existing log files. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Log_uuid log_generate_uuid ()
 Generate unique identifier for the redo log files. More...
 
Log - encryption header read/write.
dberr_t log_encryption_header_write (Log_file_handle &file_handle, const byte *buf)
 Writes the serialized encryption meta data to the log file. More...
 
dberr_t log_encryption_header_read (Log_file_handle &file_handle, byte *buf)
 Reads the serialized encryption meta data from the log file. More...
 
Log - file names and paths.
std::string log_directory_path (const Log_files_context &ctx)
 Provides path to directory with redo log files. More...
 
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. More...
 
std::string log_file_path (const Log_files_context &ctx, Log_file_id file_id)
 Provides full path to the log file, e.g. More...
 
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. More...
 
static bool log_extract_id_from_file_name (const Log_files_context &ctx, const char *file_name, const char *expected_suffix, Log_file_id &extracted_id)
 Extracts identifier of the redo log file from its file name. More...
 
static dberr_t log_list_existing_files_low (const Log_files_context &ctx, const char *suffix, ut::vector< Log_file_id > &ret)
 Lists existing redo files in the configured redo log directory, selecting redo log files which have a given suffix in their name. More...
 
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. More...
 
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). More...
 

Variables

Log_checksum_algorithm_atomic_ptr log_checksum_algorithm_ptr
 Atomic pointer to the log checksum calculation function. More...
 

Function Documentation

◆ log_check_file()

static dberr_t log_check_file ( const Log_files_context ctx,
Log_file_id  file_id,
bool  read_only,
os_offset_t size_in_bytes 
)
static

Checks if a log file exists and can be opened with srv_read_only_mode mode.

If that is successful, reads the size of the file and provides it.

Parameters
[in]ctxredo log files context
[in]file_idid of the file to check and open
[in]read_onlytrue: check file permissions only for reading false: check for both reading and writing
[out]size_in_bytessize of the file, in bytes
Returns
DB_SUCCESS, DB_NOT_FOUND or DB_ERROR

◆ log_checkpoint_header_deserialize()

bool log_checkpoint_header_deserialize ( const byte buf,
Log_checkpoint_header header 
)

Deserializes the log checkpoint header stored in the buffer.

Parameters
[in]bufthe buffer to deserialize
[out]headerthe deserialized header
Returns
true iff checksum is correct

◆ log_checkpoint_header_offset()

static os_offset_t log_checkpoint_header_offset ( Log_checkpoint_header_no  checkpoint_header_no)
static

Computes offset from the beginning of the redo file to the checkpoint header for provided checkpoint header number.

Parameters
[in]checkpoint_header_nocheckpoint header for which offset to compute
Returns
offset from the beginning of the redo file

◆ log_checkpoint_header_read() [1/2]

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.

Parameters
[in]file_handlehandle for the opened log file
[in]checkpoint_header_nocheckpoint header to read
[out]bufthe allocated buffer for read
Returns
DB_SUCCESS or error

◆ log_checkpoint_header_read() [2/2]

dberr_t log_checkpoint_header_read ( Log_file_handle file_handle,
Log_checkpoint_header_no  checkpoint_header_no,
Log_checkpoint_header header 
)

Reads and deserializes the log checkpoint header.

Parameters
[in]file_handlehandle for the opened log file
[in]checkpoint_header_nocheckpoint header to read
[out]headerthe checkpoint header read
Returns
DB_SUCCESS or error

◆ log_checkpoint_header_serialize()

void log_checkpoint_header_serialize ( const Log_checkpoint_header header,
byte buf 
)

Serializes the log checkpoint header to the buffer.

Parameters
[in]headerthe header to serialize
[out]bufthe allocated buffer

◆ log_checkpoint_header_write() [1/2]

dberr_t log_checkpoint_header_write ( Log_file_handle file_handle,
Log_checkpoint_header_no  checkpoint_header_no,
const byte buf 
)

Writes the serialized checkpoint header to the log file.

Parameters
[in]file_handlehandle for the opened log file
[in]checkpoint_header_nocheckpoint header to be written
[in]bufbuffer containing the serialized checkpoint header to write
Returns
DB_SUCCESS or error

◆ log_checkpoint_header_write() [2/2]

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.

Parameters
[in]file_handlehandle for the opened log file
[in]checkpoint_header_nocheckpoint header to be written
[in]headerthe checkpoint header
Returns
DB_SUCCESS or error

◆ log_collect_existing_files()

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.

Performs only very minimal validation of the files, checking if files could be opened and have valid file size.

Parameters
[in]ctxcontext within which files exist
[in]read_onlytrue: check file permissions only for reading, false: check for both reading and writing
[out]foundlist of <file_id, size of file> for each file found
Returns
DB_SUCCESS, DB_NOT_FOUND or DB_ERROR

◆ log_create_unused_file()

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.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to create
[in]size_in_bytessize of the file, in bytes
Returns
DB_SUCCESS or DB_ERROR

◆ log_data_blocks_read()

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.

The log blocks must exist within single log file.

Parameters
[in]file_handlehandle for the opened log file
[in]read_offsetoffset from the beginning of the given file
[in]read_sizesize of the data to read (must be divisible by OS_FILE_LOG_BLOCK_SIZE)
[out]bufallocated buffer to fill by the read
Returns
DB_SUCCESS or error

◆ log_data_blocks_validate()

static void log_data_blocks_validate ( os_offset_t  offset,
os_offset_t  size 
)
static

Asserts that the provided <offset, size> defines one or more redo data blocks within a log file.

Parameters
[in]offsetexpected offset to the beginning of data block(s)
[in]sizesize in bytes of data blocks starting from the offset

◆ log_data_blocks_write()

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.

The given log blocks must fit within the same single log file.

Parameters
[in]file_handlehandle for the opened log file
[in]write_offsetoffset from the beginning of the given file
[in]write_sizesize of the data to write (must be divisible by OS_FILE_LOG_BLOCK_SIZE)
[in]bufformatted log blocks with the data to write
Returns
DB_SUCCESS or error

◆ log_directory_path()

std::string log_directory_path ( const Log_files_context ctx)

Provides path to directory with redo log files.

Parameters
[in]ctxcontext within which files exist
Returns
path to innodb_redo directory

◆ log_encryption_header_read()

dberr_t log_encryption_header_read ( Log_file_handle file_handle,
byte buf 
)

Reads the serialized encryption meta data from the log file.

Parameters
[in]file_handlehandle for the opened log file
[out]bufthe allocated buffer for read
Returns
DB_SUCCESS or error

◆ log_encryption_header_write()

dberr_t log_encryption_header_write ( Log_file_handle file_handle,
const byte buf 
)

Writes the serialized encryption meta data to the log file.

Parameters
[in]file_handlehandle for the opened log file
[in]bufthe filled encryption buffer to write
Returns
DB_SUCCESS or error

◆ log_extract_id_from_file_name()

static bool log_extract_id_from_file_name ( const Log_files_context ctx,
const char *  file_name,
const char *  expected_suffix,
Log_file_id extracted_id 
)
static

Extracts identifier of the redo log file from its file name.

Function might be called for non-redo log files in which case it should return false instead of extracting the identifier.

Parameters
[in]ctxredo log files context
[in]file_namefile name (can be wrong)
[in]expected_suffixsuffix that should exist after id
[out]extracted_idextracted redo file identifier
Returns
true iff extracted the identifier properly

◆ log_file_header_check_flag()

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.

Parameters
[in]log_flagsmask of log flags
[in]bitbit number to check (flag)
Returns
true, iff flag is set

◆ log_file_header_deserialize()

bool log_file_header_deserialize ( const byte buf,
Log_file_header header 
)

Deserializes the log file header stored in the buffer.

Parameters
[in]bufthe buffer to deserialize
[out]headerthe deserialized header
Returns
true iff checksum is correct

◆ log_file_header_flag_bit()

static Log_flags log_file_header_flag_bit ( uint32_t  bit)
static

Converts flag number to the mask with this flag turned on.

Parameters
[in]bitflag bit number (but > 0)
Returns
bit mask value (2^(bit-1))

◆ log_file_header_read() [1/2]

dberr_t log_file_header_read ( Log_file_handle file_handle,
byte buf 
)

Reads the serialized log file header to the buffer.

Parameters
[in]file_handlehandle for the opened log file
[out]bufthe allocated buffer for read
Returns
DB_SUCCESS or error

◆ log_file_header_read() [2/2]

dberr_t log_file_header_read ( Log_file_handle file_handle,
Log_file_header header 
)

Reads and deserializes the log file header.

Parameters
[in]file_handlehandle for the opened log file
[out]headerthe file header read
Returns
DB_SUCCESS or error

◆ log_file_header_reset_flag()

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.

Parameters
[in]log_flagsmask of log flags
[in]bitbit number to set (flag)

◆ log_file_header_serialize()

void log_file_header_serialize ( const Log_file_header header,
byte buf 
)

Serializes the log file header to the buffer.

Parameters
[in]headerthe header to serialize
[out]bufthe allocated buffer

◆ log_file_header_set_flag()

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.

Parameters
[in]log_flagsmask of log flags
[in]bitbit number to set (flag)

◆ log_file_header_validate()

static void log_file_header_validate ( const Log_file_header header)
static

Asserts that the provided file header seems correct.

Parameters
[in]headerfile header data to validate

◆ log_file_header_write() [1/2]

dberr_t log_file_header_write ( Log_file_handle file_handle,
const byte buf 
)

Writes the serialized log file header to the log file.

Parameters
[in]file_handlehandle for the opened log file
[in]bufthe serialized file header
Returns
DB_SUCCESS or error

◆ log_file_header_write() [2/2]

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.

Parameters
[in]file_handlehandle for the opened log file
[in]headerthe file header
Returns
DB_SUCCESS or error

◆ log_file_name()

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.

'ib_redo0'.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the log file
Returns
file name

◆ log_file_path()

std::string log_file_path ( const Log_files_context ctx,
Log_file_id  file_id 
)

Provides full path to the log file, e.g.

'/data/innodb_redo/ib_redo2'.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the log file
Returns
path to the log file (including file name)

◆ log_file_path_for_unused_file()

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.

'/data/innodb_redo/ib_redo2_tmp'.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file
Returns
path to the temporary log file (including file name)

◆ log_generate_uuid()

Log_uuid log_generate_uuid ( )

Generate unique identifier for the redo log files.

Returns
random uuid > 0

◆ log_header_checksum_is_ok()

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 that header.

Parameters
[in]bufheader to verify
Returns
true iff checksums are the same

◆ log_list_existing_files()

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).

Parameters
[in]ctxcontext within which files exist
[out]retidentifiers of existing log files
Returns
DB_SUCCESS or DB_ERROR

◆ log_list_existing_files_low()

static dberr_t log_list_existing_files_low ( const Log_files_context ctx,
const char *  suffix,
ut::vector< Log_file_id > &  ret 
)
static

Lists existing redo files in the configured redo log directory, selecting redo log files which have a given suffix in their name.

Produces list of identifiers of the listed and selected files. If a system error occurs when listing the redo directory, error is emitted to the error log and DB_ERROR is returned.

Parameters
[in]ctxredo log files context
[in]suffixsuffix used for the selection of files (could be "")
[out]retidentifiers of the listed and selected files
Returns
DB_SUCCESS or DB_ERROR

◆ log_list_existing_unused_files()

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.

Parameters
[in]ctxcontext within which files exist
[out]retidentifiers of existing unused log files
Returns
DB_SUCCESS or DB_ERROR

◆ log_mark_file_as_in_use()

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.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to rename
Returns
DB_SUCCESS or DB_ERROR

◆ log_mark_file_as_unused()

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.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to rename
Returns
DB_SUCCESS or DB_ERROR

◆ log_remove_file() [1/2]

std::pair< dberr_t, Log_file_id > log_remove_file ( const Log_files_context ctx)

Removes a single existing log file (if it existed).

Parameters
[in]ctxcontext within which files exist
Returns
first: DB_SUCCESS, DB_NOT_FOUND or DB_ERROR second: id of the removed file (if removed)

◆ log_remove_file() [2/2]

dberr_t log_remove_file ( const Log_files_context ctx,
Log_file_id  file_id 
)

Removes a log file, if it existed.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to remove
Returns
DB_SUCCESS, DB_NOT_FOUND or DB_ERROR

◆ log_remove_file_low()

static dberr_t log_remove_file_low ( const Log_files_context context,
const std::string &  file_path,
int  err_msg_id 
)
static

Delete the log file at the provided file path.

Asserts that the file has been deleted or does not exist.

Parameters
[in]contextredo log files context
[in]file_pathpath to the log file that should be removed
[in]err_msg_idid of the error message to print (if needed)
Returns
DB_SUCCESS, DB_NOT_FOUND or DB_ERROR

◆ log_remove_files()

std::pair< dberr_t, ut::vector< Log_file_id > > log_remove_files ( const Log_files_context ctx)

Removes existing log files.

When failed to remove a file, stops and returns error. In such case the last element of the returned identifiers of files, represents the file for which error has been encountered when trying to remove it.

Parameters
[in]ctxcontext within which files exist
Returns
first: DB_SUCCESS or DB_ERROR second: identifiers of files for which remove has been called

◆ log_remove_unused_file()

dberr_t log_remove_unused_file ( const Log_files_context ctx,
Log_file_id  file_id 
)

Removes a temporary log file, if it existed.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to remove
Returns
DB_SUCCESS, DB_NOT_FOUND or DB_ERROR

◆ log_remove_unused_files()

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.

When failed to remove a file, stops and returns error. In such case the last element of the returned identifiers of files, represents the file for which error has been encountered when trying to remove it.

Parameters
[in]ctxcontext within which files exist
Returns
first: DB_SUCCESS or DB_ERROR second: identifiers of files for which remove has been called

◆ log_rename_file_low()

static dberr_t log_rename_file_low ( const Log_files_context context,
const std::string &  old_file_path,
const std::string &  new_file_path,
int  err_msg_id 
)
static

Renames the log file.

Parameters
[in]contextredo log files context
[in]old_file_pathpath to the existing log file to rename
[in]new_file_pathpath to the renamed file
[in]err_msg_idid of the error message to print (if needed)
Returns
DB_SUCCESS or DB_ERROR

◆ log_rename_unused_file()

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.

Parameters
[in]ctxcontext within which files exist
[in]old_unused_file_idid of file to rename
[in]new_unused_file_idnew file id
Returns
DB_SUCCESS or DB_ERROR

◆ log_resize_file()

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.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to resize
[in]size_in_bytesrequested size of the file, in bytes
Returns
DB_SUCCESS, DB_NOT_FOUND, DB_OUT_OF_DISK_SPACE or DB_ERROR

◆ log_resize_file_low()

static dberr_t log_resize_file_low ( const std::string &  file_path,
os_offset_t  size_in_bytes,
int  err_msg_id 
)
static

Resizes the log file at the provided file path.

Parameters
[in]file_pathpath to the log file that should be resized
[in]size_in_bytessize to which resize, in bytes
[in]err_msg_idid of the error message to print (if needed)
Returns
DB_SUCCESS, DB_NOT_FOUND, DB_OUT_OF_DISK_SPACE or DB_ERROR

◆ log_resize_unused_file()

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.

Parameters
[in]ctxcontext within which files exist
[in]file_idid of the file to resize
[in]size_in_bytesrequested size of the file, in bytes
Returns
DB_SUCCESS, DB_NOT_FOUND, DB_OUT_OF_DISK_SPACE or DB_ERROR

Variable Documentation

◆ log_checksum_algorithm_ptr

Log_checksum_algorithm_atomic_ptr log_checksum_algorithm_ptr

Atomic pointer to the log checksum calculation function.

This is actually the only remaining "state" of the library. Hopefully can become removed.