Commit 03e46163 authored by Sergey Vojtovich's avatar Sergey Vojtovich

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

fil_validate_count transition to Atomic_counter.
parent ca83115b
......@@ -204,19 +204,11 @@ fil_validate_skip(void)
/*===================*/
{
/** The fil_validate() call skip counter. */
static int fil_validate_count = FIL_VALIDATE_SKIP;
static Atomic_counter<uint32_t> fil_validate_count;
/* We want to reduce the call frequency of the costly fil_validate()
check in debug builds. */
int count = my_atomic_add32_explicit(&fil_validate_count, -1,
MY_MEMORY_ORDER_RELAXED);
if (count > 0) {
return(true);
}
my_atomic_store32_explicit(&fil_validate_count, FIL_VALIDATE_SKIP,
MY_MEMORY_ORDER_RELAXED);
return(fil_validate());
return (fil_validate_count++ % FIL_VALIDATE_SKIP) || fil_validate();
}
#endif /* UNIV_DEBUG */
......
......@@ -31,7 +31,6 @@ Created 1/8/1996 Heikki Tuuri
#include "data0data.h"
#include "dict0mem.h"
#include "fsp0fsp.h"
#include <atomic>
#include <deque>
extern bool innodb_table_stats_not_found;
......
......@@ -83,6 +83,7 @@ used throughout InnoDB but do not include too much themselves. They
support cross-platform development and expose comonly used SQL names. */
#include <my_global.h>
#include "my_counter.h"
/* JAN: TODO: missing 5.7 header */
#ifdef HAVE_MY_THREAD_H
......
......@@ -29,7 +29,6 @@ Created 2012/04/12 by Sunny Bains
#define ut0counter_h
#include "os0thread.h"
#include <atomic>
#include "my_rdtsc.h"
/** CPU cache line size */
......
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