MySQL 9.0.0
Source Code Documentation
binlog_index.cc File Reference
#include <string.h>
#include <algorithm>
#include "my_dbug.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/psi/mysql_file.h"
#include "mysqld_error.h"
#include "sql/binlog_index.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/mysqld.h"
#include "sql/sql_class.h"
#include "strmake.h"

Functions

static bool copy_file (IO_CACHE *from, IO_CACHE *to, my_off_t offset, my_off_t end_pos=0)
 Copy content of 'from' file from offset to 'to' file. More...
 
bool normalize_binlog_name (char *to, const char *from, bool is_relay_log)
 Turns a relative log binary log path into a full path, based on the opt_bin_logname or opt_relay_logname. More...
 
int compare_log_name (const char *log_1, const char *log_2)
 Compare log file basenames, i.e. More...
 
void exec_binlog_error_action_abort (const char *err_string)
 When a fatal error occurs due to which binary logging becomes impossible and the user specified binlog_error_action= ABORT_SERVER the following function is invoked. More...
 

Function Documentation

◆ compare_log_name()

int compare_log_name ( const char *  log_1,
const char *  log_2 
)

Compare log file basenames, i.e.

without their directory names

Returns
It returns an integer less than, equal to, or greater than zero if log_1 is found, respectively, to be less than, to match, or be greater than log_2

◆ copy_file()

static bool copy_file ( IO_CACHE from,
IO_CACHE to,
my_off_t  offset,
my_off_t  end_pos = 0 
)
static

Copy content of 'from' file from offset to 'to' file.

  • We do the copy outside of the IO_CACHE as the cache buffers would just make things slower and more complicated. In most cases the copy loop should only do one read.
Parameters
fromFile to copy.
toFile to copy to.
offsetOffset in 'from' file.
end_posEnd position in 'from' file up to which content should be copied; 0 means copying till the end of file
Return values
0ok
-1error

◆ exec_binlog_error_action_abort()

void exec_binlog_error_action_abort ( const char *  err_string)

When a fatal error occurs due to which binary logging becomes impossible and the user specified binlog_error_action= ABORT_SERVER the following function is invoked.

This function pushes the appropriate error message to client and logs the same to server error log and then aborts the server.

Parameters
err_stringError string which specifies the exact error message from the caller.

◆ normalize_binlog_name()

bool normalize_binlog_name ( char *  to,
const char *  from,
bool  is_relay_log 
)

Turns a relative log binary log path into a full path, based on the opt_bin_logname or opt_relay_logname.

Also trims the cr-lf at the end of the full_path before return to avoid any server startup problem on windows.

Parameters
fromThe log name we want to make into an absolute path.
toThe buffer where to put the results of the normalization.
is_relay_logSwitch that makes is used inside to choose which option (opt_bin_logname or opt_relay_logname) to use when calculating the base path.
Returns
true if a problem occurs, false otherwise.