MySQL 9.1.0
Source Code Documentation
Slave_committed_queue Class Reference

Group Assigned Queue whose first element identifies first gap in committed sequence. More...

#include <rpl_rli_pdb.h>

Inheritance diagram for Slave_committed_queue:
[legend]

Public Member Functions

void update_current_binlog (const char *post_rotate)
 
 Slave_committed_queue (size_t max, uint n)
 
 ~Slave_committed_queue ()
 
bool count_done (Relay_log_info *rli)
 
size_t move_queue_head (Slave_worker_array *ws)
 The queue is processed from the head item by item to purge items representing committed groups. More...
 
void free_dynamic_items ()
 Method should be executed at slave system stop to cleanup dynamically allocated items that remained as unprocessed by Coordinator and Workers in their regular execution course. More...
 
Slave_job_groupget_job_group (size_t ind)
 
size_t en_queue (Slave_job_group *item)
 Assigns assigned_group_index to an index of enqueued item and returns it. More...
 
bool de_queue (Slave_job_group *item)
 Dequeue from head. More...
 
bool de_tail (Slave_job_group *item)
 Similar to de_queue() but removing an item from the tail side. More...
 
size_t find_lwm (Slave_job_group **, size_t)
 Finds low-water mark of committed jobs in GAQ. More...
 
- Public Member Functions inherited from circular_buffer_queue< Slave_job_group >
 circular_buffer_queue (size_t max)
 
 circular_buffer_queue ()
 
 ~circular_buffer_queue ()=default
 
bool de_queue (Slave_job_group *item)
 Content of the being dequeued item is copied to the arg-pointer location. More...
 
bool de_tail (Slave_job_group *item)
 Similar to de_queue but extracting happens from the tail side. More...
 
size_t en_queue (Slave_job_group *item)
 return the index where the arg item locates or an error encoded as a value circular_buffer_queue::error_result. More...
 
Slave_job_grouphead_queue ()
 return the value of data member of the head of the queue. More...
 
bool in (size_t i)
 
size_t get_length () const
 
bool empty () const
 
bool full () const
 

Public Attributes

bool inited
 
Slave_job_group lwm
 
Prealloced_array< ulonglong, 1 > last_done
 
ulong assigned_group_index
 
- Public Attributes inherited from circular_buffer_queue< Slave_job_group >
Prealloced_array< Slave_job_group, 1 > m_Q
 
size_t capacity
 The capacity and maximum length of the queue in terms of element. More...
 
size_t avail
 Its value modulo capacity is index of the element where the next element will be enqueued. More...
 
size_t entry
 The head index of the queue. More...
 
std::atomic< size_t > len
 Actual length. More...
 
bool inited_queue
 

Additional Inherited Members

- Static Public Attributes inherited from circular_buffer_queue< Slave_job_group >
static constexpr size_t error_result
 

Detailed Description

Group Assigned Queue whose first element identifies first gap in committed sequence.

The head of the queue is therefore next to the low-water-mark.

Constructor & Destructor Documentation

◆ Slave_committed_queue()

Slave_committed_queue::Slave_committed_queue ( size_t  max,
uint  n 
)

◆ ~Slave_committed_queue()

Slave_committed_queue::~Slave_committed_queue ( )
inline

Member Function Documentation

◆ count_done()

bool Slave_committed_queue::count_done ( Relay_log_info rli)

◆ de_queue()

bool Slave_committed_queue::de_queue ( Slave_job_group item)
inline

Dequeue from head.

Parameters
[out]itemA pointer to the being dequeued item.
Returns
true if an element was returned, false if the queue was empty.

◆ de_tail()

bool Slave_committed_queue::de_tail ( Slave_job_group item)
inline

Similar to de_queue() but removing an item from the tail side.

Parameters
[out]itemA pointer to the being dequeued item.
Returns
true if an element was returned, false if the queue was empty.

◆ en_queue()

size_t Slave_committed_queue::en_queue ( Slave_job_group item)
inline

Assigns assigned_group_index to an index of enqueued item and returns it.

◆ find_lwm()

size_t Slave_committed_queue::find_lwm ( Slave_job_group **  arg_g,
size_t  start_index 
)

Finds low-water mark of committed jobs in GAQ.

That is an index below which all jobs are marked as done.

Notice the first available index is returned when the queue does not have any incomplete jobs. That includes cases of the empty and the full of complete jobs queue. A mutex protecting from concurrent LWM change by move_queue_head() (by Coordinator) should be taken by the caller.

Parameters
[out]arg_ga double pointer to Slave job descriptor item last marked with done-as-true boolean.
start_indexa GAQ index to start/resume searching. Caller is to make sure the index points into assigned (occupied) range of circular buffer of GAQ.
Returns
GAQ index of the last consecutive done job, or the GAQ size when none is found.

◆ free_dynamic_items()

void Slave_committed_queue::free_dynamic_items ( )

Method should be executed at slave system stop to cleanup dynamically allocated items that remained as unprocessed by Coordinator and Workers in their regular execution course.

◆ get_job_group()

Slave_job_group * Slave_committed_queue::get_job_group ( size_t  ind)
inline

◆ move_queue_head()

size_t Slave_committed_queue::move_queue_head ( Slave_worker_array ws)

The queue is processed from the head item by item to purge items representing committed groups.

Progress in GAQ is assessed through comparison of GAQ index value with Worker's last_group_done_index. Purging breaks at a first discovered gap, that is an item that the assigned item->w_id'th Worker has not yet completed.

The caller is supposed to be the checkpoint handler.

A copy of the last discarded item containing the refreshed value of the committed low-water-mark is stored into lwm container member for further caller's processing. last_done is updated with the latest total_seqno for each Worker that was met during GAQ parse.

Note
dyn-allocated members of Slave_job_group such as group_relay_log_name as freed here.
Returns
number of discarded items

◆ update_current_binlog()

void Slave_committed_queue::update_current_binlog ( const char *  post_rotate)

Member Data Documentation

◆ assigned_group_index

ulong Slave_committed_queue::assigned_group_index

◆ inited

bool Slave_committed_queue::inited

◆ last_done

Prealloced_array<ulonglong, 1> Slave_committed_queue::last_done

◆ lwm

Slave_job_group Slave_committed_queue::lwm

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