MySQL 8.0.40
Source Code Documentation
Binlog_group_commit_ctx Class Reference

Keeps the THD session context to be used with the Bgc_ticket_manager. More...

#include <rpl_context.h>

Public Member Functions

 Binlog_group_commit_ctx ()=default
 
virtual ~Binlog_group_commit_ctx ()=default
 
binlog::BgcTicket get_session_ticket ()
 Retrieves the ticket that the THD session has been assigned to. More...
 
void set_session_ticket (binlog::BgcTicket ticket)
 Sets the THD session's ticket to the given value. More...
 
void assign_ticket ()
 Assigns the THD session to the ticket accepting assignments in the ticket manager. More...
 
bool has_waited ()
 Whether or not the session already waited on the ticket. More...
 
void mark_as_already_waited ()
 Marks the underlying session has already waited on the ticket. More...
 
void reset ()
 Resets the THD session's ticket context. More...
 
std::string to_string () const
 Returns the textual representation of this object;. More...
 
void format (std::ostream &out) const
 Dumps the textual representation of this object into the given output stream. More...
 
void set_max_size_exceeded (bool value)
 Set whether binlog max size was exceeded. More...
 
void set_force_rotate ()
 Turn on forced rotate at end of BGC. More...
 

Static Public Member Functions

static memory::Aligned_atomic< bool > & manual_ticket_setting ()
 Retrieves the flag for determining if it should be possible to manually set the session's ticket. More...
 
static std::pair< bool, bool > aggregate_rotate_settings (THD *queue)
 Aggregate the rotate requests over all sessions in queue. More...
 

Private Attributes

binlog::BgcTicket m_session_ticket {0}
 The ticket the THD session has been assigned to. More...
 
bool m_has_waited {false}
 Whether or not the session already waited on the ticket. More...
 
bool m_max_size_exceeded {false}
 Whether session detected that binlog max size was exceeded. More...
 
bool m_force_rotate {false}
 Whether session requests forced rotate. More...
 

Friends

std::ostream & operator<< (std::ostream &out, Binlog_group_commit_ctx const &to_dump)
 Dumps the textual representation of an instance of this class into the given output stream. More...
 

Detailed Description

Keeps the THD session context to be used with the Bgc_ticket_manager.

In particular, manages the value of the ticket the current THD session has been assigned to.

Constructor & Destructor Documentation

◆ Binlog_group_commit_ctx()

Binlog_group_commit_ctx::Binlog_group_commit_ctx ( )
default

◆ ~Binlog_group_commit_ctx()

virtual Binlog_group_commit_ctx::~Binlog_group_commit_ctx ( )
virtualdefault

Member Function Documentation

◆ aggregate_rotate_settings()

std::pair< bool, bool > Binlog_group_commit_ctx::aggregate_rotate_settings ( THD queue)
static

Aggregate the rotate requests over all sessions in queue.

Returns
The first element states whether any session detected max binlog size exceeded and the second whether any session requested forced binlog rotate.

◆ assign_ticket()

void Binlog_group_commit_ctx::assign_ticket ( )

Assigns the THD session to the ticket accepting assignments in the ticket manager.

The method is idem-potent within the execution of a statement. This means that it can be invoked several times during the execution of a command within the THD session that only once will the session be assign to a ticket.

◆ format()

void Binlog_group_commit_ctx::format ( std::ostream &  out) const

Dumps the textual representation of this object into the given output stream.

Parameters
outThe stream to dump this object into.

◆ get_session_ticket()

binlog::BgcTicket Binlog_group_commit_ctx::get_session_ticket ( )

Retrieves the ticket that the THD session has been assigned to.

If it hasn't been assigned to any yet, returns '0'.

Returns
The ticket the THD session has been assigned to, if any. Returns 0 if it hasn't.

◆ has_waited()

bool Binlog_group_commit_ctx::has_waited ( )

Whether or not the session already waited on the ticket.

Returns
true if the session already waited, false otherwise.

◆ manual_ticket_setting()

memory::Aligned_atomic< bool > & Binlog_group_commit_ctx::manual_ticket_setting ( )
static

Retrieves the flag for determining if it should be possible to manually set the session's ticket.

Returns
the reference for the atomic flag.

◆ mark_as_already_waited()

void Binlog_group_commit_ctx::mark_as_already_waited ( )

Marks the underlying session has already waited on the ticket.

◆ reset()

void Binlog_group_commit_ctx::reset ( void  )

Resets the THD session's ticket context.

◆ set_force_rotate()

void Binlog_group_commit_ctx::set_force_rotate ( )
inline

Turn on forced rotate at end of BGC.

Thus performing a rotate although the max size has not been reached.

◆ set_max_size_exceeded()

void Binlog_group_commit_ctx::set_max_size_exceeded ( bool  value)
inline

Set whether binlog max size was exceeded.

The max size exceeded condition must be checked with LOCK_log held and thus its done early during flush stage although not used until end of BGC. This is an optimization which avoids taking LOCK_log at end of BGC when no session has seen that the threshold has been exceeded.

◆ set_session_ticket()

void Binlog_group_commit_ctx::set_session_ticket ( binlog::BgcTicket  ticket)

Sets the THD session's ticket to the given value.

Parameters
ticketThe ticket to set the THD session to.

◆ to_string()

std::string Binlog_group_commit_ctx::to_string ( ) const

Returns the textual representation of this object;.

Returns
a string containing the textual representation of this object.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
Binlog_group_commit_ctx const &  to_dump 
)
friend

Dumps the textual representation of an instance of this class into the given output stream.

Parameters
outThe output stream to dump the instance to.
to_dumpThe class instance to dump to the output stream.
Returns
The output stream to which the instance was dumped to.

Member Data Documentation

◆ m_force_rotate

bool Binlog_group_commit_ctx::m_force_rotate {false}
private

Whether session requests forced rotate.

◆ m_has_waited

bool Binlog_group_commit_ctx::m_has_waited {false}
private

Whether or not the session already waited on the ticket.

◆ m_max_size_exceeded

bool Binlog_group_commit_ctx::m_max_size_exceeded {false}
private

Whether session detected that binlog max size was exceeded.

◆ m_session_ticket

binlog::BgcTicket Binlog_group_commit_ctx::m_session_ticket {0}
private

The ticket the THD session has been assigned to.


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