Skip to content

Commit 03e4616

Browse files
committed
MDEV-17441 - InnoDB transition to C++11 atomics
fil_validate_count transition to Atomic_counter.
1 parent ca83115 commit 03e4616

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

storage/innobase/fil/fil0fil.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,11 @@ fil_validate_skip(void)
204204
/*===================*/
205205
{
206206
/** The fil_validate() call skip counter. */
207-
static int fil_validate_count = FIL_VALIDATE_SKIP;
207+
static Atomic_counter<uint32_t> fil_validate_count;
208208

209209
/* We want to reduce the call frequency of the costly fil_validate()
210210
check in debug builds. */
211-
int count = my_atomic_add32_explicit(&fil_validate_count, -1,
212-
MY_MEMORY_ORDER_RELAXED);
213-
if (count > 0) {
214-
return(true);
215-
}
216-
217-
my_atomic_store32_explicit(&fil_validate_count, FIL_VALIDATE_SKIP,
218-
MY_MEMORY_ORDER_RELAXED);
219-
return(fil_validate());
211+
return (fil_validate_count++ % FIL_VALIDATE_SKIP) || fil_validate();
220212
}
221213
#endif /* UNIV_DEBUG */
222214

storage/innobase/include/dict0dict.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Created 1/8/1996 Heikki Tuuri
3131
#include "data0data.h"
3232
#include "dict0mem.h"
3333
#include "fsp0fsp.h"
34-
#include <atomic>
3534
#include <deque>
3635

3736
extern bool innodb_table_stats_not_found;

storage/innobase/include/univ.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ used throughout InnoDB but do not include too much themselves. They
8383
support cross-platform development and expose comonly used SQL names. */
8484

8585
#include <my_global.h>
86+
#include "my_counter.h"
8687

8788
/* JAN: TODO: missing 5.7 header */
8889
#ifdef HAVE_MY_THREAD_H

storage/innobase/include/ut0counter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Created 2012/04/12 by Sunny Bains
2929
#define ut0counter_h
3030

3131
#include "os0thread.h"
32-
#include <atomic>
3332
#include "my_rdtsc.h"
3433

3534
/** CPU cache line size */

0 commit comments

Comments
 (0)