From 726c2f7e5b25061721f7dc48f6c8e90a20dddcd9 Mon Sep 17 00:00:00 2001 From: krad Date: Mon, 1 Aug 2016 15:22:58 -0700 Subject: [PATCH] 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 --- utilities/persistent_cache/block_cache_tier.cc | 2 +- utilities/persistent_cache/persistent_cache_test.cc | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/utilities/persistent_cache/block_cache_tier.cc b/utilities/persistent_cache/block_cache_tier.cc index 271758f51..ec6d68f24 100644 --- a/utilities/persistent_cache/block_cache_tier.cc +++ b/utilities/persistent_cache/block_cache_tier.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; diff --git a/utilities/persistent_cache/persistent_cache_test.cc b/utilities/persistent_cache/persistent_cache_test.cc index 28c1242e4..9d24dfbde 100644 --- a/utilities/persistent_cache/persistent_cache_test.cc +++ b/utilities/persistent_cache/persistent_cache_test.cc @@ -20,6 +20,7 @@ namespace rocksdb { static const double kStressFactor = .125; +#ifdef OS_LINUX static void OnOpenForRead(void* arg) { int* val = static_cast(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 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 MakeTieredCache( return NewTieredCache(Env::Default(), dbname, memory_size); } +#ifdef OS_LINUX static void UniqueIdCallback(void* arg) { int* result = reinterpret_cast(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