Commit c6a00544 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

ibuf_t::n_merged_ops and ibuf_t::n_discarded_ops transition to
Atomic_counter.
parent d2bdd789
......@@ -1427,32 +1427,26 @@ ibuf_rec_get_counter(
}
}
/****************************************************************//**
Add accumulated operation counts to a permanent array. Both arrays must be
of size IBUF_OP_COUNT. */
static
void
ibuf_add_ops(
/*=========*/
ulint* arr, /*!< in/out: array to modify */
const ulint* ops) /*!< in: operation counts */
/**
Add accumulated operation counts to a permanent array.
Both arrays must be of size IBUF_OP_COUNT.
*/
static void ibuf_add_ops(Atomic_counter<ulint> *out, const ulint *in)
{
ulint i;
for (i = 0; i < IBUF_OP_COUNT; i++) {
my_atomic_addlint(&arr[i], ops[i]);
}
for (auto i = 0; i < IBUF_OP_COUNT; i++)
out[i]+= in[i];
}
/****************************************************************//**
Print operation counts. The array must be of size IBUF_OP_COUNT. */
static
void
ibuf_print_ops(
/*===========*/
const ulint* ops, /*!< in: operation counts */
FILE* file) /*!< in: file where to print */
const Atomic_counter<ulint>* ops, /*!< in: operation counts */
FILE* file) /*!< in: file where to print */
{
static const char* op_names[] = {
"insert",
......@@ -1465,7 +1459,7 @@ ibuf_print_ops(
for (i = 0; i < IBUF_OP_COUNT; i++) {
fprintf(file, "%s " ULINTPF "%s", op_names[i],
ops[i], (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
ulint{ops[i]}, (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
}
putc('\n', file);
......
......@@ -80,10 +80,10 @@ struct ibuf_t{
/** number of pages merged */
Atomic_counter<ulint> n_merges;
ulint n_merged_ops[IBUF_OP_COUNT];
Atomic_counter<ulint> n_merged_ops[IBUF_OP_COUNT];
/*!< number of operations of each type
merged to index pages */
ulint n_discarded_ops[IBUF_OP_COUNT];
Atomic_counter<ulint> n_discarded_ops[IBUF_OP_COUNT];
/*!< number of operations of each type
discarded without merging due to the
tablespace being deleted or the
......
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