diff options
author | Andrei Elkin <andrei.elkin@mariadb.com> | 2017-11-27 21:06:17 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-12-18 13:43:38 +0200 |
commit | 529120e1cb5ca2dc2192b1e68b76538e0d1db145 (patch) | |
tree | 733dc1f70ceb0f0b54f90d6b084c284c96afd84b /sql | |
parent | f279d3c43aa7536b0f9bf46df8f4a3ef02918be0 (diff) | |
download | mariadb-git-529120e1cb5ca2dc2192b1e68b76538e0d1db145.tar.gz |
MDEV-13073. This patch is a followup of the previous one to convert the trailing underscore identifier to mariadb standard. For identifier representing class private members the underscore is replaced with a `m_` prefix. Otherwise `_` is just removed.bb-10.3-semisync
Diffstat (limited to 'sql')
-rw-r--r-- | sql/semisync.h | 6 | ||||
-rw-r--r-- | sql/semisync_master.cc | 282 | ||||
-rw-r--r-- | sql/semisync_master.h | 88 | ||||
-rw-r--r-- | sql/semisync_master_ack_receiver.h | 2 | ||||
-rw-r--r-- | sql/semisync_slave.cc | 8 | ||||
-rw-r--r-- | sql/semisync_slave.h | 22 |
6 files changed, 204 insertions, 204 deletions
diff --git a/sql/semisync.h b/sql/semisync.h index bf43ba5c8d8..9deb6c5fd01 100644 --- a/sql/semisync.h +++ b/sql/semisync.h @@ -33,13 +33,13 @@ public: static const unsigned long k_trace_detail; static const unsigned long k_trace_net_wait; - unsigned long trace_level_; /* the level for tracing */ + unsigned long m_trace_level; /* the level for tracing */ Trace() - :trace_level_(0L) + :m_trace_level(0L) {} Trace(unsigned long trace_level) - :trace_level_(trace_level) + :m_trace_level(trace_level) {} }; diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index 5b594d20c71..99d8b75ece8 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -74,29 +74,29 @@ static ulonglong timespec_to_usec(const struct timespec *ts) Active_tranx::Active_tranx(mysql_mutex_t *lock, ulong trace_level) - : Trace(trace_level), allocator_(max_connections), - num_entries_(max_connections << 1), /* Transaction hash table size + : Trace(trace_level), m_allocator(max_connections), + m_num_entries(max_connections << 1), /* Transaction hash table size * is set to double the size * of max_connections */ - lock_(lock) + m_lock(lock) { /* No transactions are in the list initially. */ - trx_front_ = NULL; - trx_rear_ = NULL; + m_trx_front = NULL; + m_trx_rear = NULL; /* Create the hash table to find a transaction's ending event. */ - trx_htb_ = new Tranx_node *[num_entries_]; - for (int idx = 0; idx < num_entries_; ++idx) - trx_htb_[idx] = NULL; + m_trx_htb = new Tranx_node *[m_num_entries]; + for (int idx = 0; idx < m_num_entries; ++idx) + m_trx_htb[idx] = NULL; sql_print_information("Semi-sync replication initialized for transactions."); } Active_tranx::~Active_tranx() { - delete [] trx_htb_; - trx_htb_ = NULL; - num_entries_ = 0; + delete [] m_trx_htb; + m_trx_htb = NULL; + m_num_entries = 0; } unsigned int Active_tranx::calc_hash(const unsigned char *key, @@ -121,7 +121,7 @@ unsigned int Active_tranx::get_hash_value(const char *log_file_name, unsigned int hash2 = calc_hash((const unsigned char *)(&log_file_pos), sizeof(log_file_pos)); - return (hash1 + hash2) % num_entries_; + return (hash1 + hash2) % m_num_entries; } int Active_tranx::compare(const char *log_file_name1, my_off_t log_file_pos1, @@ -148,7 +148,7 @@ int Active_tranx::insert_tranx_node(const char *log_file_name, DBUG_ENTER("Active_tranx:insert_tranx_node"); - ins_node = allocator_.allocate_node(); + ins_node = m_allocator.allocate_node(); if (!ins_node) { sql_print_error("%s: transaction node allocation failed for: (%s, %lu)", @@ -159,25 +159,25 @@ int Active_tranx::insert_tranx_node(const char *log_file_name, } /* insert the binlog position in the active transaction list. */ - strncpy(ins_node->log_name_, log_file_name, FN_REFLEN-1); - ins_node->log_name_[FN_REFLEN-1] = 0; /* make sure it ends properly */ - ins_node->log_pos_ = log_file_pos; + strncpy(ins_node->log_name, log_file_name, FN_REFLEN-1); + ins_node->log_name[FN_REFLEN-1] = 0; /* make sure it ends properly */ + ins_node->log_pos = log_file_pos; - if (!trx_front_) + if (!m_trx_front) { /* The list is empty. */ - trx_front_ = trx_rear_ = ins_node; + m_trx_front = m_trx_rear = ins_node; } else { - int cmp = compare(ins_node, trx_rear_); + int cmp = compare(ins_node, m_trx_rear); if (cmp > 0) { /* Compare with the tail first. If the transaction happens later in * binlog, then make it the new tail. */ - trx_rear_->next_ = ins_node; - trx_rear_ = ins_node; + m_trx_rear->next = ins_node; + m_trx_rear = ins_node; } else { @@ -186,20 +186,20 @@ int Active_tranx::insert_tranx_node(const char *log_file_name, */ sql_print_error("%s: binlog write out-of-order, tail (%s, %lu), " "new node (%s, %lu)", "Active_tranx:insert_tranx_node", - trx_rear_->log_name_, (ulong)trx_rear_->log_pos_, - ins_node->log_name_, (ulong)ins_node->log_pos_); + m_trx_rear->log_name, (ulong)m_trx_rear->log_pos, + ins_node->log_name, (ulong)ins_node->log_pos); result = -1; goto l_end; } } - hash_val = get_hash_value(ins_node->log_name_, ins_node->log_pos_); - ins_node->hash_next_ = trx_htb_[hash_val]; - trx_htb_[hash_val] = ins_node; + hash_val = get_hash_value(ins_node->log_name, ins_node->log_pos); + ins_node->hash_next = m_trx_htb[hash_val]; + m_trx_htb[hash_val] = ins_node; DBUG_PRINT("semisync", ("%s: insert (%s, %lu) in entry(%u)", "Active_tranx:insert_tranx_node", - ins_node->log_name_, (ulong)ins_node->log_pos_, + ins_node->log_name, (ulong)ins_node->log_pos, hash_val)); l_end: @@ -212,14 +212,14 @@ bool Active_tranx::is_tranx_end_pos(const char *log_file_name, DBUG_ENTER("Active_tranx::is_tranx_end_pos"); unsigned int hash_val = get_hash_value(log_file_name, log_file_pos); - Tranx_node *entry = trx_htb_[hash_val]; + Tranx_node *entry = m_trx_htb[hash_val]; while (entry != NULL) { if (compare(entry, log_file_name, log_file_pos) == 0) break; - entry = entry->hash_next_; + entry = entry->hash_next; } DBUG_PRINT("semisync", ("%s: probe (%s, %lu) in entry(%u)", @@ -238,13 +238,13 @@ int Active_tranx::clear_active_tranx_nodes(const char *log_file_name, if (log_file_name != NULL) { - new_front = trx_front_; + new_front = m_trx_front; while (new_front) { if (compare(new_front, log_file_name, log_file_pos) > 0) break; - new_front = new_front->next_; + new_front = new_front->next; } } else @@ -258,54 +258,54 @@ int Active_tranx::clear_active_tranx_nodes(const char *log_file_name, /* No active transaction nodes after the call. */ /* Clear the hash table. */ - memset(trx_htb_, 0, num_entries_ * sizeof(Tranx_node *)); - allocator_.free_all_nodes(); + memset(m_trx_htb, 0, m_num_entries * sizeof(Tranx_node *)); + m_allocator.free_all_nodes(); /* Clear the active transaction list. */ - if (trx_front_ != NULL) + if (m_trx_front != NULL) { - trx_front_ = NULL; - trx_rear_ = NULL; + m_trx_front = NULL; + m_trx_rear = NULL; } DBUG_PRINT("semisync", ("%s: cleared all nodes", "Active_tranx::::clear_active_tranx_nodes")); } - else if (new_front != trx_front_) + else if (new_front != m_trx_front) { Tranx_node *curr_node, *next_node; /* Delete all transaction nodes before the confirmation point. */ int n_frees = 0; - curr_node = trx_front_; + curr_node = m_trx_front; while (curr_node != new_front) { - next_node = curr_node->next_; + next_node = curr_node->next; n_frees++; /* Remove the node from the hash table. */ - unsigned int hash_val = get_hash_value(curr_node->log_name_, curr_node->log_pos_); - Tranx_node **hash_ptr = &(trx_htb_[hash_val]); + unsigned int hash_val = get_hash_value(curr_node->log_name, curr_node->log_pos); + Tranx_node **hash_ptr = &(m_trx_htb[hash_val]); while ((*hash_ptr) != NULL) { if ((*hash_ptr) == curr_node) { - (*hash_ptr) = curr_node->hash_next_; + (*hash_ptr) = curr_node->hash_next; break; } - hash_ptr = &((*hash_ptr)->hash_next_); + hash_ptr = &((*hash_ptr)->hash_next); } curr_node = next_node; } - trx_front_ = new_front; - allocator_.free_nodes_before(trx_front_); + m_trx_front = new_front; + m_allocator.free_nodes_before(m_trx_front); DBUG_PRINT("semisync", ("%s: cleared %d nodes back until pos (%s, %lu)", "Active_tranx::::clear_active_tranx_nodes", n_frees, - trx_front_->log_name_, (ulong)trx_front_->log_pos_)); + m_trx_front->log_name, (ulong)m_trx_front->log_pos)); } DBUG_RETURN(0); @@ -336,26 +336,26 @@ int Active_tranx::clear_active_tranx_nodes(const char *log_file_name, ******************************************************************************/ Repl_semi_sync_master::Repl_semi_sync_master() - : active_tranxs_(NULL), - init_done_(false), - reply_file_name_inited_(false), - reply_file_pos_(0L), - wait_file_name_inited_(false), - wait_file_pos_(0), - master_enabled_(false), - wait_timeout_(0L), - state_(0), - wait_point_(0) + : m_active_tranxs(NULL), + m_init_done(false), + m_reply_file_name_inited(false), + m_reply_file_pos(0L), + m_wait_file_name_inited(false), + m_wait_file_pos(0), + m_master_enabled(false), + m_wait_timeout(0L), + m_state(0), + m_wait_point(0) { - strcpy(reply_file_name_, ""); - strcpy(wait_file_name_, ""); + strcpy(m_reply_file_name, ""); + strcpy(m_wait_file_name, ""); } int Repl_semi_sync_master::init_object() { int result; - init_done_ = true; + m_init_done = true; /* References to the parameter works after set_options(). */ set_wait_timeout(rpl_semi_sync_master_timeout); @@ -398,15 +398,15 @@ int Repl_semi_sync_master::enable_master() if (!get_master_enabled()) { - active_tranxs_ = new Active_tranx(&LOCK_binlog, trace_level_); - if (active_tranxs_ != NULL) + m_active_tranxs = new Active_tranx(&LOCK_binlog, m_trace_level); + if (m_active_tranxs != NULL) { - commit_file_name_inited_ = false; - reply_file_name_inited_ = false; - wait_file_name_inited_ = false; + m_commit_file_name_inited = false; + m_reply_file_name_inited = false; + m_wait_file_name_inited = false; set_master_enabled(true); - state_ = true; + m_state = true; sql_print_information("Semi-sync replication enabled on the master."); } else @@ -433,13 +433,13 @@ int Repl_semi_sync_master::disable_master() */ switch_off(); - assert(active_tranxs_ != NULL); - delete active_tranxs_; - active_tranxs_ = NULL; + assert(m_active_tranxs != NULL); + delete m_active_tranxs; + m_active_tranxs = NULL; - reply_file_name_inited_ = false; - wait_file_name_inited_ = false; - commit_file_name_inited_ = false; + m_reply_file_name_inited = false; + m_wait_file_name_inited = false; + m_commit_file_name_inited = false; set_master_enabled(false); sql_print_information("Semi-sync replication disabled on the master."); @@ -452,14 +452,14 @@ int Repl_semi_sync_master::disable_master() void Repl_semi_sync_master::cleanup() { - if (init_done_) + if (m_init_done) { mysql_mutex_destroy(&LOCK_binlog); mysql_cond_destroy(&COND_binlog_send); - init_done_= 0; + m_init_done= 0; } - delete active_tranxs_; + delete m_active_tranxs; } void Repl_semi_sync_master::lock() @@ -592,10 +592,10 @@ int Repl_semi_sync_master::report_reply_binlog(uint32 server_id, * sync replication slaves. So, if any one of them get the transaction, * the transaction session in the primary can move forward. */ - if (reply_file_name_inited_) + if (m_reply_file_name_inited) { cmp = Active_tranx::compare(log_file_name, log_file_pos, - reply_file_name_, reply_file_pos_); + m_reply_file_name, m_reply_file_pos); /* If the requested position is behind the sending binlog position, * would not adjust sending binlog position. @@ -614,13 +614,13 @@ int Repl_semi_sync_master::report_reply_binlog(uint32 server_id, if (need_copy_send_pos) { - strmake_buf(reply_file_name_, log_file_name); - reply_file_pos_ = log_file_pos; - reply_file_name_inited_ = true; + strmake_buf(m_reply_file_name, log_file_name); + m_reply_file_pos = log_file_pos; + m_reply_file_name_inited = true; /* Remove all active transaction nodes before this point. */ - assert(active_tranxs_ != NULL); - active_tranxs_->clear_active_tranx_nodes(log_file_name, log_file_pos); + assert(m_active_tranxs != NULL); + m_active_tranxs->clear_active_tranx_nodes(log_file_name, log_file_pos); DBUG_PRINT("semisync", ("%s: Got reply at (%s, %lu)", "Repl_semi_sync_master::report_reply_binlog", @@ -632,15 +632,15 @@ int Repl_semi_sync_master::report_reply_binlog(uint32 server_id, /* Let us check if some of the waiting threads doing a trx * commit can now proceed. */ - cmp = Active_tranx::compare(reply_file_name_, reply_file_pos_, - wait_file_name_, wait_file_pos_); + cmp = Active_tranx::compare(m_reply_file_name, m_reply_file_pos, + m_wait_file_name, m_wait_file_pos); if (cmp >= 0) { /* Yes, at least one waiting thread can now proceed: * let us release all waiting threads with a broadcast */ can_release_threads = true; - wait_file_name_inited_ = false; + m_wait_file_name_inited = false; } } @@ -811,9 +811,9 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, while (is_on() && !thd_killed(current_thd)) { - if (reply_file_name_inited_) + if (m_reply_file_name_inited) { - int cmp = Active_tranx::compare(reply_file_name_, reply_file_pos_, + int cmp = Active_tranx::compare(m_reply_file_name, m_reply_file_pos, trx_wait_binlog_name, trx_wait_binlog_pos); if (cmp >= 0) @@ -823,8 +823,8 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, */ DBUG_PRINT("semisync", ("%s: Binlog reply is ahead (%s, %lu),", "Repl_semi_sync_master::commit_trx", - reply_file_name_, - (ulong)reply_file_pos_)); + m_reply_file_name, + (ulong)m_reply_file_pos)); break; } } @@ -832,37 +832,37 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, /* Let us update the info about the minimum binlog position of waiting * threads. */ - if (wait_file_name_inited_) + if (m_wait_file_name_inited) { int cmp = Active_tranx::compare(trx_wait_binlog_name, trx_wait_binlog_pos, - wait_file_name_, wait_file_pos_); + m_wait_file_name, m_wait_file_pos); if (cmp <= 0) { /* This thd has a lower position, let's update the minimum info. */ - strmake_buf(wait_file_name_, trx_wait_binlog_name); - wait_file_pos_ = trx_wait_binlog_pos; + strmake_buf(m_wait_file_name, trx_wait_binlog_name); + m_wait_file_pos = trx_wait_binlog_pos; rpl_semi_sync_master_wait_pos_backtraverse++; DBUG_PRINT("semisync", ("%s: move back wait position (%s, %lu),", "Repl_semi_sync_master::commit_trx", - wait_file_name_, (ulong)wait_file_pos_)); + m_wait_file_name, (ulong)m_wait_file_pos)); } } else { - strmake_buf(wait_file_name_, trx_wait_binlog_name); - wait_file_pos_ = trx_wait_binlog_pos; - wait_file_name_inited_ = true; + strmake_buf(m_wait_file_name, trx_wait_binlog_name); + m_wait_file_pos = trx_wait_binlog_pos; + m_wait_file_name_inited = true; DBUG_PRINT("semisync", ("%s: init wait position (%s, %lu),", "Repl_semi_sync_master::commit_trx", - wait_file_name_, (ulong)wait_file_pos_)); + m_wait_file_name, (ulong)m_wait_file_pos)); } /* Calcuate the waiting period. */ - long diff_secs = (long) (wait_timeout_ / TIME_THOUSAND); - long diff_nsecs = (long) ((wait_timeout_ % TIME_THOUSAND) * TIME_MILLION); + long diff_secs = (long) (m_wait_timeout / TIME_THOUSAND); + long diff_nsecs = (long) ((m_wait_timeout % TIME_THOUSAND) * TIME_MILLION); long nsecs = start_ts.tv_nsec + diff_nsecs; abstime.tv_sec = start_ts.tv_sec + diff_secs + nsecs/TIME_BILLION; abstime.tv_nsec = nsecs % TIME_BILLION; @@ -879,8 +879,8 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, DBUG_PRINT("semisync", ("%s: wait %lu ms for binlog sent (%s, %lu)", "Repl_semi_sync_master::commit_trx", - wait_timeout_, - wait_file_name_, (ulong)wait_file_pos_)); + m_wait_timeout, + m_wait_file_name, (ulong)m_wait_file_pos)); wait_result = cond_timewait(&abstime); rpl_semi_sync_master_wait_sessions--; @@ -891,7 +891,7 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, sql_print_warning("Timeout waiting for reply of binlog (file: %s, pos: %lu), " "semi-sync up to file %s, position %lu.", trx_wait_binlog_name, (ulong)trx_wait_binlog_pos, - reply_file_name_, (ulong)reply_file_pos_); + m_reply_file_name, (ulong)m_reply_file_pos); rpl_semi_sync_master_wait_timeouts++; /* switch semi-sync off */ @@ -921,11 +921,11 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name, /* At this point, the binlog file and position of this transaction must have been removed from Active_tranx. - active_tranxs_ may be NULL if someone disabled semi sync during + m_active_tranxs may be NULL if someone disabled semi sync during cond_timewait() */ - assert(thd_killed(current_thd) || !active_tranxs_ || - !active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, + assert(thd_killed(current_thd) || !m_active_tranxs || + !m_active_tranxs->is_tranx_end_pos(trx_wait_binlog_name, trx_wait_binlog_pos)); l_end: @@ -967,15 +967,15 @@ int Repl_semi_sync_master::switch_off() DBUG_ENTER("Repl_semi_sync_master::switch_off"); - state_ = false; + m_state = false; /* Clear the active transaction list. */ - assert(active_tranxs_ != NULL); - result = active_tranxs_->clear_active_tranx_nodes(NULL, 0); + assert(m_active_tranxs != NULL); + result = m_active_tranxs->clear_active_tranx_nodes(NULL, 0); rpl_semi_sync_master_off_times++; - wait_file_name_inited_ = false; - reply_file_name_inited_ = false; + m_wait_file_name_inited = false; + m_reply_file_name_inited = false; sql_print_information("Semi-sync replication switched OFF."); cond_broadcast(); /* wake up all waiting threads */ @@ -993,13 +993,13 @@ int Repl_semi_sync_master::try_switch_on(int server_id, /* If the current sending event's position is larger than or equal to the * 'largest' commit transaction binlog position, the slave is already * catching up now and we can switch semi-sync on here. - * If commit_file_name_inited_ indicates there are no recent transactions, + * If m_commit_file_name_inited indicates there are no recent transactions, * we can enable semi-sync immediately. */ - if (commit_file_name_inited_) + if (m_commit_file_name_inited) { int cmp = Active_tranx::compare(log_file_name, log_file_pos, - commit_file_name_, commit_file_pos_); + m_commit_file_name, m_commit_file_pos); semi_sync_on = (cmp >= 0); } else @@ -1010,7 +1010,7 @@ int Repl_semi_sync_master::try_switch_on(int server_id, if (semi_sync_on) { /* Switch semi-sync replication on. */ - state_ = true; + m_state = true; sql_print_information("Semi-sync replication switched ON with slave (server_id: %d) " "at (%s, %lu)", @@ -1066,10 +1066,10 @@ int Repl_semi_sync_master::update_sync_header(THD* thd, unsigned char *packet, /* semi-sync is ON */ sync = false; /* No sync unless a transaction is involved. */ - if (reply_file_name_inited_) + if (m_reply_file_name_inited) { cmp = Active_tranx::compare(log_file_name, log_file_pos, - reply_file_name_, reply_file_pos_); + m_reply_file_name, m_reply_file_pos); if (cmp <= 0) { /* If we have already got the reply for the event, then we do @@ -1079,10 +1079,10 @@ int Repl_semi_sync_master::update_sync_header(THD* thd, unsigned char *packet, } } - if (wait_file_name_inited_) + if (m_wait_file_name_inited) { cmp = Active_tranx::compare(log_file_name, log_file_pos, - wait_file_name_, wait_file_pos_); + m_wait_file_name, m_wait_file_pos); } else { @@ -1097,17 +1097,17 @@ int Repl_semi_sync_master::update_sync_header(THD* thd, unsigned char *packet, /* * We only wait if the event is a transaction's ending event. */ - assert(active_tranxs_ != NULL); - sync = active_tranxs_->is_tranx_end_pos(log_file_name, + assert(m_active_tranxs != NULL); + sync = m_active_tranxs->is_tranx_end_pos(log_file_name, log_file_pos); } } else { - if (commit_file_name_inited_) + if (m_commit_file_name_inited) { int cmp = Active_tranx::compare(log_file_name, log_file_pos, - commit_file_name_, commit_file_pos_); + m_commit_file_name, m_commit_file_pos); sync = (cmp >= 0); } else @@ -1151,35 +1151,35 @@ int Repl_semi_sync_master::write_tranx_in_binlog(const char* log_file_name, /* Update the 'largest' transaction commit position seen so far even * though semi-sync is switched off. - * It is much better that we update commit_file_* here, instead of + * It is much better that we update m_commit_file* here, instead of * inside commit_trx(). This is mostly because update_sync_header() - * will watch for commit_file_* to decide whether to switch semi-sync + * will watch for m_commit_file* to decide whether to switch semi-sync * on. The detailed reason is explained in function update_sync_header(). */ - if (commit_file_name_inited_) + if (m_commit_file_name_inited) { int cmp = Active_tranx::compare(log_file_name, log_file_pos, - commit_file_name_, commit_file_pos_); + m_commit_file_name, m_commit_file_pos); if (cmp > 0) { /* This is a larger position, let's update the maximum info. */ - strncpy(commit_file_name_, log_file_name, FN_REFLEN-1); - commit_file_name_[FN_REFLEN-1] = 0; /* make sure it ends properly */ - commit_file_pos_ = log_file_pos; + strncpy(m_commit_file_name, log_file_name, FN_REFLEN-1); + m_commit_file_name[FN_REFLEN-1] = 0; /* make sure it ends properly */ + m_commit_file_pos = log_file_pos; } } else { - strncpy(commit_file_name_, log_file_name, FN_REFLEN-1); - commit_file_name_[FN_REFLEN-1] = 0; /* make sure it ends properly */ - commit_file_pos_ = log_file_pos; - commit_file_name_inited_ = true; + strncpy(m_commit_file_name, log_file_name, FN_REFLEN-1); + m_commit_file_name[FN_REFLEN-1] = 0; /* make sure it ends properly */ + m_commit_file_pos = log_file_pos; + m_commit_file_name_inited = true; } if (is_on()) { - assert(active_tranxs_ != NULL); - if(active_tranxs_->insert_tranx_node(log_file_name, log_file_pos)) + assert(m_active_tranxs != NULL); + if(m_active_tranxs->insert_tranx_node(log_file_name, log_file_pos)) { /* if insert tranx_node failed, print a warning message @@ -1254,13 +1254,13 @@ int Repl_semi_sync_master::after_reset_master() if (rpl_semi_sync_master_clients == 0 && !rpl_semi_sync_master_wait_no_slave) - state_ = 0; + m_state = 0; else - state_ = get_master_enabled()? 1 : 0; + m_state = get_master_enabled()? 1 : 0; - wait_file_name_inited_ = false; - reply_file_name_inited_ = false; - commit_file_name_inited_ = false; + m_wait_file_name_inited = false; + m_reply_file_name_inited = false; + m_commit_file_name_inited = false; rpl_semi_sync_master_yes_transactions = 0; rpl_semi_sync_master_no_transactions = 0; @@ -1306,7 +1306,7 @@ void Repl_semi_sync_master::set_export_stats() { lock(); - rpl_semi_sync_master_status = state_; + rpl_semi_sync_master_status = m_state; rpl_semi_sync_master_avg_trx_wait_time= ((rpl_semi_sync_master_trx_wait_num) ? (ulong)((double)rpl_semi_sync_master_trx_wait_time / diff --git a/sql/semisync_master.h b/sql/semisync_master.h index 97c5d01a1d5..a58c1a7ae6e 100644 --- a/sql/semisync_master.h +++ b/sql/semisync_master.h @@ -28,10 +28,10 @@ extern PSI_cond_key key_COND_binlog_send; #endif struct Tranx_node { - char log_name_[FN_REFLEN]; - my_off_t log_pos_; - struct Tranx_node *next_; /* the next node in the sorted list */ - struct Tranx_node *hash_next_; /* the next node during hash collision */ + char log_name[FN_REFLEN]; + my_off_t log_pos; + struct Tranx_node *next; /* the next node in the sorted list */ + struct Tranx_node *hash_next; /* the next node during hash collision */ }; /** @@ -123,10 +123,10 @@ public: } trx_node= &(current_block->nodes[++last_node]); - trx_node->log_name_[0] = '\0'; - trx_node->log_pos_= 0; - trx_node->next_= 0; - trx_node->hash_next_= 0; + trx_node->log_name[0] = '\0'; + trx_node->log_pos= 0; + trx_node->next= 0; + trx_node->hash_next= 0; return trx_node; } @@ -299,14 +299,14 @@ class Active_tranx :public Trace { private: - Tranx_node_allocator allocator_; + Tranx_node_allocator m_allocator; /* These two record the active transaction list in sort order. */ - Tranx_node *trx_front_, *trx_rear_; + Tranx_node *m_trx_front, *m_trx_rear; - Tranx_node **trx_htb_; /* A hash table on active transactions. */ + Tranx_node **m_trx_htb; /* A hash table on active transactions. */ - int num_entries_; /* maximum hash table entries */ - mysql_mutex_t *lock_; /* mutex lock */ + int m_num_entries; /* maximum hash table entries */ + mysql_mutex_t *m_lock; /* mutex lock */ inline void assert_lock_owner(); @@ -316,16 +316,16 @@ private: int compare(const char *log_file_name1, my_off_t log_file_pos1, const Tranx_node *node2) { return compare(log_file_name1, log_file_pos1, - node2->log_name_, node2->log_pos_); + node2->log_name, node2->log_pos); } int compare(const Tranx_node *node1, const char *log_file_name2, my_off_t log_file_pos2) { - return compare(node1->log_name_, node1->log_pos_, + return compare(node1->log_name, node1->log_pos, log_file_name2, log_file_pos2); } int compare(const Tranx_node *node1, const Tranx_node *node2) { - return compare(node1->log_name_, node1->log_pos_, - node2->log_name_, node2->log_pos_); + return compare(node1->log_name, node1->log_pos, + node2->log_name, node2->log_pos); } public: @@ -369,11 +369,11 @@ public: class Repl_semi_sync_master :public Repl_semi_sync_base { private: - Active_tranx *active_tranxs_; /* active transaction list: the list will + Active_tranx *m_active_tranxs; /* active transaction list: the list will be cleared when semi-sync switches off. */ /* True when init_object has been called */ - bool init_done_; + bool m_init_done; /* This cond variable is signaled when enough binlog has been sent to slave, * so that a waiting trx can return the 'ok' to the client for a commit. @@ -383,32 +383,32 @@ class Repl_semi_sync_master /* Mutex that protects the following state variables and the active * transaction list. * Under no cirumstances we can acquire mysql_bin_log.LOCK_log if we are - * already holding LOCK_binlog_ because it can cause deadlocks. + * already holding m_LOCK_binlog because it can cause deadlocks. */ mysql_mutex_t LOCK_binlog; - /* This is set to true when reply_file_name_ contains meaningful data. */ - bool reply_file_name_inited_; + /* This is set to true when m_reply_file_name contains meaningful data. */ + bool m_reply_file_name_inited; /* The binlog name up to which we have received replies from any slaves. */ - char reply_file_name_[FN_REFLEN]; + char m_reply_file_name[FN_REFLEN]; /* The position in that file up to which we have the reply from any slaves. */ - my_off_t reply_file_pos_; + my_off_t m_reply_file_pos; /* This is set to true when we know the 'smallest' wait position. */ - bool wait_file_name_inited_; + bool m_wait_file_name_inited; /* NULL, or the 'smallest' filename that a transaction is waiting for * slave replies. */ - char wait_file_name_[FN_REFLEN]; + char m_wait_file_name[FN_REFLEN]; /* The smallest position in that file that a trx is waiting for: the trx * can proceed and send an 'ok' to the client when the master has got the * reply from the slave indicating that it already got the binlog events. */ - my_off_t wait_file_pos_; + my_off_t m_wait_file_pos; /* This is set to true when we know the 'largest' transaction commit * position in the binlog file. @@ -417,22 +417,22 @@ class Repl_semi_sync_master * switch off. Binlog-dump thread can use the three fields to detect when * slaves catch up on replication so that semi-sync can switch on again. */ - bool commit_file_name_inited_; + bool m_commit_file_name_inited; /* The 'largest' binlog filename that a commit transaction is seeing. */ - char commit_file_name_[FN_REFLEN]; + char m_commit_file_name[FN_REFLEN]; /* The 'largest' position in that file that a commit transaction is seeing. */ - my_off_t commit_file_pos_; + my_off_t m_commit_file_pos; /* All global variables which can be set by parameters. */ - volatile bool master_enabled_; /* semi-sync is enabled on the master */ - unsigned long wait_timeout_; /* timeout period(ms) during tranx wait */ + volatile bool m_master_enabled; /* semi-sync is enabled on the master */ + unsigned long m_wait_timeout; /* timeout period(ms) during tranx wait */ - bool state_; /* whether semi-sync is switched */ + bool m_state; /* whether semi-sync is switched */ /*Waiting for ACK before/after innodb commit*/ - ulong wait_point_; + ulong m_wait_point; void lock(); void unlock(); @@ -441,11 +441,11 @@ class Repl_semi_sync_master /* Is semi-sync replication on? */ bool is_on() { - return (state_); + return (m_state); } void set_master_enabled(bool enabled) { - master_enabled_ = enabled; + m_master_enabled = enabled; } /* Switch semi-sync off because of timeout in transaction waiting. */ @@ -462,28 +462,28 @@ class Repl_semi_sync_master void cleanup(); bool get_master_enabled() { - return master_enabled_; + return m_master_enabled; } void set_trace_level(unsigned long trace_level) { - trace_level_ = trace_level; - if (active_tranxs_) - active_tranxs_->trace_level_ = trace_level; + m_trace_level = trace_level; + if (m_active_tranxs) + m_active_tranxs->m_trace_level = trace_level; } /* Set the transaction wait timeout period, in milliseconds. */ void set_wait_timeout(unsigned long wait_timeout) { - wait_timeout_ = wait_timeout; + m_wait_timeout = wait_timeout; } /*set the ACK point, after binlog sync or after transaction commit*/ void set_wait_point(unsigned long ack_point) { - wait_point_ = ack_point; + m_wait_point = ack_point; } ulong wait_point() //no cover line { - return wait_point_; //no cover line + return m_wait_point; //no cover line } /* Initialize this class after MySQL parameters are initialized. this @@ -549,7 +549,7 @@ class Repl_semi_sync_master /*Wait after the transaction is rollback*/ int wait_after_rollback(THD *thd, bool all); - /*Store the current binlog position in active_tranxs_. This position should + /*Store the current binlog position in m_active_tranxs. This position should * be acked by slave*/ int report_binlog_update(THD *thd, const char *log_file,my_off_t log_pos); diff --git a/sql/semisync_master_ack_receiver.h b/sql/semisync_master_ack_receiver.h index 9e876150f58..619748a2159 100644 --- a/sql/semisync_master_ack_receiver.h +++ b/sql/semisync_master_ack_receiver.h @@ -78,7 +78,7 @@ public: void set_trace_level(unsigned long trace_level) { - trace_level_= trace_level; + m_trace_level= trace_level; } private: enum status {ST_UP, ST_DOWN, ST_STOPPING}; diff --git a/sql/semisync_slave.cc b/sql/semisync_slave.cc index fbec0c13b96..2d77ee7b10c 100644 --- a/sql/semisync_slave.cc +++ b/sql/semisync_slave.cc @@ -41,7 +41,7 @@ int Repl_semi_sync_slave::init_object() { int result= 0; - init_done_ = true; + m_init_done = true; /* References to the parameter works after set_options(). */ set_slave_enabled(rpl_semi_sync_slave_enabled); @@ -134,9 +134,9 @@ void Repl_semi_sync_slave::kill_connection(MYSQL *mysql) char kill_buffer[30]; MYSQL *kill_mysql = NULL; kill_mysql = mysql_init(kill_mysql); - mysql_options(kill_mysql, MYSQL_OPT_CONNECT_TIMEOUT, &kill_conn_timeout_); - mysql_options(kill_mysql, MYSQL_OPT_READ_TIMEOUT, &kill_conn_timeout_); - mysql_options(kill_mysql, MYSQL_OPT_WRITE_TIMEOUT, &kill_conn_timeout_); + mysql_options(kill_mysql, MYSQL_OPT_CONNECT_TIMEOUT, &m_kill_conn_timeout); + mysql_options(kill_mysql, MYSQL_OPT_READ_TIMEOUT, &m_kill_conn_timeout); + mysql_options(kill_mysql, MYSQL_OPT_WRITE_TIMEOUT, &m_kill_conn_timeout); bool ret= (!mysql_real_connect(kill_mysql, mysql->host, mysql->user, mysql->passwd,0, mysql->port, mysql->unix_socket, 0)); diff --git a/sql/semisync_slave.h b/sql/semisync_slave.h index e781077a3a9..d65262f151d 100644 --- a/sql/semisync_slave.h +++ b/sql/semisync_slave.h @@ -32,11 +32,11 @@ class Master_info; class Repl_semi_sync_slave :public Repl_semi_sync_base { public: - Repl_semi_sync_slave() :slave_enabled_(false) {} + Repl_semi_sync_slave() :m_slave_enabled(false) {} ~Repl_semi_sync_slave() {} void set_trace_level(unsigned long trace_level) { - trace_level_ = trace_level; + m_trace_level = trace_level; } /* Initialize this class after MySQL parameters are initialized. this @@ -45,23 +45,23 @@ public: int init_object(); bool get_slave_enabled() { - return slave_enabled_; + return m_slave_enabled; } void set_slave_enabled(bool enabled) { - slave_enabled_ = enabled; + m_slave_enabled = enabled; } bool is_delay_master(){ - return delay_master_; + return m_delay_master; } void set_delay_master(bool enabled) { - delay_master_ = enabled; + m_delay_master = enabled; } void set_kill_conn_timeout(unsigned int timeout) { - kill_conn_timeout_ = timeout; + m_kill_conn_timeout = timeout; } /* A slave reads the semi-sync packet header and separate the metadata @@ -95,10 +95,10 @@ public: private: /* True when init_object has been called */ - bool init_done_; - bool slave_enabled_; /* semi-sycn is enabled on the slave */ - bool delay_master_; - unsigned int kill_conn_timeout_; + bool m_init_done; + bool m_slave_enabled; /* semi-sycn is enabled on the slave */ + bool m_delay_master; + unsigned int m_kill_conn_timeout; }; |