]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Enabled Windows build for volatile tier implementation
authorkrad <krad@fb.com>
Tue, 7 Jun 2016 23:07:30 +0000 (16:07 -0700)
committerkrad <krad@fb.com>
Thu, 9 Jun 2016 18:10:35 +0000 (11:10 -0700)
Summary: Enabled build in Windows and corresponding fixes

Test Plan:
Compile and run persistent_cache_test in Windows and make check in
Linux

Reviewers: sdong

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D59307

CMakeLists.txt
utilities/persistent_cache/persistent_cache_test.h
utilities/persistent_cache/volatile_tier_impl.cc
utilities/persistent_cache/volatile_tier_impl.h

index b49a88be3d071a8f7ac6f51d08ab7112b7234d18..80cab6f91c9df6920cd534bef8e6356b53098443 100644 (file)
@@ -266,6 +266,7 @@ set(SOURCES
         utilities/merge_operators/uint64add.cc
         utilities/options/options_util.cc
         utilities/persistent_cache/persistent_cache_tier.cc
+        utilities/persistent_cache/volatile_tier_impl.cc
         utilities/redis/redis_lists.cc
         utilities/spatialdb/spatial_db.cc
         utilities/table_properties_collectors/compact_on_deletion_collector.cc
@@ -429,6 +430,7 @@ set(TESTS
         utilities/merge_operators/string_append/stringappend_test.cc
         utilities/options/options_util_test.cc
         utilities/persistent_cache/hash_table_test.cc
+        utilities/persistent_cache/persistent_cache_test.cc
         utilities/redis/redis_lists_test.cc
         utilities/spatialdb/spatial_db_test.cc
         utilities/table_properties_collectors/compact_on_deletion_collector_test.cc
index 4659b728ca64fe062098582afd1b4798cca80857..cf97796d6580ef97069ddec3a30f4d0f6ea07639 100644 (file)
@@ -135,7 +135,7 @@ class PersistentCacheTierTest : public testing::Test {
       auto k = prefix + PaddedNumber(i, /*count=*/8);
       Slice key(k);
       while (!cache_->Insert(key, data, sizeof(data)).ok()) {
-        /* sleep override */ sleep(1);
+        Env::Default()->SleepForMicroseconds(1 * 1000 * 1000);
       }
     }
   }
@@ -230,7 +230,7 @@ class PersistentCacheDBTest : public DBTestBase {
     return std::make_shared<VolatileCacheTier>();
   }
 
-  static uint32_t TestGetTickerCount(const Options& options,
+  static uint64_t TestGetTickerCount(const Options& options,
                                      Tickers ticker_type) {
     return static_cast<uint32_t>(
         options.statistics->getTickerCount(ticker_type));
index 5bc6fe9b4eb2c7e9a08a01e8b5fedbcc54c0402e..aca9fcaf55c30fc9e7bc895e80b59c2776c1b184 100644 (file)
@@ -20,15 +20,18 @@ VolatileCacheTier::~VolatileCacheTier() { index_.Clear(&DeleteCacheData); }
 
 std::vector<PersistentCacheTier::TierStats> VolatileCacheTier::Stats() {
   PersistentCacheTier::TierStats stat;
-  stat.insert({"persistent_cache.volatile_cache.hits", stats_.cache_hits_});
-  stat.insert({"persistent_cache.volatile_cache.misses", stats_.cache_misses_});
-  stat.insert(
-      {"persistent_cache.volatile_cache.inserts", stats_.cache_inserts_});
-  stat.insert({"persistent_cache.volatile_cache.evicts", stats_.cache_evicts_});
-  stat.insert(
-      {"persistent_cache.volatile_cache.hit_pct", stats_.CacheHitPct()});
-  stat.insert(
-      {"persistent_cache.volatile_cache.miss_pct", stats_.CacheMissPct()});
+  stat.insert({"persistent_cache.volatile_cache.hits",
+               static_cast<double>(stats_.cache_hits_)});
+  stat.insert({"persistent_cache.volatile_cache.misses",
+               static_cast<double>(stats_.cache_misses_)});
+  stat.insert({"persistent_cache.volatile_cache.inserts",
+               static_cast<double>(stats_.cache_inserts_)});
+  stat.insert({"persistent_cache.volatile_cache.evicts",
+               static_cast<double>(stats_.cache_evicts_)});
+  stat.insert({"persistent_cache.volatile_cache.hit_pct",
+               static_cast<double>(stats_.CacheHitPct())});
+  stat.insert({"persistent_cache.volatile_cache.miss_pct",
+               static_cast<double>(stats_.CacheMissPct())});
 
   std::vector<PersistentCacheTier::TierStats> tier_stats;
   if (next_tier()) {
index fbd63a0d04dbded6a5e9ac590df6e727acf627eb..a29c4ac30ef9edf2ffe543a8ace93ba9f8b9f9e4 100644 (file)
@@ -73,8 +73,9 @@ class VolatileCacheTier : public PersistentCacheTier {
   // Cache data abstraction
   //
   struct CacheData : LRUElement<CacheData> {
-    explicit CacheData(CacheData&& rhs) noexcept
-        : key(std::move(rhs.key)), value(std::move(rhs.value)) {}
+    explicit CacheData(CacheData&& rhs) ROCKSDB_NOEXCEPT
+        : key(std::move(rhs.key)),
+          value(std::move(rhs.value)) {}
 
     explicit CacheData(const std::string& _key, const std::string& _value = "")
         : key(_key), value(_value) {}