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
main
Igor Canadi 10 years ago
parent 6b46f78434
commit d5bd6c772b
  1. 2
      db/db_impl.cc
  2. 4
      db/db_impl_readonly.h
  3. 2
      include/rocksdb/iostats_context.h
  4. 2
      util/iostats_context.cc
  5. 14
      util/iostats_context_imp.h

@ -1979,7 +1979,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() {
} }
void DBImpl::RecordFlushIOStats() { void DBImpl::RecordFlushIOStats() {
RecordTick(stats_, FLUSH_WRITE_BYTES, iostats_context.bytes_written); RecordTick(stats_, FLUSH_WRITE_BYTES, IOSTATS(bytes_written));
IOSTATS_RESET(bytes_written); IOSTATS_RESET(bytes_written);
} }

@ -74,6 +74,8 @@ class DBImplReadOnly : public DBImpl {
uint32_t target_path_id = 0) override { uint32_t target_path_id = 0) override {
return Status::NotSupported("Not supported operation in read only mode."); return Status::NotSupported("Not supported operation in read only mode.");
} }
#ifndef ROCKSDB_LITE
virtual Status DisableFileDeletions() override { virtual Status DisableFileDeletions() override {
return Status::NotSupported("Not supported operation in read only mode."); return Status::NotSupported("Not supported operation in read only mode.");
} }
@ -85,6 +87,8 @@ class DBImplReadOnly : public DBImpl {
bool flush_memtable = true) override { bool flush_memtable = true) override {
return Status::NotSupported("Not supported operation in read only mode."); return Status::NotSupported("Not supported operation in read only mode.");
} }
#endif // ROCKSDB_LITE
using DBImpl::Flush; using DBImpl::Flush;
virtual Status Flush(const FlushOptions& options, virtual Status Flush(const FlushOptions& options,
ColumnFamilyHandle* column_family) override { ColumnFamilyHandle* column_family) override {

@ -27,7 +27,9 @@ struct IOStatsContext {
uint64_t bytes_read; uint64_t bytes_read;
}; };
#ifndef IOS_CROSS_COMPILE
extern __thread IOStatsContext iostats_context; extern __thread IOStatsContext iostats_context;
#endif // IOS_CROSS_COMPILE
} // namespace rocksdb } // namespace rocksdb

@ -9,7 +9,9 @@
namespace rocksdb { namespace rocksdb {
#ifndef IOS_CROSS_COMPILE
__thread IOStatsContext iostats_context; __thread IOStatsContext iostats_context;
#endif // IOS_CROSS_COMPILE
void IOStatsContext::Reset() { void IOStatsContext::Reset() {
thread_pool_id = Env::Priority::TOTAL; thread_pool_id = Env::Priority::TOTAL;

@ -6,6 +6,8 @@
#pragma once #pragma once
#include "rocksdb/iostats_context.h" #include "rocksdb/iostats_context.h"
#ifndef IOS_CROSS_COMPILE
// increment a specific counter by the specified value // increment a specific counter by the specified value
#define IOSTATS_ADD(metric, value) \ #define IOSTATS_ADD(metric, value) \
(iostats_context.metric += value) (iostats_context.metric += value)
@ -30,3 +32,15 @@
#define IOSTATS(metric) \ #define IOSTATS(metric) \
(iostats_context.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

Loading…
Cancel
Save