Drizzled Public API Documentation

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

List of all members.

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)
void run (void)
void markInErrorState ()
void clearErrorState ()
const std::string & getErrorMessage ()
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 *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
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 172 of file queue_producer.cc.

References drizzle_quit(), and drizzle_result_free().

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

Definition at line 49 of file sql_executor.cc.

bool slave::QueueProducer::init ( void  ) [virtual]

Do any initialization work.

Return values:
trueSuccess
falseFailure

Reimplemented from slave::QueueThread.

Definition at line 43 of file queue_producer.cc.

bool slave::QueueProducer::openConnection ( ) [private]

Open connection to the master server.

Definition at line 133 of file queue_producer.cc.

References drizzle_con_connect(), drizzle_con_create(), drizzle_con_set_auth(), drizzle_con_set_tcp(), drizzle_create(), and drizzle_error().

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 49 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 191 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 376 of file queue_producer.cc.

References drizzle_error(), drizzle_query_str(), drizzle_result_buffer(), drizzle_result_free(), and drizzle_row_next().

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 109 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 450 of file queue_producer.cc.

void slave::QueueProducer::shutdown ( void  ) [virtual]

Work to do at thread shutdown time.

Reimplemented from slave::QueueThread.

Definition at line 102 of file queue_producer.cc.


Member Data Documentation

Number of seconds to sleep between checking queue for messages

Definition at line 100 of file queue_producer.h.


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