From d5bd6c772beac298b578cdf061fac00334e1f126 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 28 Aug 2014 12:46:05 -0400 Subject: [PATCH] Fix ios compile Summary: No __thread for ios. Test Plan: compile works for ios now Reviewers: ljin, dhruba Reviewed By: dhruba Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D22491 --- db/db_impl.cc | 2 +- db/db_impl_readonly.h | 4 ++++ include/rocksdb/iostats_context.h | 2 ++ util/iostats_context.cc | 2 ++ util/iostats_context_imp.h | 14 ++++++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index a123467ae..988c1acf7 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1979,7 +1979,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() { } void DBImpl::RecordFlushIOStats() { - RecordTick(stats_, FLUSH_WRITE_BYTES, iostats_context.bytes_written); + RecordTick(stats_, FLUSH_WRITE_BYTES, IOSTATS(bytes_written)); IOSTATS_RESET(bytes_written); } diff --git a/db/db_impl_readonly.h b/db/db_impl_readonly.h index 47c8ab33d..1dfdf422e 100644 --- a/db/db_impl_readonly.h +++ b/db/db_impl_readonly.h @@ -74,6 +74,8 @@ class DBImplReadOnly : public DBImpl { uint32_t target_path_id = 0) override { return Status::NotSupported("Not supported operation in read only mode."); } + +#ifndef ROCKSDB_LITE virtual Status DisableFileDeletions() override { return Status::NotSupported("Not supported operation in read only mode."); } @@ -85,6 +87,8 @@ class DBImplReadOnly : public DBImpl { bool flush_memtable = true) override { return Status::NotSupported("Not supported operation in read only mode."); } +#endif // ROCKSDB_LITE + using DBImpl::Flush; virtual Status Flush(const FlushOptions& options, ColumnFamilyHandle* column_family) override { diff --git a/include/rocksdb/iostats_context.h b/include/rocksdb/iostats_context.h index 0a220b53a..e06ee1773 100644 --- a/include/rocksdb/iostats_context.h +++ b/include/rocksdb/iostats_context.h @@ -27,7 +27,9 @@ struct IOStatsContext { uint64_t bytes_read; }; +#ifndef IOS_CROSS_COMPILE extern __thread IOStatsContext iostats_context; +#endif // IOS_CROSS_COMPILE } // namespace rocksdb diff --git a/util/iostats_context.cc b/util/iostats_context.cc index 610831779..090813abc 100644 --- a/util/iostats_context.cc +++ b/util/iostats_context.cc @@ -9,7 +9,9 @@ namespace rocksdb { +#ifndef IOS_CROSS_COMPILE __thread IOStatsContext iostats_context; +#endif // IOS_CROSS_COMPILE void IOStatsContext::Reset() { thread_pool_id = Env::Priority::TOTAL; diff --git a/util/iostats_context_imp.h b/util/iostats_context_imp.h index ed34037d3..b271ddf14 100644 --- a/util/iostats_context_imp.h +++ b/util/iostats_context_imp.h @@ -6,6 +6,8 @@ #pragma once #include "rocksdb/iostats_context.h" +#ifndef IOS_CROSS_COMPILE + // increment a specific counter by the specified value #define IOSTATS_ADD(metric, value) \ (iostats_context.metric += value) @@ -30,3 +32,15 @@ #define IOSTATS(metric) \ (iostats_context.metric) + +#else // IOS_CROSS_COMPILE + +#define IOSTATS_ADD(metric, value) +#define IOSTATS_ADD_IF_POSITIVE(metric, value) +#define IOSTATS_RESET(metric) +#define IOSTATS_RESET_ALL() +#define IOSTATS_SET_THREAD_POOL_ID(value) +#define IOSTATS_THREAD_POOL_ID() +#define IOSTATS(metric) 0 + +#endif // IOS_CROSS_COMPILE