Build break fix

Summary:
Fixing build break on Mac

(1) uint64_t fix
(2) O_DIRECT works only for Linux

Test Plan: Build and test on Mac and Unix

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D61353
main
krad 9 years ago
parent d51dc96a79
commit 726c2f7e5b
  1. 2
      utilities/persistent_cache/block_cache_tier.cc
  2. 8
      utilities/persistent_cache/persistent_cache_test.cc

@ -338,7 +338,7 @@ bool BlockCacheTier::Reserve(const size_t size) {
return false;
}
assert(!f->refs_);
size_t file_size;
uint64_t file_size;
if (!f->Delete(&file_size).ok()) {
// unable to delete file
return false;

@ -20,6 +20,7 @@ namespace rocksdb {
static const double kStressFactor = .125;
#ifdef OS_LINUX
static void OnOpenForRead(void* arg) {
int* val = static_cast<int*>(arg);
*val &= ~O_DIRECT;
@ -35,6 +36,7 @@ static void OnOpenForWrite(void* arg) {
"NewWritableFile:O_DIRECT",
std::bind(OnOpenForWrite, std::placeholders::_1));
}
#endif
//
// Simple logger that prints message on stdout
@ -105,11 +107,13 @@ std::unique_ptr<PersistentTieredCache> NewTieredCache(
PersistentCacheTierTest::PersistentCacheTierTest()
: path_(test::TmpDir(Env::Default()) + "/cache_test") {
#ifdef OS_LINUX
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT",
OnOpenForRead);
rocksdb::SyncPoint::GetInstance()->SetCallBack("NewWritableFile:O_DIRECT",
OnOpenForWrite);
#endif
}
// Volatile cache tests
@ -197,6 +201,7 @@ std::shared_ptr<PersistentCacheTier> MakeTieredCache(
return NewTieredCache(Env::Default(), dbname, memory_size);
}
#ifdef OS_LINUX
static void UniqueIdCallback(void* arg) {
int* result = reinterpret_cast<int*>(arg);
if (*result == -1) {
@ -207,13 +212,16 @@ static void UniqueIdCallback(void* arg) {
rocksdb::SyncPoint::GetInstance()->SetCallBack(
"GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback);
}
#endif
PersistentCacheDBTest::PersistentCacheDBTest() : DBTestBase("/cache_test") {
#ifdef OS_LINUX
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
rocksdb::SyncPoint::GetInstance()->SetCallBack(
"GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback);
rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT",
OnOpenForRead);
#endif
}
// test template

Loading…
Cancel
Save