Skip to content

Commit

Permalink
Fix ios compile
Browse files Browse the repository at this point in the history
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
  • Loading branch information
igorcanadi committed Aug 28, 2014
1 parent 6b46f78 commit d5bd6c7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions db/db_impl_readonly.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions include/rocksdb/iostats_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions util/iostats_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions util/iostats_context_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit d5bd6c7

Please sign in to comment.