Skip to content

Commit

Permalink
MDEV-17441 - InnoDB transition to C++11 atomics
Browse files Browse the repository at this point in the history
fil_validate_count transition to Atomic_counter.
  • Loading branch information
Sergey Vojtovich committed Dec 27, 2018
1 parent ca83115 commit 03e4616
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
12 changes: 2 additions & 10 deletions storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
1 change: 0 additions & 1 deletion storage/innobase/include/dict0dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/univ.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/include/ut0counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 03e4616

Please sign in to comment.