Gcc 7 error expansion to defined
Summary: sorry if these gcc-7/clang-4 cleanups are getting tedious. Closes https://github.com/facebook/rocksdb/pull/1658 Differential Revision: D4318792 Pulled By: yiwu-arbug fbshipit-source-id: 8e85891
This commit is contained in:
parent
6653e32ac2
commit
bfbcec2339
@ -6302,7 +6302,7 @@ Status DBImpl::RenameTempFileToOptionsFile(const std::string& file_name) {
|
||||
#endif // !ROCKSDB_LITE
|
||||
}
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
|
||||
void DBImpl::NewThreadStatusCfInfo(
|
||||
ColumnFamilyData* cfd) const {
|
||||
|
@ -3663,7 +3663,7 @@ TEST_F(DBTest, DynamicMemtableOptions) {
|
||||
}
|
||||
#endif // ROCKSDB_LITE
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
namespace {
|
||||
void VerifyOperationCount(Env* env, ThreadStatus::OperationType op_type,
|
||||
int expected_count) {
|
||||
@ -4970,7 +4970,7 @@ TEST_F(DBTest, MergeTestTime) {
|
||||
|
||||
ASSERT_EQ(1, count);
|
||||
ASSERT_EQ(2000000, TestGetTickerCount(options, MERGE_OPERATION_TOTAL_TIME));
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
ASSERT_GT(TestGetTickerCount(options, FLUSH_WRITE_BYTES), 0);
|
||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||
this->env_->time_elapse_only_sleep_ = false;
|
||||
|
@ -119,7 +119,7 @@ TEST_F(EventListenerTest, OnSingleDBCompactionTest) {
|
||||
options.max_bytes_for_level_base = options.target_file_size_base * 2;
|
||||
options.max_bytes_for_level_multiplier = 2;
|
||||
options.compression = kNoCompression;
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
options.enable_thread_tracking = true;
|
||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||
options.level0_file_num_compaction_trigger = kNumL0Files;
|
||||
@ -176,7 +176,7 @@ class TestFlushListener : public EventListener {
|
||||
ASSERT_GT(info.table_properties.num_data_blocks, 0U);
|
||||
ASSERT_GT(info.table_properties.num_entries, 0U);
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
// Verify the id of the current thread that created this table
|
||||
// file matches the id of any active flush or compaction thread.
|
||||
uint64_t thread_id = env_->GetThreadID();
|
||||
@ -232,7 +232,7 @@ class TestFlushListener : public EventListener {
|
||||
TEST_F(EventListenerTest, OnSingleDBFlushTest) {
|
||||
Options options;
|
||||
options.write_buffer_size = k110KB;
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
options.enable_thread_tracking = true;
|
||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||
TestFlushListener* listener = new TestFlushListener(options.env);
|
||||
@ -268,7 +268,7 @@ TEST_F(EventListenerTest, OnSingleDBFlushTest) {
|
||||
TEST_F(EventListenerTest, MultiCF) {
|
||||
Options options;
|
||||
options.write_buffer_size = k110KB;
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
options.enable_thread_tracking = true;
|
||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||
TestFlushListener* listener = new TestFlushListener(options.env);
|
||||
@ -302,7 +302,7 @@ TEST_F(EventListenerTest, MultiCF) {
|
||||
|
||||
TEST_F(EventListenerTest, MultiDBMultiListeners) {
|
||||
Options options;
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
options.enable_thread_tracking = true;
|
||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||
options.table_properties_collector_factories.push_back(
|
||||
@ -384,7 +384,7 @@ TEST_F(EventListenerTest, MultiDBMultiListeners) {
|
||||
|
||||
TEST_F(EventListenerTest, DisableBGCompaction) {
|
||||
Options options;
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
options.enable_thread_tracking = true;
|
||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||
TestFlushListener* listener = new TestFlushListener(options.env);
|
||||
|
@ -20,12 +20,11 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifndef ROCKSDB_USING_THREAD_STATUS
|
||||
#define ROCKSDB_USING_THREAD_STATUS \
|
||||
!defined(ROCKSDB_LITE) && \
|
||||
#if !defined(ROCKSDB_LITE) && \
|
||||
!defined(NROCKSDB_THREAD_STATUS) && \
|
||||
!defined(OS_MACOSX) && \
|
||||
!defined(IOS_CROSS_COMPILE)
|
||||
#define ROCKSDB_USING_THREAD_STATUS
|
||||
#endif
|
||||
|
||||
namespace rocksdb {
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
#if ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
__thread uint32_t ConcurrentArena::tls_cpuid = 0;
|
||||
#endif
|
||||
|
||||
@ -39,7 +39,7 @@ ConcurrentArena::Shard* ConcurrentArena::Repick() {
|
||||
cpuid =
|
||||
Random::GetTLSInstance()->Uniform(static_cast<int>(index_mask_) + 1);
|
||||
}
|
||||
#if ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
// even if we are cpu 0, use a non-zero tls_cpuid so we can tell we
|
||||
// have repicked
|
||||
tls_cpuid = cpuid | (static_cast<int>(index_mask_) + 1);
|
||||
|
@ -94,7 +94,7 @@ class ConcurrentArena : public Allocator {
|
||||
Shard() : allocated_and_unused_(0) {}
|
||||
};
|
||||
|
||||
#if ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
static __thread uint32_t tls_cpuid;
|
||||
#else
|
||||
enum ZeroFirstEnum : uint32_t { tls_cpuid = 0 };
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "port/likely.h"
|
||||
#include "util/thread_local.h"
|
||||
|
||||
#if ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#define STORAGE_DECL static __thread
|
||||
#else
|
||||
#define STORAGE_DECL static
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "util/testharness.h"
|
||||
#include "rocksdb/db.h"
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
#if ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
__thread ThreadLocalPtr::ThreadData* ThreadLocalPtr::StaticMeta::tls_ = nullptr;
|
||||
#endif
|
||||
|
||||
@ -184,7 +184,7 @@ ThreadLocalPtr::StaticMeta::StaticMeta() : next_instance_id_(0), head_(this) {
|
||||
#if !defined(OS_WIN)
|
||||
static struct A {
|
||||
~A() {
|
||||
#if !(ROCKSDB_SUPPORT_THREAD_LOCAL)
|
||||
#ifndef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
ThreadData* tls_ =
|
||||
static_cast<ThreadData*>(pthread_getspecific(Instance()->pthread_key_));
|
||||
#endif
|
||||
@ -222,7 +222,7 @@ void ThreadLocalPtr::StaticMeta::RemoveThreadData(
|
||||
}
|
||||
|
||||
ThreadLocalPtr::ThreadData* ThreadLocalPtr::StaticMeta::GetThreadLocal() {
|
||||
#if !(ROCKSDB_SUPPORT_THREAD_LOCAL)
|
||||
#ifndef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
// Make this local variable name look like a member variable so that we
|
||||
// can share all the code below
|
||||
ThreadData* tls_ =
|
||||
|
@ -17,9 +17,8 @@
|
||||
#include "util/autovector.h"
|
||||
#include "port/port.h"
|
||||
|
||||
#ifndef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#define ROCKSDB_SUPPORT_THREAD_LOCAL \
|
||||
!defined(OS_WIN) && !defined(OS_MACOSX) && !defined(IOS_CROSS_COMPILE)
|
||||
#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(IOS_CROSS_COMPILE)
|
||||
#define ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
namespace rocksdb {
|
||||
@ -202,7 +201,7 @@ class ThreadLocalPtr {
|
||||
// The private mutex. Developers should always use Mutex() instead of
|
||||
// using this variable directly.
|
||||
port::Mutex mutex_;
|
||||
#if ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
#ifdef ROCKSDB_SUPPORT_THREAD_LOCAL
|
||||
// Thread local storage
|
||||
static __thread ThreadData* tls_;
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
|
||||
// The structure that describes a major thread operation.
|
||||
struct OperationInfo {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
const std::string& ThreadStatus::GetThreadTypeName(
|
||||
ThreadStatus::ThreadType thread_type) {
|
||||
static std::string thread_type_names[NUM_THREAD_TYPES + 1] = {
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace rocksdb {
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
|
||||
__thread ThreadStatusData* ThreadStatusUpdater::thread_status_data_ = nullptr;
|
||||
|
||||
|
@ -47,7 +47,7 @@ class ColumnFamilyHandle;
|
||||
|
||||
// The structure that keeps constant information about a column family.
|
||||
struct ConstantColumnFamilyInfo {
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
public:
|
||||
ConstantColumnFamilyInfo(
|
||||
const void* _db_key,
|
||||
@ -63,7 +63,7 @@ struct ConstantColumnFamilyInfo {
|
||||
// the internal data-structure that is used to reflect the current
|
||||
// status of a thread using a set of atomic pointers.
|
||||
struct ThreadStatusData {
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
explicit ThreadStatusData() : enable_tracking(false) {
|
||||
thread_id.store(0);
|
||||
thread_type.store(ThreadStatus::USER);
|
||||
@ -194,7 +194,7 @@ class ThreadStatusUpdater {
|
||||
bool check_exist);
|
||||
|
||||
protected:
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
// The thread-local variable for storing thread status.
|
||||
static __thread ThreadStatusData* thread_status_data_;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace rocksdb {
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
void ThreadStatusUpdater::TEST_VerifyColumnFamilyInfoMap(
|
||||
const std::vector<ColumnFamilyHandle*>& handles,
|
||||
bool check_exist) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace rocksdb {
|
||||
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
__thread ThreadStatusUpdater*
|
||||
ThreadStatusUtil::thread_updater_local_cache_ = nullptr;
|
||||
__thread bool ThreadStatusUtil::thread_updater_initialized_ = false;
|
||||
|
@ -84,7 +84,7 @@ class ThreadStatusUtil {
|
||||
// a non-null pointer.
|
||||
static bool MaybeInitThreadLocalUpdater(const Env* env);
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
// A boolean flag indicating whether thread_updater_local_cache_
|
||||
// is initialized. It is set to true when an Env uses any
|
||||
// ThreadStatusUtil functions using the current thread other
|
||||
@ -125,7 +125,7 @@ class AutoThreadOperationStageUpdater {
|
||||
ThreadStatus::OperationStage stage);
|
||||
~AutoThreadOperationStageUpdater();
|
||||
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
private:
|
||||
ThreadStatus::OperationStage prev_stage_;
|
||||
#endif
|
||||
|
@ -242,7 +242,7 @@ static void* BGThreadWrapper(void* arg) {
|
||||
BGThreadMetadata* meta = reinterpret_cast<BGThreadMetadata*>(arg);
|
||||
size_t thread_id = meta->thread_id_;
|
||||
ThreadPoolImpl* tp = meta->thread_pool_;
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
// for thread-status
|
||||
ThreadStatusUtil::RegisterThread(
|
||||
tp->GetHostEnv(), (tp->GetThreadPriority() == Env::Priority::HIGH
|
||||
@ -251,7 +251,7 @@ static void* BGThreadWrapper(void* arg) {
|
||||
#endif
|
||||
delete meta;
|
||||
tp->BGThread(thread_id);
|
||||
#if ROCKSDB_USING_THREAD_STATUS
|
||||
#ifdef ROCKSDB_USING_THREAD_STATUS
|
||||
ThreadStatusUtil::UnregisterThread();
|
||||
#endif
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user