Enabled Windows build for volatile tier implementation

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
main
krad 9 years ago
parent 281fbdddc2
commit 5b197bff41
  1. 2
      CMakeLists.txt
  2. 4
      utilities/persistent_cache/persistent_cache_test.h
  3. 21
      utilities/persistent_cache/volatile_tier_impl.cc
  4. 5
      utilities/persistent_cache/volatile_tier_impl.h

@ -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

@ -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));

@ -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()) {

@ -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) {}

Loading…
Cancel
Save