Drizzled Public API Documentation

slave::QueueProducer Class Reference
Inheritance diagram for slave::QueueProducer:
slave::QueueThread slave::SQLExecutor

Public Member Functions

bool init ()
 
bool process ()
 
void shutdown ()
 
void setSleepInterval (uint32_t seconds)
 
uint32_t getSleepInterval ()
 
void setMasterHost (const std::string &host)
 
void setMasterPort (uint16_t port)
 
void setMasterUser (const std::string &user)
 
void setMasterPassword (const std::string &password)
 
void setMaxReconnectAttempts (uint32_t max)
 
void setSecondsBetweenReconnects (uint32_t seconds)
 
void setCachedMaxCommitId (uint64_t value)
 
uint64_t cachedMaxCommitId ()
 
void setMasterId (uint32_t value)
 
uint32_t masterId ()
 
void run (void)
 
void markInErrorState ()
 
void clearErrorState ()
 
const std::string & getErrorMessage () const
 
bool executeSQL (std::vector< std::string > &sql)
 

Protected Attributes

drizzled::Session::shared_ptr _session
 

Private Member Functions

bool openConnection ()
 
bool closeConnection ()
 
bool reconnect (bool initial_connection)
 
bool queryForMaxCommitId (uint64_t *max_commit_id)
 
enum drizzled::error_t queryForReplicationEvents (uint64_t max_commit_id)
 
bool queryForTrxIdList (uint64_t max_commit_id, std::vector< uint64_t > &list)
 
bool queueInsert (const char *trx_id, const char *seg_id, const char *commit_id, const char *originating_server_uuid, const char *originating_commit_id, const char *msg, const char *msg_length)
 
void setIOState (const std::string &err_msg, bool status)
 

Private Attributes

uint32_t _check_interval
 
std::string _master_host
 
uint16_t _master_port
 
std::string _master_user
 
std::string _master_pass
 
uint32_t _master_id
 
drizzle_st * _drizzle
 
drizzle_con_st * _connection
 
drizzle_return_t _last_return
 
bool _is_connected
 
uint64_t _saved_max_commit_id
 
uint32_t _max_reconnects
 
uint32_t _seconds_between_reconnects
 
std::string _last_error_message
 

Detailed Description

Definition at line 33 of file queue_producer.h.

Member Function Documentation

bool slave::QueueProducer::closeConnection ( )
private

Close connection to the master server.

Definition at line 183 of file queue_producer.cc.

bool slave::SQLExecutor::executeSQL ( std::vector< std::string > &  sql)
inherited

Execute a batch of SQL statements.

Parameters
sqlBatch of SQL statements to execute.
Return values
trueSuccess
falseFailure
bool slave::QueueProducer::init ( void  )
virtual

Do any initialization work.

Return values
trueSuccess
falseFailure

Reimplemented from slave::QueueThread.

Definition at line 46 of file queue_producer.cc.

bool slave::QueueProducer::openConnection ( )
private

Open connection to the master server.

Definition at line 144 of file queue_producer.cc.

bool slave::QueueProducer::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 52 of file queue_producer.cc.

bool slave::QueueProducer::queryForMaxCommitId ( uint64_t *  max_commit_id)
private

Get maximum commit ID that we have stored locally on the slave.

This method determines where this slave is in relation to the master, or, in other words, how "caught up" we are.

Parameters
[out]max_commit_idMaximum commit ID we have on this slave.

Definition at line 202 of file queue_producer.cc.

enum drizzled::error_t slave::QueueProducer::queryForReplicationEvents ( uint64_t  max_commit_id)
private

Get replication events/messages from the master.

Calling this method will a limited number of events from the master. It should be repeatedly called until it returns -1, which means there were no more events to retrieve.

Parameters
[in]max_commit_idLargest commit ID we have stored locally.
Return values
EE_OKSuccessfully retrieved events
ER_NONo errors, but no more events to retrieve
ER_YESError

Definition at line 404 of file queue_producer.cc.

bool slave::QueueProducer::reconnect ( bool  initial_connection)
private

Attempt to reconnect to the master server.

This method does not return until reconnect succeeds, or we exceed our maximum number of retries defined by _max_reconnects.

Return values
trueReconnect succeeded
falseReconnect failed

Definition at line 112 of file queue_producer.cc.

void slave::QueueProducer::setIOState ( const std::string &  err_msg,
bool  status 
)
private

Update IO thread status in state table.

Parameters
err_msgError message string
statusfalse = STOPPED, true = RUNNING

Definition at line 480 of file queue_producer.cc.

void slave::QueueProducer::shutdown ( )
virtual

Work to do at thread shutdown time.

Reimplemented from slave::QueueThread.

Definition at line 105 of file queue_producer.cc.

Member Data Documentation

uint32_t slave::QueueProducer::_check_interval
private

Number of seconds to sleep between checking queue for messages

Definition at line 117 of file queue_producer.h.


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