MySQL 9.1.0
Source Code Documentation
Until_position Class Reference

It is an abstract class for until master position and until relay log position. More...

#include <rpl_replica_until_options.h>

Inheritance diagram for Until_position:
[legend]

Public Member Functions

 ~Until_position () override=default
 
int init (const char *log_name, my_off_t log_pos)
 Initialize the until position when starting the slave. More...
 
void notify_log_name_change ()
 Coordinator calls this function to notify that master log switch or relay log switch. More...
 
const char * get_until_log_name ()
 
my_off_t get_until_log_pos ()
 
- Public Member Functions inherited from Until_option
virtual ~Until_option ()=default
 
bool is_satisfied_at_start_slave ()
 Check if the until option is already satisfied at coordinator starting. More...
 
bool is_satisfied_before_dispatching_event (const Log_event *ev)
 check if the until option is satisfied before applying or dispatching a event. More...
 
bool is_satisfied_after_dispatching_event ()
 check if the until option is satisfied after applied or dispatched a event. More...
 
bool is_satisfied_all_transactions_read_from_relay_log ()
 check if the until option is waiting for more transactions to be read from the relay log. More...
 

Protected Types

enum  { LOG_NAMES_CMP_UNKNOWN = -2 , LOG_NAMES_CMP_LESS = -1 , LOG_NAMES_CMP_EQUAL = 0 , LOG_NAMES_CMP_GREATER = 1 }
 Log name is compared only once for each master log or relay log. More...
 

Protected Member Functions

 Until_position (Relay_log_info *rli)
 
bool check_position (const char *log_name, my_off_t log_pos)
 Check if until position is satisfied. More...
 
- Protected Member Functions inherited from Until_option
 Until_option (Relay_log_info *rli)
 

Protected Attributes

enum Until_position:: { ... }  m_log_names_cmp_result
 Log name is compared only once for each master log or relay log. More...
 
- Protected Attributes inherited from Until_option
Relay_log_infom_rli
 

Private Attributes

char m_until_log_name [FN_REFLEN]
 
ulonglong m_until_log_pos
 
ulong m_until_log_name_extension
 

Detailed Description

It is an abstract class for until master position and until relay log position.

It ecapsulates the variables and functions shared by the two sort of until options.

To avoid comparing log name in every call of interface functions. An optimized comparing logic is implemented.

  • Log name is just compared once for each master log and relay log.
  • coodinator should notify Until_option object if master log or relay log is switched by calling notify_log_name_change() function.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Log name is compared only once for each master log or relay log.

And the comparison result is stored in m_log_names_cmp_result.

Enumerator
LOG_NAMES_CMP_UNKNOWN 
LOG_NAMES_CMP_LESS 
LOG_NAMES_CMP_EQUAL 
LOG_NAMES_CMP_GREATER 

Constructor & Destructor Documentation

◆ ~Until_position()

Until_position::~Until_position ( )
overridedefault

◆ Until_position()

Until_position::Until_position ( Relay_log_info rli)
inlineprotected

Member Function Documentation

◆ check_position()

bool Until_position::check_position ( const char *  log_name,
my_off_t  log_pos 
)
protected

Check if until position is satisfied.

  • If m_log_names_cmp_result is LOG_NAMES_CMP_UNKNOWN, then it first compares log_name to m_until_log_name.
  • If the comparison result is LOG_NAMES_CMP_LESS, it will return false directly. If it is LOG_NAMES_CMP_EQUAL, it then compares log_pos to m_until_log_pos.
  • If the comparison result is LOG_NAMES_CMP_GREATER, it will return true directly.

◆ get_until_log_name()

const char * Until_position::get_until_log_name ( )
inline

◆ get_until_log_pos()

my_off_t Until_position::get_until_log_pos ( )
inline

◆ init()

int Until_position::init ( const char *  log_name,
my_off_t  log_pos 
)

Initialize the until position when starting the slave.

Parameters
[in]log_namethe log name in START REPLICA UNTIL option.
[in]log_posthe log position in START REPLICA UNTIL option.
Returns
int
Return values
0if succeeds.
adefined mysql error number if error happens.

◆ notify_log_name_change()

void Until_position::notify_log_name_change ( )
inline

Coordinator calls this function to notify that master log switch or relay log switch.

Member Data Documentation

◆ 

enum { ... } Until_position::m_log_names_cmp_result

Log name is compared only once for each master log or relay log.

And the comparison result is stored in m_log_names_cmp_result.

◆ m_until_log_name

char Until_position::m_until_log_name[FN_REFLEN]
private

◆ m_until_log_name_extension

ulong Until_position::m_until_log_name_extension
private

◆ m_until_log_pos

ulonglong Until_position::m_until_log_pos
private

The documentation for this class was generated from the following files: