diff --git a/db/builder.h b/db/builder.h index b8e6f485a8..8de5d43350 100644 --- a/db/builder.h +++ b/db/builder.h @@ -15,7 +15,7 @@ struct Options; struct FileMetaData; class Env; -struct EnvOptions; +class EnvOptions; class Iterator; class TableCache; class VersionEdit; diff --git a/db/db_bench.cc b/db/db_bench.cc index 2846f9e55d..096b183772 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -421,6 +421,18 @@ 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) { if (msg.empty()) return; if (!str->empty()) { diff --git a/db/merge_helper.h b/db/merge_helper.h index 6f89253a4d..b058f98692 100644 --- a/db/merge_helper.h +++ b/db/merge_helper.h @@ -83,6 +83,7 @@ class MergeHelper { const Comparator* user_comparator_; const MergeOperator* user_merge_operator_; Logger* logger_; + Iterator* iter_; // in: the internal iterator, positioned at the first merge entry bool assert_valid_internal_key_; // enforce no internal key corruption? // the scratch area that holds the result of MergeUntil diff --git a/db/repair.cc b/db/repair.cc index bbe558fd77..23a2b79356 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -97,6 +97,7 @@ class Repairer { InternalKeyComparator const icmp_; InternalFilterPolicy const ipolicy_; Options const options_; + bool owns_cache_; TableCache* table_cache_; VersionEdit* edit_; diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index 131951ce17..50b29167ba 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -18,13 +18,8 @@ #include #include #include -#include #include "rocksdb/status.h" -#ifdef __APPLE__ -typedef off_t off64_t; -#endif - namespace leveldb { class FileLock; @@ -33,7 +28,7 @@ class RandomAccessFile; class SequentialFile; class Slice; class WritableFile; -struct Options; +class Options; using std::unique_ptr; using std::shared_ptr; diff --git a/util/cache.cc b/util/cache.cc index c823845818..5a2ce38a60 100644 --- a/util/cache.cc +++ b/util/cache.cc @@ -159,6 +159,7 @@ class LRUCache { // mutex_ protects the following state. port::Mutex mutex_; size_t usage_; + uint64_t last_id_; // Dummy head of LRU list. // lru.prev is newest entry, lru.next is oldest entry. @@ -168,7 +169,8 @@ class LRUCache { }; LRUCache::LRUCache() - : usage_(0) { + : usage_(0), + last_id_(0) { // Make empty circular linked list lru_.next = &lru_; lru_.prev = &lru_; @@ -331,7 +333,7 @@ class ShardedLRUCache : public Cache { MutexLock l(&id_mutex_); return ++(last_id_); } - virtual size_t GetCapacity() { + virtual uint64_t GetCapacity() { return capacity_; } }; diff --git a/util/env_posix.cc b/util/env_posix.cc index 91cc07b0ab..50f96e5074 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -14,15 +14,10 @@ #include #include #include -#ifdef __APPLE__ -#include -#include -#else #include -#include -#endif #include #include +#include #include #include #if defined(OS_LINUX) @@ -131,9 +126,7 @@ class PosixSequentialFile: public SequentialFile { if (!use_os_buffer_) { // we need to fadvise away the entire range of pages because // we do not want readahead pages to be cached. -#ifndef __APPLE__ posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages -#endif } return s; } @@ -173,9 +166,7 @@ class PosixRandomAccessFile: public RandomAccessFile { if (!use_os_buffer_) { // we need to fadvise away the entire range of pages because // we do not want readahead pages to be cached. -#ifndef __APPLE__ posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages -#endif } return s; } @@ -210,7 +201,6 @@ class PosixRandomAccessFile: public RandomAccessFile { #endif virtual void Hint(AccessPattern pattern) { -#ifndef __APPLE__ switch(pattern) { case NORMAL: posix_fadvise(fd_, 0, 0, POSIX_FADV_NORMAL); @@ -231,7 +221,6 @@ class PosixRandomAccessFile: public RandomAccessFile { assert(false); break; } -#endif } }; diff --git a/utilities/ttl/db_ttl.cc b/utilities/ttl/db_ttl.cc index f1ef1983de..eb39267f85 100644 --- a/utilities/ttl/db_ttl.cc +++ b/utilities/ttl/db_ttl.cc @@ -16,7 +16,8 @@ DBWithTTL::DBWithTTL(const int32_t ttl, const std::string& dbname, Status& st, bool read_only) - : StackableDB(nullptr) { + : StackableDB(nullptr), + ttl_(ttl) { Options options_to_open = options; if (options.compaction_filter) { diff --git a/utilities/ttl/db_ttl.h b/utilities/ttl/db_ttl.h index d16aa1cc13..f11f220cd6 100644 --- a/utilities/ttl/db_ttl.h +++ b/utilities/ttl/db_ttl.h @@ -111,6 +111,7 @@ class DBWithTTL : public StackableDB { private: DB* db_; + int32_t ttl_; unique_ptr ttl_comp_filter_; };