84 :
m_data{0, 0, after_change} {
103 static_assert(std::is_standard_layout_v<Data>);
104 static_assert(offsetof(
Data, m_nonatomic) == 0);
105 auto var =
static_cast<Data *
>(target);
106 ut_ad(&var->m_nonatomic == target);
107 var->m_nonatomic = *
static_cast<const T *
>(new_value);
108 var->m_atomic.store(var->m_nonatomic);
109 if (var->m_after_change) {
110 var->m_after_change();
118#define ATOMIC_SYSVAR_ULONG(sysvar_name_suffix, flags, description, validate, \
119 after_change, default_value, min_value, max_value, \
121 Atomic_sysvar<ulong> innodb_##sysvar_name_suffix(after_change); \
122 static MYSQL_SYSVAR_ULONG( \
123 sysvar_name_suffix, innodb_##sysvar_name_suffix.registrable(), flags, \
124 description, validate, innodb_##sysvar_name_suffix.update, \
125 default_value, min_value, max_value, value_granularity)
A helper class for numeric sysvars which can be read in thread-safe way.
Definition: ut0atomic_sysvar.h:36
T & registrable()
Get the variable which we want to register via plugin API.
Definition: ut0atomic_sysvar.h:94
static void update(THD *, SYS_VAR *, void *target, const void *new_value)
This is on-update handler registered via plugin API for all sysvars of this type.
Definition: ut0atomic_sysvar.h:102
struct Atomic_sysvar::Data m_data
T load() const
Get the current value of the sys-var without UB.
Definition: ut0atomic_sysvar.h:90
Atomic_sysvar(void(*after_change)())
Constructs the atomic sysvar, initializes its value to zero and makes sure innodb_init_params() will ...
Definition: ut0atomic_sysvar.h:71
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
#define T
Definition: jit_executor_value.cc:373
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2724
Contains all members of Atomic_sysvar<T> in a standard layout struct - which, among other things,...
Definition: ut0atomic_sysvar.h:44
T m_nonatomic
InnoDB code should not look at this, nor modify this directly (except in the update() function define...
Definition: ut0atomic_sysvar.h:50
std::atomic< T > m_atomic
This stores the atomic variable which InnoDB threads might access at any moment via load().
Definition: ut0atomic_sysvar.h:55
void(* m_after_change)()
This is a callback provided by InnoDB to be called after each change of the value which happens after...
Definition: ut0atomic_sysvar.h:60
Definition: system_variables_bits.h:153
std::vector< std::function< void()> > innodb_sysvar_initializers
Set of callbacks to be executed in innodb_init_params() to react to changes server layer did directly...
Definition: ha_innodb.cc:4742
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109