diff --git a/ft/ft-internal.h b/ft/ft-internal.h index 130d3c302..2379cdb44 100644 --- a/ft/ft-internal.h +++ b/ft/ft-internal.h @@ -80,7 +80,7 @@ extern "C" { extern uint force_recovery; } -extern int writing_rollback; +extern std::atomic_int writing_rollback; // The ft_header is not managed by the cachetable. Instead, it hangs off the cachefile as userdata. struct ft_header { diff --git a/ft/logger/logger.cc b/ft/logger/logger.cc index 60280a940..8e9e26921 100644 --- a/ft/logger/logger.cc +++ b/ft/logger/logger.cc @@ -49,7 +49,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/status.h" -int writing_rollback = 0; +std::atomic_int writing_rollback = {0}; extern "C" { uint force_recovery = 0; } diff --git a/ft/node.h b/ft/node.h index 61093f3ed..ef0f0d84d 100644 --- a/ft/node.h +++ b/ft/node.h @@ -155,7 +155,7 @@ class ftnode_pivot_keys { size_t _total_size; }; -extern int writing_rollback; +extern std::atomic_int writing_rollback; extern "C" { extern uint force_recovery; diff --git a/ft/txn/rollback.cc b/ft/txn/rollback.cc index 105f980dc..6c7445eb0 100644 --- a/ft/txn/rollback.cc +++ b/ft/txn/rollback.cc @@ -43,7 +43,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ft/logger/log-internal.h" #include "ft/txn/rollback-ct-callbacks.h" -extern int writing_rollback; +extern std::atomic_int writing_rollback; static void rollback_unpin_remove_callback(CACHEKEY* cachekey, bool for_checkpoint, void* extra) { FT CAST_FROM_VOIDP(ft, extra); diff --git a/portability/toku_atomic.h b/portability/toku_atomic.h index 88644f569..5dcdb2fd3 100644 --- a/portability/toku_atomic.h +++ b/portability/toku_atomic.h @@ -58,6 +58,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include #include #include +#include __attribute__((const, always_inline)) static inline intptr_t which_cache_line(intptr_t addr) { diff --git a/src/ydb.cc b/src/ydb.cc index d88d7a26e..27f935f7d 100644 --- a/src/ydb.cc +++ b/src/ydb.cc @@ -39,9 +39,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. extern const char *toku_patent_string; const char *toku_copyright_string = "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."; - -extern int writing_rollback; - #include #include #include @@ -90,6 +87,8 @@ extern int writing_rollback; int toku_close_trace_file (void) { return 0; } #endif +extern std::atomic_int writing_rollback; + extern uint force_recovery; // Set when env is panicked, never cleared.