From 8234faabfd3eb4430c20dd0ec3b882c90afa7b07 Mon Sep 17 00:00:00 2001 From: omegaga Date: Wed, 3 Aug 2016 14:23:21 -0700 Subject: [PATCH] Fix failed test Summary: Fix failed persistent cache test introduced by recent PR to support cross-platform build. Test Plan: Run persistent_cache_test (on multiple platforms) Reviewers: sdong Reviewed By: sdong Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D61467 --- utilities/persistent_cache/block_cache_tier.h | 7 ++----- utilities/persistent_cache/persistent_cache_tier.h | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/utilities/persistent_cache/block_cache_tier.h b/utilities/persistent_cache/block_cache_tier.h index d0767abd6..cc917c0f4 100644 --- a/utilities/persistent_cache/block_cache_tier.h +++ b/utilities/persistent_cache/block_cache_tier.h @@ -68,11 +68,8 @@ class BlockCacheTier : public PersistentCacheTier { void TEST_Flush() override { while (insert_ops_.Size()) { -#ifdef OS_WIN - Sleep(1000); -#else - /* sleep override */ sleep(1); -#endif + /* sleep override */ + Env::Default()->SleepForMicroseconds(1000000); } } diff --git a/utilities/persistent_cache/persistent_cache_tier.h b/utilities/persistent_cache/persistent_cache_tier.h index de088feb0..2717742a2 100644 --- a/utilities/persistent_cache/persistent_cache_tier.h +++ b/utilities/persistent_cache/persistent_cache_tier.h @@ -200,7 +200,8 @@ struct PersistentCacheConfig { // file size in order to avoid dead lock. size_t write_buffer_count() const { assert(write_buffer_size); - return (writer_qdepth + writer_qdepth/5) * cache_file_size / write_buffer_size; + return static_cast((writer_qdepth + 1.2) * cache_file_size / + write_buffer_size); } // writer-dispatch-size