Minor fixes found while trying to compile it using clang on Mac OS X

main
Rajat Goel 11 years ago
parent 8866448001
commit 5f2c136c32
  1. 2
      db/builder.h
  2. 12
      db/db_bench.cc
  3. 1
      db/merge_helper.h
  4. 1
      db/repair.cc
  5. 7
      include/rocksdb/env.h
  6. 6
      util/cache.cc
  7. 13
      util/env_posix.cc
  8. 3
      utilities/ttl/db_ttl.cc
  9. 1
      utilities/ttl/db_ttl.h

@ -15,7 +15,7 @@ struct Options;
struct FileMetaData; struct FileMetaData;
class Env; class Env;
class EnvOptions; struct EnvOptions;
class Iterator; class Iterator;
class TableCache; class TableCache;
class VersionEdit; class VersionEdit;

@ -421,18 +421,6 @@ class RandomGenerator {
} }
}; };
static Slice TrimSpace(Slice s) {
unsigned int start = 0;
while (start < s.size() && isspace(s[start])) {
start++;
}
unsigned int limit = s.size();
while (limit > start && isspace(s[limit-1])) {
limit--;
}
return Slice(s.data() + start, limit - start);
}
static void AppendWithSpace(std::string* str, Slice msg) { static void AppendWithSpace(std::string* str, Slice msg) {
if (msg.empty()) return; if (msg.empty()) return;
if (!str->empty()) { if (!str->empty()) {

@ -83,7 +83,6 @@ class MergeHelper {
const Comparator* user_comparator_; const Comparator* user_comparator_;
const MergeOperator* user_merge_operator_; const MergeOperator* user_merge_operator_;
Logger* logger_; Logger* logger_;
Iterator* iter_; // in: the internal iterator, positioned at the first merge entry
bool assert_valid_internal_key_; // enforce no internal key corruption? bool assert_valid_internal_key_; // enforce no internal key corruption?
// the scratch area that holds the result of MergeUntil // the scratch area that holds the result of MergeUntil

@ -97,7 +97,6 @@ class Repairer {
InternalKeyComparator const icmp_; InternalKeyComparator const icmp_;
InternalFilterPolicy const ipolicy_; InternalFilterPolicy const ipolicy_;
Options const options_; Options const options_;
bool owns_cache_;
TableCache* table_cache_; TableCache* table_cache_;
VersionEdit* edit_; VersionEdit* edit_;

@ -18,8 +18,13 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <stdint.h> #include <stdint.h>
#include <sys/types.h>
#include "rocksdb/status.h" #include "rocksdb/status.h"
#ifdef __APPLE__
typedef off_t off64_t;
#endif
namespace leveldb { namespace leveldb {
class FileLock; class FileLock;
@ -28,7 +33,7 @@ class RandomAccessFile;
class SequentialFile; class SequentialFile;
class Slice; class Slice;
class WritableFile; class WritableFile;
class Options; struct Options;
using std::unique_ptr; using std::unique_ptr;
using std::shared_ptr; using std::shared_ptr;

@ -159,7 +159,6 @@ class LRUCache {
// mutex_ protects the following state. // mutex_ protects the following state.
port::Mutex mutex_; port::Mutex mutex_;
size_t usage_; size_t usage_;
uint64_t last_id_;
// Dummy head of LRU list. // Dummy head of LRU list.
// lru.prev is newest entry, lru.next is oldest entry. // lru.prev is newest entry, lru.next is oldest entry.
@ -169,8 +168,7 @@ class LRUCache {
}; };
LRUCache::LRUCache() LRUCache::LRUCache()
: usage_(0), : usage_(0) {
last_id_(0) {
// Make empty circular linked list // Make empty circular linked list
lru_.next = &lru_; lru_.next = &lru_;
lru_.prev = &lru_; lru_.prev = &lru_;
@ -333,7 +331,7 @@ class ShardedLRUCache : public Cache {
MutexLock l(&id_mutex_); MutexLock l(&id_mutex_);
return ++(last_id_); return ++(last_id_);
} }
virtual uint64_t GetCapacity() { virtual size_t GetCapacity() {
return capacity_; return capacity_;
} }
}; };

@ -14,10 +14,15 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef __APPLE__
#include <sys/param.h>
#include <sys/mount.h>
#else
#include <sys/statfs.h> #include <sys/statfs.h>
#include <sys/vfs.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/vfs.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#if defined(OS_LINUX) #if defined(OS_LINUX)
@ -126,7 +131,9 @@ class PosixSequentialFile: public SequentialFile {
if (!use_os_buffer_) { if (!use_os_buffer_) {
// we need to fadvise away the entire range of pages because // we need to fadvise away the entire range of pages because
// we do not want readahead pages to be cached. // we do not want readahead pages to be cached.
#ifndef __APPLE__
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
#endif
} }
return s; return s;
} }
@ -166,7 +173,9 @@ class PosixRandomAccessFile: public RandomAccessFile {
if (!use_os_buffer_) { if (!use_os_buffer_) {
// we need to fadvise away the entire range of pages because // we need to fadvise away the entire range of pages because
// we do not want readahead pages to be cached. // we do not want readahead pages to be cached.
#ifndef __APPLE__
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
#endif
} }
return s; return s;
} }
@ -201,6 +210,7 @@ class PosixRandomAccessFile: public RandomAccessFile {
#endif #endif
virtual void Hint(AccessPattern pattern) { virtual void Hint(AccessPattern pattern) {
#ifndef __APPLE__
switch(pattern) { switch(pattern) {
case NORMAL: case NORMAL:
posix_fadvise(fd_, 0, 0, POSIX_FADV_NORMAL); posix_fadvise(fd_, 0, 0, POSIX_FADV_NORMAL);
@ -221,6 +231,7 @@ class PosixRandomAccessFile: public RandomAccessFile {
assert(false); assert(false);
break; break;
} }
#endif
} }
}; };

@ -16,8 +16,7 @@ DBWithTTL::DBWithTTL(const int32_t ttl,
const std::string& dbname, const std::string& dbname,
Status& st, Status& st,
bool read_only) bool read_only)
: StackableDB(nullptr), : StackableDB(nullptr) {
ttl_(ttl) {
Options options_to_open = options; Options options_to_open = options;
if (options.compaction_filter) { if (options.compaction_filter) {

@ -111,7 +111,6 @@ class DBWithTTL : public StackableDB {
private: private:
DB* db_; DB* db_;
int32_t ttl_;
unique_ptr<CompactionFilter> ttl_comp_filter_; unique_ptr<CompactionFilter> ttl_comp_filter_;
}; };

Loading…
Cancel
Save