Parallelization using Master parallelization information For significance of each method check definition of Mts_submode.  
 More...
#include <rpl_mta_submode.h>
 | 
|   | Mts_submode_logical_clock () | 
|   | 
| int  | schedule_next_event (Relay_log_info *rli, Log_event *ev) override | 
|   | Does necessary arrangement before scheduling next event.  More...
  | 
|   | 
| void  | attach_temp_tables (THD *thd, const Relay_log_info *rli, Query_log_event *ev) override | 
|   | Logic to attach the temporary tables from the worker threads upon event execution.  More...
  | 
|   | 
| void  | detach_temp_tables (THD *thd, const Relay_log_info *rli, Query_log_event *) override | 
|   | Logic to detach the temporary tables from the worker threads upon event execution.  More...
  | 
|   | 
| Slave_worker *  | get_least_occupied_worker (Relay_log_info *rli, Slave_worker_array *ws, Log_event *ev) override | 
|   | Logic to get least occupied worker when the sql mts_submode= master_parallel.  More...
  | 
|   | 
| void  | start_new_group () | 
|   | 
| void  | indicate_start_of_new_file () override | 
|   | Sets a flag to indicate that we are starting a new binlog file, therefore we need to skip the check for logical clock to not compare against sequence_number from previous event (previous file)  More...
  | 
|   | 
| void  | withdraw_delegated_job () | 
|   | Withdraw the delegated_job increased by the group.  More...
  | 
|   | 
| int  | wait_for_workers_to_finish (Relay_log_info *rli, Slave_worker *ignore=nullptr) override | 
|   | Waits for slave workers to finish off the pending tasks before returning.  More...
  | 
|   | 
| bool  | wait_for_last_committed_trx (Relay_log_info *rli, longlong last_committed_arg) | 
|   | The method implements logical timestamp conflict detection and resolution through waiting by the calling thread.  More...
  | 
|   | 
| longlong  | get_lwm_timestamp (Relay_log_info *rli, bool need_lock) | 
|   | The method finds the minimum logical timestamp (low-water-mark) of committed transactions.  More...
  | 
|   | 
| longlong  | estimate_lwm_timestamp () | 
|   | 
|   | ~Mts_submode_logical_clock () override=default | 
|   | 
|   | Mts_submode ()=default | 
|   | 
| enum_mts_parallel_type  | get_type () | 
|   | 
| virtual bool  | set_multi_threaded_applier_context (const Relay_log_info &, Log_event &) | 
|   | Sets additional context before the event is set to execute.  More...
  | 
|   | 
| virtual  | ~Mts_submode ()=default | 
|   | 
Parallelization using Master parallelization information For significance of each method check definition of Mts_submode. 
 
◆ Mts_submode_logical_clock()
      
        
          | Mts_submode_logical_clock::Mts_submode_logical_clock  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ ~Mts_submode_logical_clock()
  
  
      
        
          | Mts_submode_logical_clock::~Mts_submode_logical_clock  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
overridedefault   | 
  
 
 
◆ attach_temp_tables()
Logic to attach the temporary tables from the worker threads upon event execution. 
- Parameters
 - 
  
    | thd | THD instance  | 
    | rli | Relay_log_info instance  | 
    | ev | Query_log_event that is being applied  | 
  
   
Implements Mts_submode.
 
 
◆ clock_leq()
◆ detach_temp_tables()
Logic to detach the temporary tables from the worker threads upon event execution. 
- Parameters
 - 
  
    | thd | THD instance  | 
    | rli | Relay_log_info instance  | 
  
   
Implements Mts_submode.
 
 
◆ estimate_lwm_timestamp()
  
  
      
        
          | longlong Mts_submode_logical_clock::estimate_lwm_timestamp  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ get_free_worker()
Protected method to fetch a worker having no events assigned. 
The method is supposed to be called by Coordinator, therefore comparison like w_i->jobs.len == 0 must (eventually) succeed.
todo: consider to optimize scan that is getting more expensive with more # of Workers.
- Returns
 - a pointer to Worker or NULL if none is free. 
 
 
 
◆ get_least_occupied_worker()
Logic to get least occupied worker when the sql mts_submode= master_parallel. 
- Parameters
 - 
  
    | rli | relay log info of coordinator  | 
    | ws | array of worker threads  | 
    | ev | event for which we are searching for a worker.  | 
  
   
- Returns
 - slave worker thread or NULL when coordinator is killed by any worker. 
 
Implements Mts_submode.
 
 
◆ get_lwm_timestamp()
The method finds the minimum logical timestamp (low-water-mark) of committed transactions. 
The successful search results in a pair of a logical timestamp value and a GAQ index that contains it. last_lwm_timestamp may still be raised though the search does not find any satisfying running index. Search is implemented as headway scanning of GAQ from a point of a previous search's stop position (last_lwm_index). Whether the cached (memorized) index value is considered to be stale when its timestamp gets less than the current "stable" LWM: 
 last_lwm_timestamp <= GAQ.lwm.sequence_number           (*)
 Staleness is caused by GAQ garbage collection that increments the rhs of (*), see move_queue_head(). When that's diagnosed, the search in GAQ needs restarting from the queue tail.
Formally, the undefined cached value of last_lwm_timestamp is also stale.
           the last time index containing lwm
               +------+
               | LWM  |
               |  |   |
               V  V   V
GAQ:   xoooooxxxxxXXXXX...X
             ^   ^
             |   | LWM+1
             |
             +- tne new current_lwm
      <---- logical (commit) time ----
here ‘x’ stands for committed, ‘X’ for committed and discarded from the running range of the queue, ‘o’ for not committed.
- Parameters
 - 
  
    | rli | Relay_log_info pointer  | 
    | need_lock | Either the caller or the function must hold a mutex to avoid race with concurrent GAQ update. | 
  
   
