Skip to content

Commit

Permalink
Relay_log_info::executed_entries to Atomic_counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vojtovich committed Apr 15, 2020
1 parent c1bdf62 commit 5876ed9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
10 changes: 0 additions & 10 deletions include/my_pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,16 +827,6 @@ static inline void thread_safe_decrement32(int32 *value)
(void) my_atomic_add32_explicit(value, -1, MY_MEMORY_ORDER_RELAXED);
}

static inline void thread_safe_increment64(int64 *value)
{
(void) my_atomic_add64_explicit(value, 1, MY_MEMORY_ORDER_RELAXED);
}

static inline void thread_safe_decrement64(int64 *value)
{
(void) my_atomic_add64_explicit(value, -1, MY_MEMORY_ORDER_RELAXED);
}

/*
No locking needed, the counter is owned by the thread
*/
Expand Down
2 changes: 1 addition & 1 deletion sql/rpl_parallel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rpt_handle_event(rpl_parallel_thread::queued_event *qev,
rgi->last_master_timestamp= ev->when + (time_t)ev->exec_time;
err= apply_event_and_update_pos_for_parallel(ev, thd, rgi);

thread_safe_increment64(&rli->executed_entries);
rli->executed_entries++;
#ifdef WITH_WSREP
if (wsrep_after_statement(thd))
{
Expand Down
2 changes: 1 addition & 1 deletion sql/rpl_rli.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class Relay_log_info : public Slave_reporting_capability
Number of executed events for SLAVE STATUS.
Protected by slave_executed_entries_lock
*/
int64 executed_entries;
Atomic_counter<uint32_t> executed_entries;

/*
If the end of the hot relay log is made of master's events ignored by the
Expand Down
4 changes: 2 additions & 2 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3438,7 +3438,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
{
protocol->store((uint32) mi->rli.retried_trans);
protocol->store((ulonglong) mi->rli.max_relay_log_size);
protocol->store((uint32) mi->rli.executed_entries);
protocol->store(mi->rli.executed_entries);
protocol->store((uint32) mi->received_heartbeats);
protocol->store((double) mi->heartbeat_period, 3, &tmp);
protocol->store(gtid_pos->ptr(), gtid_pos->length(), &my_charset_bin);
Expand Down Expand Up @@ -4537,7 +4537,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
}
}

thread_safe_increment64(&rli->executed_entries);
rli->executed_entries++;
#ifdef WITH_WSREP
wsrep_after_statement(thd);
#endif /* WITH_WSREP */
Expand Down

0 comments on commit 5876ed9

Please sign in to comment.