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 |
Definition at line 33 of file queue_producer.h.
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.
sql | Batch of SQL statements to execute. |
true | Success |
false | Failure |
Definition at line 49 of file sql_executor.cc.
bool slave::QueueProducer::init | ( | void | ) | [virtual] |
Do any initialization work.
true | Success |
false | Failure |
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.
true | Success |
false | Failure |
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.
[out] | max_commit_id | Maximum 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.
[in] | max_commit_id | Largest commit ID we have stored locally. |
EE_OK | Successfully retrieved events |
ER_NO | No errors, but no more events to retrieve |
ER_YES | Error |
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.
true | Reconnect succeeded |
false | Reconnect 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.
err_msg | Error message string |
status | false = 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.
uint32_t slave::QueueProducer::_check_interval [private] |
Number of seconds to sleep between checking queue for messages
Definition at line 100 of file queue_producer.h.