- Returns
 - possibly updated current_lwm 
 
 
 
◆ get_server_and_thread_id()
  
  
      
        
          | std::pair< uint, my_thread_id > Mts_submode_logical_clock::get_server_and_thread_id  | 
          ( | 
          TABLE *  | 
          table | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Protected method to fetch the server_id and pseudo_thread_id from a temporary table. 
- Parameters
 - 
  
    | table | instance pointer of TABLE structure.  | 
  
   
- Returns
 - std:pair<uint, my_thread_id> 
 
- Note
 - It is the caller's responsibility to make sure we call this function only for temp tables. 
 
 
 
◆ indicate_start_of_new_file()
  
  
      
        
          | void Mts_submode_logical_clock::indicate_start_of_new_file  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineoverridevirtual   | 
  
 
Sets a flag to indicate that we are starting a new binlog file, therefore we need to skip the check for logical clock to not compare against sequence_number from previous event (previous file) 
Reimplemented from Mts_submode.
 
 
◆ schedule_next_event()
Does necessary arrangement before scheduling next event. 
The method computes the meta-group status of the being scheduled transaction represented by the event argument. When the status is found OUT (of the current meta-group) as encoded as is_new_group == true the global Scheduler (Coordinator thread) requests full synchronization with all Workers. The current being assigned group descriptor gets associated with the group's logical timestamp aka sequence_number.
- Returns
 - ER_MTA_CANT_PARALLEL, ER_MTA_INCONSISTENT_DATA 0 if no error or slave has been killed gracefully 
 
Implements Mts_submode.
 
 
◆ start_new_group()
  
  
      
        
          | void Mts_submode_logical_clock::start_new_group  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ wait_for_last_committed_trx()
      
        
          | bool Mts_submode_logical_clock::wait_for_last_committed_trx  | 
          ( | 
          Relay_log_info *  | 
          rli,  | 
        
        
           | 
           | 
          longlong  | 
          last_committed_arg  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
The method implements logical timestamp conflict detection and resolution through waiting by the calling thread. 
The conflict or waiting condition is like the following 
    lwm < last_committed,
 where lwm is a minimum logical timestamp of committed transactions. Since the lwm's exact value is not always available its pessimistic estimate (an old version) is improved (get_lwm_timestamp()) as the first step before to the actual waiting commitment.
Special cases include:
When last_committed_arg is uninitialized the calling thread must proceed without waiting for anyone. Any possible dependency with unknown commit parent transaction shall be sorted out by the parent;
When the gaq index is subsequent to the last lwm index there's no dependency of the current transaction with any regardless of lwm timestamp should it be SEQ_UNINIT. Consequently when GAQ consists of just one item there's none to wait. Such latter case is left to the caller to handle.
- Note
 - The caller must make sure the current transaction won't be waiting for itself. That is the method should not be caller by a Worker whose group assignment is in the GAQ front item.
 
- Parameters
 - 
  
    | rli | relay log info of coordinator  | 
    | last_committed_arg | logical timestamp of a parent transaction  | 
  
   
- Returns
 - false as success, true when the error flag is raised or the caller thread is found killed. 
 
 
 
◆ wait_for_workers_to_finish()
Waits for slave workers to finish off the pending tasks before returning. 
Used in this submode to make sure that all assigned jobs have been done.
- Parameters
 - 
  
    | rli | coordinator rli.  | 
    | ignore | worker to ignore.  | 
  
   
- Returns
 - -1 for error. 0 no error. 
 
Implements Mts_submode.
 
 
◆ withdraw_delegated_job()
  
  
      
        
          | void Mts_submode_logical_clock::withdraw_delegated_job  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Withdraw the delegated_job increased by the group. 
 
 
◆ delegated_jobs
  
  
      
        
          | uint Mts_submode_logical_clock::delegated_jobs | 
         
       
   | 
  
private   | 
  
 
 
◆ first_event
  
  
      
        
          | bool Mts_submode_logical_clock::first_event | 
         
       
   | 
  
private   | 
  
 
 
◆ force_new_group
  
  
      
        
          | bool Mts_submode_logical_clock::force_new_group | 
         
       
   | 
  
private   | 
  
 
 
◆ INDEX_UNDEF
  
  
      
        
          | const ulong Mts_submode_logical_clock::INDEX_UNDEF = (ulong)-1 | 
         
       
   | 
  
static   | 
  
 
 
◆ is_error
      
        
          | bool Mts_submode_logical_clock::is_error | 
        
      
 
 
◆ is_new_group
  
  
      
        
          | bool Mts_submode_logical_clock::is_new_group | 
         
       
   | 
  
private   | 
  
 
 
◆ jobs_done
      
        
          | uint Mts_submode_logical_clock::jobs_done | 
        
      
 
 
◆ last_committed
  
  
      
        
          | longlong Mts_submode_logical_clock::last_committed | 
         
       
   | 
  
private   | 
  
 
 
◆ last_lwm_index
  
  
      
        
          | ulong Mts_submode_logical_clock::last_lwm_index | 
         
       
   | 
  
private   | 
  
 
 
◆ last_lwm_timestamp
  
  
      
        
          | std::atomic<longlong> Mts_submode_logical_clock::last_lwm_timestamp | 
         
       
   | 
  
private   | 
  
 
 
◆ min_waited_timestamp
      
        
          | std::atomic<longlong> Mts_submode_logical_clock::min_waited_timestamp | 
        
      
 
 
◆ sequence_number
  
  
      
        
          | longlong Mts_submode_logical_clock::sequence_number | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: