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; return false;
} }
assert(!f->refs_); assert(!f->refs_);
size_t file_size; uint64_t file_size;
if (!f->Delete(&file_size).ok()) { if (!f->Delete(&file_size).ok()) {
// unable to delete file // unable to delete file
return false; return false;

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

Loading…
Cancel
Save