Commit d2bdd789 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Master_info counters transition to Atomic_counter

parent 656a702c
......@@ -28,6 +28,9 @@ template <typename Type> class Atomic_counter
Type sub(Type i) { return m_counter.fetch_sub(i, std::memory_order_relaxed); }
public:
Atomic_counter(Type val): m_counter(val) {}
Atomic_counter() {}
Type operator++(int) { return add(1); }
Type operator--(int) { return sub(1); }
......
......@@ -53,7 +53,6 @@
#include "rpl_constants.h"
#include "sql_digest.h"
#include "zlib.h"
#include "my_atomic.h"
#define my_b_write_string(A, B) my_b_write((A), (uchar*)(B), (uint) (sizeof(B) - 1))
......@@ -8055,16 +8054,13 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
switch (flags2 & (FL_DDL | FL_TRANSACTIONAL))
{
case FL_TRANSACTIONAL:
my_atomic_add64_explicit((volatile int64 *)&mi->total_trans_groups, 1,
MY_MEMORY_ORDER_RELAXED);
mi->total_trans_groups++;
break;
case FL_DDL:
my_atomic_add64_explicit((volatile int64 *)&mi->total_ddl_groups, 1,
MY_MEMORY_ORDER_RELAXED);
mi->total_ddl_groups++;
break;
default:
my_atomic_add64_explicit((volatile int64 *)&mi->total_non_trans_groups, 1,
MY_MEMORY_ORDER_RELAXED);
mi->total_non_trans_groups++;
}
if (flags2 & FL_STANDALONE)
......
......@@ -23,6 +23,7 @@
#include "my_decimal.h" /* my_decimal */
#include "mysql_com.h" /* SERVER_VERSION_LENGTH */
#include "my_atomic.h"
#include "my_counter.h"
#include "mysql/psi/mysql_file.h" /* MYSQL_FILE */
#include "mysql/psi/mysql_socket.h" /* MYSQL_SOCKET */
#include "sql_list.h" /* I_List */
......
......@@ -329,13 +329,13 @@ class Master_info : public Slave_reporting_capability
/* No of DDL event group */
volatile uint64 total_ddl_groups;
Atomic_counter<uint64> total_ddl_groups;
/* No of non-transactional event group*/
volatile uint64 total_non_trans_groups;
Atomic_counter<uint64> total_non_trans_groups;
/* No of transactional event group*/
volatile uint64 total_trans_groups;
Atomic_counter<uint64> total_trans_groups;
/* domain-id based filter */
Domain_id_filter domain_id_filter;
......
......@@ -3407,16 +3407,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
// Slave_SQL_Running_State
protocol->store(slave_sql_running_state, &my_charset_bin);
uint64 events;
events= (uint64)my_atomic_load64_explicit((volatile int64 *)
&mi->total_ddl_groups, MY_MEMORY_ORDER_RELAXED);
protocol->store(events);
events= (uint64)my_atomic_load64_explicit((volatile int64 *)
&mi->total_non_trans_groups, MY_MEMORY_ORDER_RELAXED);
protocol->store(events);
events= (uint64)my_atomic_load64_explicit((volatile int64 *)
&mi->total_trans_groups, MY_MEMORY_ORDER_RELAXED);
protocol->store(events);
protocol->store(mi->total_ddl_groups);
protocol->store(mi->total_non_trans_groups);
protocol->store(mi->total_trans_groups);
if (full)
{
......
......@@ -68,7 +68,6 @@
#include "wsrep_mysqld.h"
#include "wsrep_thd.h"
#include "sql_connect.h"
#include "my_atomic.h"
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
......
......@@ -29,7 +29,6 @@
#include "sql_statistics.h"
#include "opt_range.h"
#include "uniques.h"
#include "my_atomic.h"
#include "sql_show.h"
#include "sql_partition.h"
......
......@@ -44,7 +44,6 @@
#include "sql_cte.h"
#include "ha_sequence.h"
#include "sql_show.h"
#include <atomic>
/* For MySQL 5.7 virtual fields */
#define MYSQL57_GENERATED_FIELD 128
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment