drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
slave::QueueConsumer Class Reference
Inheritance diagram for slave::QueueConsumer:
[legend]
Collaboration diagram for slave::QueueConsumer:
[legend]

Public Member Functions

bool init ()
bool process ()
void shutdown ()
void setSleepInterval (uint32_t seconds)
uint32_t getSleepInterval ()
void setIgnoreErrors (bool value)
void setApplierState (const std::string &err_msg, bool status)
void addMasterId (uint32_t id)
bool processSingleMaster (const std::string &master_id)
Public Member Functions inherited from slave::QueueThread
void run (void)
Public Member Functions inherited from slave::SQLExecutor
 SQLExecutor (const std::string &user, const std::string &schema)
void markInErrorState ()
void clearErrorState ()
const std::string & getErrorMessage () const
bool executeSQL (std::vector< std::string > &sql)

Private Types

typedef std::vector< uint64_t > TrxIdList

Private Member Functions

bool getListOfCompletedTransactions (const std::string &master_id, TrxIdList &list)
bool getMessage (drizzled::message::Transaction &transaction, std::string &commit_id, const std::string &master_id, uint64_t trx_id, std::string &originating_server_uuid, uint64_t &originating_commit_id, uint32_t segment_id)
bool convertToSQL (const drizzled::message::Transaction &transaction, std::vector< std::string > &aggregate_sql, std::vector< std::string > &segmented_sql)
bool executeSQLWithCommitId (std::vector< std::string > &sql, const std::string &commit_id, const std::string &originating_server_uuid, uint64_t originating_commit_id, const std::string &master_id)
bool deleteFromQueue (const std::string &master_id, uint64_t trx_id)
bool isEndStatement (const drizzled::message::Statement &statement)

Private Attributes

uint32_t _check_interval
std::vector< uint32_t > _master_ids
bool _ignore_errors

Additional Inherited Members

Protected Attributes inherited from slave::SQLExecutor
drizzled::Session::shared_ptr _session

Detailed Description

Definition at line 39 of file queue_consumer.h.

Member Typedef Documentation

◆ TrxIdList

typedef std::vector<uint64_t> slave::QueueConsumer::TrxIdList
private

Definition at line 87 of file queue_consumer.h.

Constructor & Destructor Documentation

◆ QueueConsumer()

slave::QueueConsumer::QueueConsumer ( )
inline

Definition at line 42 of file queue_consumer.h.

Member Function Documentation

◆ addMasterId()

void slave::QueueConsumer::addMasterId ( uint32_t id)
inline

Definition at line 79 of file queue_consumer.h.

◆ convertToSQL()

bool slave::QueueConsumer::convertToSQL ( const drizzled::message::Transaction & transaction,
std::vector< std::string > & aggregate_sql,
std::vector< std::string > & segmented_sql )
private

Convert the given Transaction message into equivalent SQL.

Parameters
[in]transactionTransaction protobuf message to convert.
[in,out]aggregate_sqlBuffer for total SQL for this transaction.
[in,out]segmented_sqlBuffer for carried over segmented statements.
Return values
trueSuccess
falseFailure

Definition at line 264 of file queue_consumer.cc.

◆ deleteFromQueue()

bool slave::QueueConsumer::deleteFromQueue ( const std::string & master_id,
uint64_t trx_id )
private

Remove messages for a given transaction from the queue.

Parameters
trx_idTransaction ID for the messages to remove.
Return values
trueSuccess
falseFailure

Definition at line 448 of file queue_consumer.cc.

◆ executeSQLWithCommitId()

bool slave::QueueConsumer::executeSQLWithCommitId ( std::vector< std::string > & sql,
const std::string & commit_id,
const std::string & originating_server_uuid,
uint64_t originating_commit_id,
const std::string & master_id )
private

Execute a batch of SQL statements.

Parameters
sqlBatch of SQL statements to execute.
commit_idCommit ID value to store in state table.
originating_server_uuidServer ID of the master where this SQL was originally applied.
originating_commit_idCommit ID of the master where this SQL was originally applied.
Return values
trueSuccess
falseFailure

Definition at line 422 of file queue_consumer.cc.

◆ getListOfCompletedTransactions()

bool slave::QueueConsumer::getListOfCompletedTransactions ( const std::string & master_id,
TrxIdList & list )
private

Get a list of transaction IDs from the queue that are complete.

A "complete" transaction is one in which we have received the end segment of the transaction.

Parameters
[in]master_idIdentifier of the master we are interested in.
[out]listThe list to populate with transaction IDs.
Return values
trueSuccess
falseError

Definition at line 230 of file queue_consumer.cc.

◆ getMessage()

bool slave::QueueConsumer::getMessage ( drizzled::message::Transaction & transaction,
std::string & commit_id,
const std::string & master_id,
uint64_t trx_id,
std::string & originating_server_uuid,
uint64_t & originating_commit_id,
uint32_t segment_id )
private

Definition at line 173 of file queue_consumer.cc.

◆ getSleepInterval()

uint32_t slave::QueueConsumer::getSleepInterval ( )
inlinevirtual

Implements slave::QueueThread.

Definition at line 58 of file queue_consumer.h.

◆ init()

bool slave::QueueConsumer::init ( )
virtual

Do any initialization work.

Return values
trueSuccess
falseFailure

Reimplemented from slave::QueueThread.

Definition at line 40 of file queue_consumer.cc.

◆ isEndStatement()

bool slave::QueueConsumer::isEndStatement ( const drizzled::message::Statement & statement)
private

Determine if a Statement message is an end message.

Return values
trueIs an end Statement message
falseIs NOT an end Statement message

Definition at line 341 of file queue_consumer.cc.

◆ process()

bool slave::QueueConsumer::process ( )
virtual

Method that actually does the work around the queue.

Returning 'false' from this method currently causes the thread to shutdown.

Return values
trueSuccess
falseFailure

Implements slave::QueueThread.

Definition at line 53 of file queue_consumer.cc.

◆ processSingleMaster()

bool slave::QueueConsumer::processSingleMaster ( const std::string & master_id)

Definition at line 69 of file queue_consumer.cc.

◆ setApplierState()

void slave::QueueConsumer::setApplierState ( const std::string & err_msg,
bool status )

Update applier status in state table.

Parameters
err_msgError message string
statusfalse = STOPPED, true = RUNNING

Definition at line 380 of file queue_consumer.cc.

◆ setIgnoreErrors()

void slave::QueueConsumer::setIgnoreErrors ( bool value)
inline

Determines if we should ignore errors from statements pulled from masters.

Definition at line 66 of file queue_consumer.h.

◆ setSleepInterval()

void slave::QueueConsumer::setSleepInterval ( uint32_t seconds)
inline

Definition at line 53 of file queue_consumer.h.

◆ shutdown()

void slave::QueueConsumer::shutdown ( )
virtual

Work to do at thread shutdown time.

Reimplemented from slave::QueueThread.

Definition at line 47 of file queue_consumer.cc.

Member Data Documentation

◆ _check_interval

uint32_t slave::QueueConsumer::_check_interval
private

Number of seconds to sleep between checking queue for messages

Definition at line 90 of file queue_consumer.h.

◆ _ignore_errors

bool slave::QueueConsumer::_ignore_errors
private

Definition at line 94 of file queue_consumer.h.

◆ _master_ids

std::vector<uint32_t> slave::QueueConsumer::_master_ids
private

Definition at line 92 of file queue_consumer.h.


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