![]() |
MySQL 26.7.0
Source Code Documentation
|
The Job_binlog class is a container that holds a buffer of fetchable events and context for the transaction to be applied in change streams. More...
#include <job_binlog.h>
Public Types | |
| using | Stat_monitor_ref = scheduler::Statistics_instance_monitor_ref |
| Alias to Statistics_instance_monitor_ref contained in the scheduler library. More... | |
Public Types inherited from mysql::csa::Job | |
| using | Thread_id = unsigned int |
| Type alias for thread identifier. More... | |
Public Member Functions | |
| Job_binlog (const Job_binlog &)=delete | |
| Deleted copy constructor. More... | |
| Job_binlog & | operator= (const Job_binlog &)=delete |
| Deleted assignment operator. More... | |
| Job_binlog (Channel *channel, unsigned int max_retries, std::shared_ptr< Fetchable_transaction > fetch_object, Stat_monitor_ref stat_monitor) | |
| Constructor for Job_binlog. More... | |
| virtual | ~Job_binlog () override |
| Destructor for Job_binlog. More... | |
| Channel * | get_channel () const |
| Gets the channel this job comes from. More... | |
| const std::string & | get_channel_id () const |
| Gets the transaction identifier as a string. More... | |
| std::string | get_trx_id () const |
| Get transaction GTID. More... | |
| const mysql::gtid::Gtid & | get_trx_gtid () const |
| Gets the transaction GTID. More... | |
| unsigned long long | get_last_committed () const |
| Gets the last committed value to determine when this transaction can run. More... | |
| unsigned long long | get_sequence_number () const |
| Gets the sequence number of this transaction to determine when it can run and commit. More... | |
| unsigned long long | get_trx_length () const |
| Gets the transaction length. More... | |
| virtual bool | prepare (Thread_id thread_id)=0 |
| Run prepare phase of this transaction. More... | |
| virtual bool | commit (Thread_id thread_id)=0 |
| Run commit phase of this transaction. More... | |
| virtual bool | commit_register (Thread_id thread_id)=0 |
| Register the transaction for commit phase. More... | |
| void | set_done () override |
| Mark the transaction as done (done with failure or done successfully. More... | |
| unsigned int | get_instance_id () const override |
| Obtains unique instance id to gather statistics separately for different "instances". More... | |
| virtual bool | is_complete () |
| Checks if this transaction has finished fetching. More... | |
| bool | restart () override |
| Restarts the job and prepares for retry. More... | |
| bool | run (Thread_id thread_id) override |
| Binlog job needs to be called twice to apply transaction: More... | |
| bool | is_trx () const override |
| Checks whether handled job is a transaction (supports two phases) More... | |
| void | set_success () override |
| success callback More... | |
| void | skip () override |
| Skip this job, considered complete and done without failure. More... | |
Public Member Functions inherited from mysql::csa::Job | |
| Job (const Job &)=delete | |
| Deleted copy constructor. More... | |
| Job & | operator= (const Job &)=delete |
| Deleted assignment operator. More... | |
| Job (unsigned int max_retries) | |
| Constructor. More... | |
| virtual | ~Job () |
| Destructor. More... | |
| virtual bool | attach (Thread_id thread_id)=0 |
| Attaches the job. More... | |
| Thread_id | get_attach_id () const |
| Returns an id based on which the job attaches to applier context. More... | |
| virtual bool | detach (Thread_id thread_id)=0 |
| Detaches the job. More... | |
| virtual std::size_t | get_id () const |
| Gets the job identifier. More... | |
| virtual void | inc_retries () |
| Increments the number of retries for the job. More... | |
| virtual bool | can_be_retried () |
| Checks whether this job can be retried. More... | |
| virtual unsigned int | get_retries () const |
| Gets the number of retries for this job. More... | |
| virtual bool | is_error () |
| Checks whether this job is in error state. More... | |
| virtual bool | is_stopped () const |
| Checks whether applier stop has been requested for this job. More... | |
| virtual bool | is_fatal_error () |
| Checks whether job has a fatal, non-recoverable error. More... | |
| virtual void | set_applier_stop (std::atomic< bool > &applier_stop) |
| Injects the applier stop flag for this job. More... | |
| virtual void | set_failure () |
| Global job failure callback. More... | |
| virtual void | set_fatal_error () |
| Sets fatal job error. More... | |
| virtual void | set_error () |
| Sets job error. More... | |
| virtual bool | is_done () |
| Checks whether the job is done. More... | |
| virtual bool | is_attached () const =0 |
| Checks whether the job is currently attached. More... | |
| virtual std::string | to_string () |
| Converts the job to a string representation. More... | |
Protected Member Functions | |
| bool | restart_internal (bool all) |
| Restarts job with fetch metadata. More... | |
Protected Attributes | |
| mysql::gtid::Gtid | m_trx_gtid |
| The GTID of the transaction. "<unknown>" if not available. More... | |
| Channel * | m_channel |
| The channel this transaction is coming from. More... | |
| mysql::csa::Managed_event | m_first_event |
| The first event fetched to obtain GTID information. More... | |
| uint32_t | m_next_event {0} |
| The cursor for the events to process. More... | |
| Stat_monitor_ref | m_stat_monitor |
| Statistics monitoring object for the current instance. More... | |
| std::shared_ptr< Fetchable_transaction > | m_fetch_metadata |
| Information on how to fetch transaction data. More... | |
| Transaction_phase | m_phase {Transaction_phase::prepare} |
| Transaction phase indicator: More... | |
Protected Attributes inherited from mysql::csa::Job | |
| bool | m_is_error {false} |
| Error flag for job. More... | |
| bool | m_is_fatal_error {false} |
| Specifies if this job has a fatal error - we cannot retry it. More... | |
| bool | m_is_done {false} |
| When set to true, job is done (successfully or not) More... | |
| unsigned int | m_max_retries |
| Maximum number of retries for this job. More... | |
| std::size_t | m_id {0} |
| This job sequence id. More... | |
| Thread_id | m_thread_id {0} |
| Worker pool thread id. More... | |
| std::size_t | m_trx_retries {0} |
| The number of times this job was retried. More... | |
| std::reference_wrapper< std::atomic< bool > > | m_applier_stop |
| Channel stop flag used to interrupt wait loops. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from mysql::csa::Job | |
| static std::atomic< std::size_t > | next_id = 0 |
| Next job id. Used to generate ids for jobs. More... | |
The Job_binlog class is a container that holds a buffer of fetchable events and context for the transaction to be applied in change streams.
The context includes the originating channel and parallelization window information.
Alias to Statistics_instance_monitor_ref contained in the scheduler library.
|
delete |
Deleted copy constructor.
| mysql::csa::Job_binlog::Job_binlog | ( | Channel * | channel, |
| unsigned int | max_retries, | ||
| std::shared_ptr< Fetchable_transaction > | fetch_object, | ||
| Stat_monitor_ref | stat_monitor | ||
| ) |
Constructor for Job_binlog.
| channel | The channel this job is coming from. |
| max_retries | The maximum number of retries for this job. |
| fetch_object | The object to fetch job data from. |
| stat_monitor | Object for monitoring statistics |
|
overridevirtual |
Destructor for Job_binlog.
|
pure virtual |
Run commit phase of this transaction.
| thread_id | Thread pool worker identifier |
Implemented in mysql::csa::Job_applier.
|
pure virtual |
Register the transaction for commit phase.
| thread_id | Thread pool worker identifier |
Implemented in mysql::csa::Job_applier.
| Channel * mysql::csa::Job_binlog::get_channel | ( | ) | const |
Gets the channel this job comes from.
| const std::string & mysql::csa::Job_binlog::get_channel_id | ( | ) | const |
Gets the transaction identifier as a string.
|
overridevirtual |
Obtains unique instance id to gather statistics separately for different "instances".
Since we want to gather statistics separately for different. channels, this is set to channel id. The instance ID is used as a key to aggregate statistics for each channel.
Reimplemented from mysql::csa::Job.
| unsigned long long mysql::csa::Job_binlog::get_last_committed | ( | ) | const |
Gets the last committed value to determine when this transaction can run.
| unsigned long long mysql::csa::Job_binlog::get_sequence_number | ( | ) | const |
Gets the sequence number of this transaction to determine when it can run and commit.
|
inline |
Gets the transaction GTID.
| std::string mysql::csa::Job_binlog::get_trx_id | ( | ) | const |
Get transaction GTID.
| unsigned long long mysql::csa::Job_binlog::get_trx_length | ( | ) | const |
Gets the transaction length.
|
virtual |
Checks if this transaction has finished fetching.
|
overridevirtual |
Checks whether handled job is a transaction (supports two phases)
Reimplemented from mysql::csa::Job.
|
delete |
Deleted assignment operator.
|
pure virtual |
Run prepare phase of this transaction.
| thread_id | Thread pool worker identifier |
Implemented in mysql::csa::Job_applier.
|
overridevirtual |
Restarts the job and prepares for retry.
Reimplemented from mysql::csa::Job.
|
protected |
Restarts job with fetch metadata.
| all | When true, this is a retry and all object states must be restarted |
|
overridevirtual |
Binlog job needs to be called twice to apply transaction:
| thread_id | Thread pool worker identifier |
Implements mysql::csa::Job.
|
overridevirtual |
Mark the transaction as done (done with failure or done successfully.
Reimplemented from mysql::csa::Job.
|
overridevirtual |
success callback
Reimplemented from mysql::csa::Job.
|
overridevirtual |
Skip this job, considered complete and done without failure.
Reimplemented from mysql::csa::Job.
|
protected |
The channel this transaction is coming from.
|
protected |
Information on how to fetch transaction data.
|
protected |
The first event fetched to obtain GTID information.
|
protected |
The cursor for the events to process.
|
protected |
Transaction phase indicator:
|
protected |
Statistics monitoring object for the current instance.
|
protected |
The GTID of the transaction. "<unknown>" if not available.