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
This commit is contained in:
Andrew Kryczka 2018-01-30 16:41:21 -08:00 committed by Facebook Github Bot
parent ec225d2e97
commit ab5ab36ac2
1 changed files with 11 additions and 5 deletions

View File

@ -1820,11 +1820,17 @@ TEST_F(DBTest2, ReadAmpBitmap) {
#ifndef OS_SOLARIS // GetUniqueIdFromFile is not implemented #ifndef OS_SOLARIS // GetUniqueIdFromFile is not implemented
TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) { TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) {
if (dbname_.find("dev/shm") != std::string::npos) { {
// /dev/shm dont support getting a unique file id, this mean that const int kIdBufLen = 100;
// running this test on /dev/shm will fail because lru_cache will load char id_buf[kIdBufLen];
// the blocks again regardless of them being already in the cache std::unique_ptr<RandomAccessFile> file;
return; 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}; uint32_t bytes_per_bit[2] = {1, 16};
for (size_t k = 0; k < 2; k++) { for (size_t k = 0; k < 2; k++) {