From ab5ab36ac2b23f084b5670346c72d532e38d260d Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Tue, 30 Jan 2018 16:41:21 -0800 Subject: [PATCH] fix DBTest2.ReadAmpBitmapLiveInCacheAfterDBClose file ID support check Summary: Updated the test case to handle tmpfs mounted at directories different from "/dev/shm/". Closes https://github.com/facebook/rocksdb/pull/3440 Differential Revision: D6848213 Pulled By: ajkr fbshipit-source-id: 465e9dbf0921d0930161f732db6b3766bb030589 --- db/db_test2.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/db/db_test2.cc b/db/db_test2.cc index c0fbc7730..ee591d3bb 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -1820,11 +1820,17 @@ TEST_F(DBTest2, ReadAmpBitmap) { #ifndef OS_SOLARIS // GetUniqueIdFromFile is not implemented TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) { - if (dbname_.find("dev/shm") != std::string::npos) { - // /dev/shm dont support getting a unique file id, this mean that - // running this test on /dev/shm will fail because lru_cache will load - // the blocks again regardless of them being already in the cache - return; + { + const int kIdBufLen = 100; + char id_buf[kIdBufLen]; + std::unique_ptr file; + env_->NewRandomAccessFile(dbname_, &file, EnvOptions()); + if (file->GetUniqueId(id_buf, kIdBufLen) == 0) { + // fs holding db directory doesn't support getting a unique file id, + // this means that running this test will fail because lru_cache will load + // the blocks again regardless of them being already in the cache + return; + } } uint32_t bytes_per_bit[2] = {1, 16}; for (size_t k = 0; k < 2; k++) {