Per-thread unique test db names (#4135)

Summary:
The patch makes sure that two parallel test threads will operate on different db paths. This enables using open source tools such as gtest-parallel to run the tests of a file in parallel.
Example: ``` ~/gtest-parallel/gtest-parallel ./table_test```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4135

Differential Revision: D8846653

Pulled By: maysamyabandeh

fbshipit-source-id: 799bad1abb260e3d346bcb680d2ae207a852ba84
main
Maysam Yabandeh 6 years ago committed by Facebook Github Bot
parent 23b76252c8
commit 8581a93a6b
  1. 2
      db/column_family_test.cc
  2. 2
      db/compact_files_test.cc
  3. 2
      db/compaction_job_stats_test.cc
  4. 2
      db/compaction_job_test.cc
  5. 2
      db/comparator_db_test.cc
  6. 2
      db/corruption_test.cc
  7. 2
      db/cuckoo_table_db_test.cc
  8. 2
      db/db_basic_test.cc
  9. 4
      db/db_test.cc
  10. 2
      db/db_test2.cc
  11. 2
      db/db_test_util.cc
  12. 2
      db/deletefile_test.cc
  13. 10
      db/fault_injection_test.cc
  14. 2
      db/flush_job_test.cc
  15. 2
      db/forward_iterator_bench.cc
  16. 2
      db/manual_compaction_test.cc
  17. 2
      db/memtable_list_test.cc
  18. 7
      db/merge_test.cc
  19. 2
      db/obsolete_files_test.cc
  20. 2
      db/options_file_test.cc
  21. 2
      db/perf_context_test.cc
  22. 2
      db/plain_table_db_test.cc
  23. 2
      db/prefix_test.cc
  24. 2
      db/version_set_test.cc
  25. 2
      db/wal_manager_test.cc
  26. 2
      db/write_callback_test.cc
  27. 2
      env/env_basic_test.cc
  28. 32
      env/env_test.cc
  29. 22
      table/cuckoo_table_builder_test.cc
  30. 14
      table/cuckoo_table_reader_test.cc
  31. 6
      table/table_reader_bench.cc
  32. 6
      table/table_test.cc
  33. 3
      tools/db_bench_tool.cc
  34. 2
      tools/db_bench_tool_test.cc
  35. 2
      tools/reduce_levels_test.cc
  36. 7
      util/auto_roll_logger_test.cc
  37. 6
      util/delete_scheduler_test.cc
  38. 5
      util/filelock_test.cc
  39. 2
      util/log_write_bench.cc
  40. 2
      util/slice_transform_test.cc
  41. 14
      util/testharness.cc
  42. 5
      util/testharness.h
  43. 4
      utilities/backupable/backupable_db_test.cc
  44. 2
      utilities/blob_db/blob_db_test.cc
  45. 2
      utilities/cassandra/cassandra_functional_test.cc
  46. 8
      utilities/checkpoint/checkpoint_test.cc
  47. 2
      utilities/date_tiered/date_tiered_test.cc
  48. 2
      utilities/document/document_db_test.cc
  49. 3
      utilities/geodb/geodb_test.cc
  50. 20
      utilities/lua/rocks_lua_test.cc
  51. 2
      utilities/memory/memory_test.cc
  52. 2
      utilities/merge_operators/string_append/stringappend_test.cc
  53. 2
      utilities/options/options_util_test.cc
  54. 2
      utilities/persistent_cache/persistent_cache_test.cc
  55. 2
      utilities/redis/redis_lists_test.cc
  56. 2
      utilities/simulator_cache/sim_cache_test.cc
  57. 2
      utilities/spatialdb/spatial_db_test.cc
  58. 2
      utilities/transactions/optimistic_transaction_test.cc
  59. 2
      utilities/transactions/transaction_test.h
  60. 2
      utilities/transactions/write_prepared_transaction_test.cc
  61. 2
      utilities/ttl/ttl_test.cc
  62. 10
      utilities/write_batch_with_index/write_batch_with_index_test.cc

@ -61,7 +61,7 @@ class ColumnFamilyTestBase : public testing::Test {
public:
ColumnFamilyTestBase(uint32_t format) : rnd_(139), format_(format) {
env_ = new EnvCounter(Env::Default());
dbname_ = test::TmpDir() + "/column_family_test";
dbname_ = test::PerThreadDBPath("column_family_test");
db_options_.create_if_missing = true;
db_options_.fail_if_options_file_error = true;
db_options_.env = env_;

@ -24,7 +24,7 @@ class CompactFilesTest : public testing::Test {
public:
CompactFilesTest() {
env_ = Env::Default();
db_name_ = test::TmpDir(env_) + "/compact_files_test";
db_name_ = test::PerThreadDBPath("compact_files_test");
}
std::string db_name_;

@ -98,7 +98,7 @@ class CompactionJobStatsTest : public testing::Test,
CompactionJobStatsTest() : env_(Env::Default()) {
env_->SetBackgroundThreads(1, Env::LOW);
env_->SetBackgroundThreads(1, Env::HIGH);
dbname_ = test::TmpDir(env_) + "/compaction_job_stats_test";
dbname_ = test::PerThreadDBPath("compaction_job_stats_test");
alternative_wal_dir_ = dbname_ + "/wal";
Options options;
options.create_if_missing = true;

@ -68,7 +68,7 @@ class CompactionJobTest : public testing::Test {
public:
CompactionJobTest()
: env_(Env::Default()),
dbname_(test::TmpDir() + "/compaction_job_test"),
dbname_(test::PerThreadDBPath("compaction_job_test")),
db_options_(),
mutable_cf_options_(cf_options_),
table_cache_(NewLRUCache(50000, 16)),

@ -264,7 +264,7 @@ class ComparatorDBTest
public:
ComparatorDBTest() : env_(Env::Default()), db_(nullptr) {
comparator = BytewiseComparator();
dbname_ = test::TmpDir() + "/comparator_db_test";
dbname_ = test::PerThreadDBPath("comparator_db_test");
BlockBasedTableOptions toptions;
toptions.format_version = GetParam();
last_options_.table_factory.reset(

@ -48,7 +48,7 @@ class CorruptionTest : public testing::Test {
tiny_cache_ = NewLRUCache(100, 4);
options_.wal_recovery_mode = WALRecoveryMode::kTolerateCorruptedTailRecords;
options_.env = &env_;
dbname_ = test::TmpDir() + "/corruption_test";
dbname_ = test::PerThreadDBPath("corruption_test");
DestroyDB(dbname_, options_);
db_ = nullptr;

@ -25,7 +25,7 @@ class CuckooTableDBTest : public testing::Test {
public:
CuckooTableDBTest() : env_(Env::Default()) {
dbname_ = test::TmpDir() + "/cuckoo_table_db_test";
dbname_ = test::PerThreadDBPath("cuckoo_table_db_test");
EXPECT_OK(DestroyDB(dbname_, Options()));
db_ = nullptr;
Reopen();

@ -892,7 +892,7 @@ class TestEnv : public EnvWrapper {
TEST_F(DBBasicTest, DBClose) {
Options options = GetDefaultOptions();
std::string dbname = test::TmpDir(env_) + "/db_close_test";
std::string dbname = test::PerThreadDBPath("db_close_test");
ASSERT_OK(DestroyDB(dbname, options));
DB* db = nullptr;

@ -1682,7 +1682,7 @@ TEST_F(DBTest, CustomComparator) {
TEST_F(DBTest, DBOpen_Options) {
Options options = CurrentOptions();
std::string dbname = test::TmpDir(env_) + "/db_options_test";
std::string dbname = test::PerThreadDBPath("db_options_test");
ASSERT_OK(DestroyDB(dbname, options));
// Does not exist, and create_if_missing == false: error
@ -1740,7 +1740,7 @@ TEST_F(DBTest, DBOpen_Change_NumLevels) {
}
TEST_F(DBTest, DestroyDBMetaDatabase) {
std::string dbname = test::TmpDir(env_) + "/db_meta";
std::string dbname = test::PerThreadDBPath("db_meta");
ASSERT_OK(env_->CreateDirIfMissing(dbname));
std::string metadbname = MetaDatabaseName(dbname, 0);
ASSERT_OK(env_->CreateDirIfMissing(metadbname));

@ -354,7 +354,7 @@ INSTANTIATE_TEST_CASE_P(DBTestSharedWriteBufferAcrossCFs,
std::make_tuple(false, true)));
TEST_F(DBTest2, SharedWriteBufferLimitAcrossDB) {
std::string dbname2 = test::TmpDir(env_) + "/db_shared_wb_db2";
std::string dbname2 = test::PerThreadDBPath("db_shared_wb_db2");
Options options = CurrentOptions();
options.arena_block_size = 4096;
// Avoid undeterministic value by malloc_usable_size();

@ -63,7 +63,7 @@ DBTestBase::DBTestBase(const std::string path)
option_config_(kDefault) {
env_->SetBackgroundThreads(1, Env::LOW);
env_->SetBackgroundThreads(1, Env::HIGH);
dbname_ = test::TmpDir(env_) + path;
dbname_ = test::PerThreadDBPath(env_, path);
alternative_wal_dir_ = dbname_ + "/wal";
alternative_db_log_dir_ = dbname_ + "/db_log_dir";
auto options = CurrentOptions();

@ -45,7 +45,7 @@ class DeleteFileTest : public testing::Test {
options_.max_bytes_for_level_base = 1024*1024*1000;
options_.WAL_ttl_seconds = 300; // Used to test log files
options_.WAL_size_limit_MB = 1024; // Used to test log files
dbname_ = test::TmpDir() + "/deletefile_test";
dbname_ = test::PerThreadDBPath("deletefile_test");
options_.wal_dir = dbname_ + "/wal_files";
// clean up all the files that might have been there before

@ -107,18 +107,18 @@ class FaultInjectionTest
Options options;
switch (option_config_) {
case kWalDir:
options.wal_dir = test::TmpDir(env_) + "/fault_test_wal";
options.wal_dir = test::PerThreadDBPath(env_, "fault_test_wal");
break;
case kDifferentDataDir:
options.db_paths.emplace_back(test::TmpDir(env_) + "/fault_test_data",
1000000U);
options.db_paths.emplace_back(
test::PerThreadDBPath(env_, "fault_test_data"), 1000000U);
break;
case kSyncWal:
sync_use_wal_ = true;
sync_use_compact_ = false;
break;
case kWalDirSyncWal:
options.wal_dir = test::TmpDir(env_) + "/fault_test_wal";
options.wal_dir = test::PerThreadDBPath(env_, "/fault_test_wal");
sync_use_wal_ = true;
sync_use_compact_ = false;
break;
@ -158,7 +158,7 @@ class FaultInjectionTest
table_options.block_cache = tiny_cache_;
options_.table_factory.reset(NewBlockBasedTableFactory(table_options));
dbname_ = test::TmpDir() + "/fault_test";
dbname_ = test::PerThreadDBPath("fault_test");
EXPECT_OK(DestroyDB(dbname_, options_));

@ -27,7 +27,7 @@ class FlushJobTest : public testing::Test {
public:
FlushJobTest()
: env_(Env::Default()),
dbname_(test::TmpDir() + "/flush_job_test"),
dbname_(test::PerThreadDBPath("flush_job_test")),
options_(),
db_options_(options_),
table_cache_(NewLRUCache(50000, 16)),

@ -323,7 +323,7 @@ int main(int argc, char** argv) {
std::mt19937 rng{std::random_device()()};
rocksdb::Status status;
std::string path = rocksdb::test::TmpDir() + "/forward_iterator_test";
std::string path = rocksdb::test::PerThreadDBPath("forward_iterator_test");
fprintf(stderr, "db path is %s\n", path.c_str());
rocksdb::Options options;
options.create_if_missing = true;

@ -40,7 +40,7 @@ class ManualCompactionTest : public testing::Test {
public:
ManualCompactionTest() {
// Get rid of any state from an old run.
dbname_ = rocksdb::test::TmpDir() + "/rocksdb_cbug_test";
dbname_ = rocksdb::test::PerThreadDBPath("rocksdb_cbug_test");
DestroyDB(dbname_, rocksdb::Options());
}

@ -27,7 +27,7 @@ class MemTableListTest : public testing::Test {
Options options;
MemTableListTest() : db(nullptr) {
dbname = test::TmpDir() + "/memtable_list_test";
dbname = test::PerThreadDBPath("memtable_list_test");
}
// Create a test db if not yet created

@ -484,20 +484,19 @@ void runTest(const std::string& dbname, const bool use_ttl = false) {
*/
}
TEST_F(MergeTest, MergeDbTest) {
runTest(test::TmpDir() + "/merge_testdb");
runTest(test::PerThreadDBPath("merge_testdb"));
}
#ifndef ROCKSDB_LITE
TEST_F(MergeTest, MergeDbTtlTest) {
runTest(test::TmpDir() + "/merge_testdbttl", true); // Run test on TTL database
runTest(test::PerThreadDBPath("merge_testdbttl"),
true); // Run test on TTL database
}
#endif // !ROCKSDB_LITE
} // namespace rocksdb
int main(int argc, char** argv) {
rocksdb::use_compression = false;
if (argc > 1) {

@ -53,7 +53,7 @@ class ObsoleteFilesTest : public testing::Test {
options_.max_bytes_for_level_base = 1024*1024*1000;
options_.WAL_ttl_seconds = 300; // Used to test log files
options_.WAL_size_limit_MB = 1024; // Used to test log files
dbname_ = test::TmpDir() + "/obsolete_files_test";
dbname_ = test::PerThreadDBPath("obsolete_files_test");
options_.wal_dir = dbname_ + "/wal_files";
// clean up all the files that might have been there before

@ -15,7 +15,7 @@
namespace rocksdb {
class OptionsFileTest : public testing::Test {
public:
OptionsFileTest() : dbname_(test::TmpDir() + "/options_file_test") {}
OptionsFileTest() : dbname_(test::PerThreadDBPath("options_file_test")) {}
std::string dbname_;
};

@ -30,7 +30,7 @@ int FLAGS_min_write_buffer_number_to_merge = 7;
bool FLAGS_verbose = false;
// Path to the database on file system
const std::string kDbName = rocksdb::test::TmpDir() + "/perf_context_test";
const std::string kDbName = rocksdb::test::PerThreadDBPath("perf_context_test");
namespace rocksdb {

@ -115,7 +115,7 @@ class PlainTableDBTest : public testing::Test,
void SetUp() override {
mmap_mode_ = GetParam();
dbname_ = test::TmpDir() + "/plain_table_db_test";
dbname_ = test::PerThreadDBPath("plain_table_db_test");
EXPECT_OK(DestroyDB(dbname_, Options()));
db_ = nullptr;
Reopen();

@ -53,7 +53,7 @@ DEFINE_int32(value_size, 40, "");
DEFINE_bool(enable_print, false, "Print options generated to console.");
// Path to the database on file system
const std::string kDbName = rocksdb::test::TmpDir() + "/prefix_test";
const std::string kDbName = rocksdb::test::PerThreadDBPath("prefix_test");
namespace rocksdb {

@ -458,7 +458,7 @@ class ManifestWriterTest : public testing::Test {
public:
ManifestWriterTest()
: env_(Env::Default()),
dbname_(test::TmpDir() + "/version_set_test"),
dbname_(test::PerThreadDBPath("version_set_test")),
db_options_(),
mutable_cf_options_(cf_options_),
table_cache_(NewLRUCache(50000, 16)),

@ -32,7 +32,7 @@ class WalManagerTest : public testing::Test {
public:
WalManagerTest()
: env_(new MockEnv(Env::Default())),
dbname_(test::TmpDir() + "/wal_manager_test"),
dbname_(test::PerThreadDBPath("wal_manager_test")),
db_options_(),
table_cache_(NewLRUCache(50000, 16)),
write_buffer_manager_(db_options_.db_write_buffer_size),

@ -29,7 +29,7 @@ class WriteCallbackTest : public testing::Test {
string dbname;
WriteCallbackTest() {
dbname = test::TmpDir() + "/write_callback_testdb";
dbname = test::PerThreadDBPath("write_callback_testdb");
}
};

@ -57,7 +57,7 @@ class EnvBasicTestWithParam : public testing::Test,
std::string test_dir_;
EnvBasicTestWithParam() : env_(GetParam()) {
test_dir_ = test::TmpDir(env_) + "/env_basic_test";
test_dir_ = test::PerThreadDBPath(env_, "env_basic_test");
}
void SetUp() {

32
env/env_test.cc vendored

@ -156,7 +156,7 @@ TEST_F(EnvPosixTest, AreFilesSame) {
const EnvOptions soptions;
auto* env = Env::Default();
std::string same_file_name = test::TmpDir(env) + "/same_file";
std::string same_file_name = test::PerThreadDBPath(env, "same_file");
std::string same_file_link_name = same_file_name + "_link";
std::unique_ptr<WritableFile> same_file;
@ -178,8 +178,9 @@ TEST_F(EnvPosixTest, DISABLED_FilePermission) {
// Only works for Linux environment
if (env_ == Env::Default()) {
EnvOptions soptions;
std::vector<std::string> fileNames {
test::TmpDir(env_) + "/testfile", test::TmpDir(env_) + "/testfile1"};
std::vector<std::string> fileNames{
test::PerThreadDBPath(env_, "testfile"),
test::PerThreadDBPath(env_, "testfile1")};
unique_ptr<WritableFile> wfile;
ASSERT_OK(env_->NewWritableFile(fileNames[0], &wfile, soptions));
ASSERT_OK(env_->NewWritableFile(fileNames[1], &wfile, soptions));
@ -214,7 +215,7 @@ TEST_F(EnvPosixTest, DISABLED_FilePermission) {
TEST_F(EnvPosixTest, MemoryMappedFileBuffer) {
const int kFileBytes = 1 << 15; // 32 KB
std::string expected_data;
std::string fname = test::TmpDir(env_) + "/" + "testfile";
std::string fname = test::PerThreadDBPath(env_, "testfile");
{
unique_ptr<WritableFile> wfile;
const EnvOptions soptions;
@ -1067,7 +1068,7 @@ TEST_P(EnvPosixTestWithParam, InvalidateCache) {
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
EnvOptions soptions;
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
std::string fname = test::TmpDir(env_) + "/" + "testfile";
std::string fname = test::PerThreadDBPath(env_, "testfile");
const size_t kSectorSize = 512;
auto data = NewAligned(kSectorSize, 0);
@ -1250,10 +1251,10 @@ TEST_P(EnvPosixTestWithParam, LogBufferMaxSizeTest) {
TEST_P(EnvPosixTestWithParam, Preallocation) {
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
const std::string src = test::TmpDir(env_) + "/" + "testfile";
unique_ptr<WritableFile> srcfile;
EnvOptions soptions;
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
const std::string src = test::PerThreadDBPath(env_, "testfile");
unique_ptr<WritableFile> srcfile;
EnvOptions soptions;
soptions.use_direct_reads = soptions.use_direct_writes = direct_io_;
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
if (soptions.use_direct_writes) {
rocksdb::SyncPoint::GetInstance()->SetCallBack(
@ -1312,9 +1313,8 @@ TEST_P(EnvPosixTestWithParam, ConsistentChildrenAttributes) {
std::string data;
for (int i = 0; i < kNumChildren; ++i) {
std::ostringstream oss;
oss << test::TmpDir(env_) << "/testfile_" << i;
const std::string path = oss.str();
const std::string path =
test::TmpDir(env_) + "/" + "testfile_" + std::to_string(i);
unique_ptr<WritableFile> file;
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX) && !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
if (soptions.use_direct_writes) {
@ -1335,9 +1335,7 @@ TEST_P(EnvPosixTestWithParam, ConsistentChildrenAttributes) {
std::vector<Env::FileAttributes> file_attrs;
ASSERT_OK(env_->GetChildrenFileAttributes(test::TmpDir(env_), &file_attrs));
for (int i = 0; i < kNumChildren; ++i) {
std::ostringstream oss;
oss << "testfile_" << i;
const std::string name = oss.str();
const std::string name = "testfile_" + std::to_string(i);
const std::string path = test::TmpDir(env_) + "/" + name;
auto file_attrs_iter = std::find_if(
@ -1438,7 +1436,7 @@ TEST_P(EnvPosixTestWithParam, WritableFileWrapper) {
}
TEST_P(EnvPosixTestWithParam, PosixRandomRWFile) {
const std::string path = test::TmpDir(env_) + "/random_rw_file";
const std::string path = test::PerThreadDBPath(env_, "random_rw_file");
env_->DeleteFile(path);
@ -1566,7 +1564,7 @@ class RandomRWFileWithMirrorString {
};
TEST_P(EnvPosixTestWithParam, PosixRandomRWFileRandomized) {
const std::string path = test::TmpDir(env_) + "/random_rw_file_rand";
const std::string path = test::PerThreadDBPath(env_, "random_rw_file_rand");
env_->DeleteFile(path);
unique_ptr<RandomRWFile> file;

@ -153,7 +153,7 @@ class CuckooBuilderTest : public testing::Test {
TEST_F(CuckooBuilderTest, SuccessWithEmptyFile) {
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/EmptyFile";
fname = test::PerThreadDBPath("EmptyFile");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -189,7 +189,7 @@ TEST_F(CuckooBuilderTest, WriteSuccessNoCollisionFullKey) {
uint64_t expected_table_size = GetExpectedTableSize(keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/NoCollisionFullKey";
fname = test::PerThreadDBPath("NoCollisionFullKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -237,7 +237,7 @@ TEST_F(CuckooBuilderTest, WriteSuccessWithCollisionFullKey) {
uint64_t expected_table_size = GetExpectedTableSize(keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/WithCollisionFullKey";
fname = test::PerThreadDBPath("WithCollisionFullKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -286,7 +286,7 @@ TEST_F(CuckooBuilderTest, WriteSuccessWithCollisionAndCuckooBlock) {
unique_ptr<WritableFile> writable_file;
uint32_t cuckoo_block_size = 2;
fname = test::TmpDir() + "/WithCollisionFullKey2";
fname = test::PerThreadDBPath("WithCollisionFullKey2");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -339,7 +339,7 @@ TEST_F(CuckooBuilderTest, WithCollisionPathFullKey) {
uint64_t expected_table_size = GetExpectedTableSize(keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/WithCollisionPathFullKey";
fname = test::PerThreadDBPath("WithCollisionPathFullKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -389,7 +389,7 @@ TEST_F(CuckooBuilderTest, WithCollisionPathFullKeyAndCuckooBlock) {
uint64_t expected_table_size = GetExpectedTableSize(keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/WithCollisionPathFullKeyAndCuckooBlock";
fname = test::PerThreadDBPath("WithCollisionPathFullKeyAndCuckooBlock");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -432,7 +432,7 @@ TEST_F(CuckooBuilderTest, WriteSuccessNoCollisionUserKey) {
uint64_t expected_table_size = GetExpectedTableSize(user_keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/NoCollisionUserKey";
fname = test::PerThreadDBPath("NoCollisionUserKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -476,7 +476,7 @@ TEST_F(CuckooBuilderTest, WriteSuccessWithCollisionUserKey) {
uint64_t expected_table_size = GetExpectedTableSize(user_keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/WithCollisionUserKey";
fname = test::PerThreadDBPath("WithCollisionUserKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -522,7 +522,7 @@ TEST_F(CuckooBuilderTest, WithCollisionPathUserKey) {
uint64_t expected_table_size = GetExpectedTableSize(user_keys.size());
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/WithCollisionPathUserKey";
fname = test::PerThreadDBPath("WithCollisionPathUserKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -567,7 +567,7 @@ TEST_F(CuckooBuilderTest, FailWhenCollisionPathTooLong) {
hash_map = std::move(hm);
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/WithCollisionPathUserKey";
fname = test::PerThreadDBPath("WithCollisionPathUserKey");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));
@ -595,7 +595,7 @@ TEST_F(CuckooBuilderTest, FailWhenSameKeyInserted) {
std::string user_key = "repeatedkey";
unique_ptr<WritableFile> writable_file;
fname = test::TmpDir() + "/FailWhenSameKeyInserted";
fname = test::PerThreadDBPath("FailWhenSameKeyInserted");
ASSERT_OK(env_->NewWritableFile(fname, &writable_file, env_options_));
unique_ptr<WritableFileWriter> file_writer(
new WritableFileWriter(std::move(writable_file), EnvOptions()));

@ -215,7 +215,7 @@ class CuckooReaderTest : public testing::Test {
TEST_F(CuckooReaderTest, WhenKeyExists) {
SetUp(kNumHashFunc);
fname = test::TmpDir() + "/CuckooReader_WhenKeyExists";
fname = test::PerThreadDBPath("CuckooReader_WhenKeyExists");
for (uint64_t i = 0; i < num_items; i++) {
user_keys[i] = "key" + NumToStr(i);
ParsedInternalKey ikey(user_keys[i], i + 1000, kTypeValue);
@ -242,7 +242,7 @@ TEST_F(CuckooReaderTest, WhenKeyExists) {
TEST_F(CuckooReaderTest, WhenKeyExistsWithUint64Comparator) {
SetUp(kNumHashFunc);
fname = test::TmpDir() + "/CuckooReaderUint64_WhenKeyExists";
fname = test::PerThreadDBPath("CuckooReaderUint64_WhenKeyExists");
for (uint64_t i = 0; i < num_items; i++) {
user_keys[i].resize(8);
memcpy(&user_keys[i][0], static_cast<void*>(&i), 8);
@ -270,7 +270,7 @@ TEST_F(CuckooReaderTest, WhenKeyExistsWithUint64Comparator) {
TEST_F(CuckooReaderTest, CheckIterator) {
SetUp(2*kNumHashFunc);
fname = test::TmpDir() + "/CuckooReader_CheckIterator";
fname = test::PerThreadDBPath("CuckooReader_CheckIterator");
for (uint64_t i = 0; i < num_items; i++) {
user_keys[i] = "key" + NumToStr(i);
ParsedInternalKey ikey(user_keys[i], 1000, kTypeValue);
@ -289,7 +289,7 @@ TEST_F(CuckooReaderTest, CheckIterator) {
TEST_F(CuckooReaderTest, CheckIteratorUint64) {
SetUp(2*kNumHashFunc);
fname = test::TmpDir() + "/CuckooReader_CheckIterator";
fname = test::PerThreadDBPath("CuckooReader_CheckIterator");
for (uint64_t i = 0; i < num_items; i++) {
user_keys[i].resize(8);
memcpy(&user_keys[i][0], static_cast<void*>(&i), 8);
@ -310,7 +310,7 @@ TEST_F(CuckooReaderTest, CheckIteratorUint64) {
TEST_F(CuckooReaderTest, WhenKeyNotFound) {
// Add keys with colliding hash values.
SetUp(kNumHashFunc);
fname = test::TmpDir() + "/CuckooReader_WhenKeyNotFound";
fname = test::PerThreadDBPath("CuckooReader_WhenKeyNotFound");
for (uint64_t i = 0; i < num_items; i++) {
user_keys[i] = "key" + NumToStr(i);
ParsedInternalKey ikey(user_keys[i], i + 1000, kTypeValue);
@ -395,8 +395,8 @@ std::string GetFileName(uint64_t num) {
if (FLAGS_file_dir.empty()) {
FLAGS_file_dir = test::TmpDir();
}
return FLAGS_file_dir + "/cuckoo_read_benchmark" +
ToString(num/1000000) + "Mkeys";
return test::PerThreadDBPath(FLAGS_file_dir, "cuckoo_read_benchmark") +
ToString(num / 1000000) + "Mkeys";
}
// Create last level file as we are interested in measuring performance of

@ -75,9 +75,9 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options,
bool through_db, bool measured_by_nanosecond) {
rocksdb::InternalKeyComparator ikc(opts.comparator);
std::string file_name = test::TmpDir()
+ "/rocksdb_table_reader_benchmark";
std::string dbname = test::TmpDir() + "/rocksdb_table_reader_bench_db";
std::string file_name =
test::PerThreadDBPath("rocksdb_table_reader_benchmark");
std::string dbname = test::PerThreadDBPath("rocksdb_table_reader_bench_db");
WriteOptions wo;
Env* env = Env::Default();
TableBuilder* tb = nullptr;

@ -547,7 +547,7 @@ class DBConstructor: public Constructor {
private:
void NewDB() {
std::string name = test::TmpDir() + "/table_testdb";
std::string name = test::PerThreadDBPath("table_testdb");
Options options;
options.comparator = comparator_;
@ -3109,7 +3109,7 @@ TEST_F(PrefixTest, PrefixAndWholeKeyTest) {
bbto.block_size = 262144;
bbto.whole_key_filtering = true;
const std::string kDBPath = test::TmpDir() + "/table_prefix_test";
const std::string kDBPath = test::PerThreadDBPath("table_prefix_test");
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
DestroyDB(kDBPath, options);
rocksdb::DB* db;
@ -3502,7 +3502,7 @@ TEST_P(BlockBasedTableTest, BadOptions) {
bbto.block_align = true;
const std::string kDBPath =
test::TmpDir() + "/block_based_table_bad_options_test";
test::PerThreadDBPath("block_based_table_bad_options_test");
options.table_factory.reset(NewBlockBasedTableFactory(bbto));
DestroyDB(kDBPath, options);
rocksdb::DB* db;

@ -525,8 +525,7 @@ DEFINE_bool(read_cache_direct_write, true,
DEFINE_bool(read_cache_direct_read, true,
"Whether to use Direct IO for reading from read cache");
DEFINE_bool(use_keep_filter, false,
"Whether to use a noop compaction filter");
DEFINE_bool(use_keep_filter, false, "Whether to use a noop compaction filter");
static bool ValidateCacheNumshardbits(const char* flagname, int32_t value) {
if (value >= 20) {

@ -26,7 +26,7 @@ static const size_t kArgBufferSize = 100000;
class DBBenchTest : public testing::Test {
public:
DBBenchTest() : rnd_(0xFB) {
test_path_ = test::TmpDir() + "/db_bench_test";
test_path_ = test::PerThreadDBPath("db_bench_test");
Env::Default()->CreateDir(test_path_);
db_path_ = test_path_ + "/db";
wal_path_ = test_path_ + "/wal";

@ -20,7 +20,7 @@ namespace rocksdb {
class ReduceLevelTest : public testing::Test {
public:
ReduceLevelTest() {
dbname_ = test::TmpDir() + "/db_reduce_levels_test";
dbname_ = test::PerThreadDBPath("db_reduce_levels_test");
DestroyDB(dbname_, Options());
db_ = nullptr;
}

@ -71,9 +71,10 @@ class AutoRollLoggerTest : public testing::Test {
const std::string AutoRollLoggerTest::kSampleMessage(
"this is the message to be written to the log file!!");
const std::string AutoRollLoggerTest::kTestDir(test::TmpDir() + "/db_log_test");
const std::string AutoRollLoggerTest::kLogFile(test::TmpDir() +
"/db_log_test/LOG");
const std::string AutoRollLoggerTest::kTestDir(
test::PerThreadDBPath("db_log_test"));
const std::string AutoRollLoggerTest::kLogFile(
test::PerThreadDBPath("db_log_test") + "/LOG");
Env* AutoRollLoggerTest::default_env = Env::Default();
// In this test we only want to Log some simple log message with

@ -31,9 +31,9 @@ class DeleteSchedulerTest : public testing::Test {
const int kNumDataDirs = 3;
dummy_files_dirs_.reserve(kNumDataDirs);
for (size_t i = 0; i < kNumDataDirs; ++i) {
dummy_files_dirs_.emplace_back(test::TmpDir(env_) +
"/delete_scheduler_dummy_data_dir" +
ToString(i));
dummy_files_dirs_.emplace_back(
test::PerThreadDBPath(env_, "delete_scheduler_dummy_data_dir") +
ToString(i));
DestroyAndCreateDir(dummy_files_dirs_.back());
}
}

@ -19,8 +19,9 @@ class LockTest : public testing::Test {
std::string file_;
rocksdb::Env* env_;
LockTest() : file_(test::TmpDir() + "/db_testlock_file"),
env_(rocksdb::Env::Default()) {
LockTest()
: file_(test::PerThreadDBPath("db_testlock_file")),
env_(rocksdb::Env::Default()) {
current_ = this;
}

@ -31,7 +31,7 @@ DEFINE_bool(enable_sync, false, "sync after each write.");
namespace rocksdb {
void RunBenchmark() {
std::string file_name = test::TmpDir() + "/log_write_benchmark.log";
std::string file_name = test::PerThreadDBPath("log_write_benchmark.log");
Env* env = Env::Default();
EnvOptions env_options = env->OptimizeForLogWrite(EnvOptions());
env_options.bytes_per_sync = FLAGS_bytes_per_sync;

@ -53,7 +53,7 @@ class SliceTransformDBTest : public testing::Test {
public:
SliceTransformDBTest() : env_(Env::Default()), db_(nullptr) {
dbname_ = test::TmpDir() + "/slice_transform_db_test";
dbname_ = test::PerThreadDBPath("slice_transform_db_test");
EXPECT_OK(DestroyDB(dbname_, last_options_));
}

@ -9,6 +9,7 @@
#include "util/testharness.h"
#include <string>
#include <thread>
namespace rocksdb {
namespace test {
@ -29,6 +30,19 @@ std::string TmpDir(Env* env) {
return dir;
}
std::string PerThreadDBPath(std::string dir, std::string name) {
size_t tid = std::hash<std::thread::id>()(std::this_thread::get_id());
return dir + "/" + name + "_" + std::to_string(tid);
}
std::string PerThreadDBPath(std::string name) {
return PerThreadDBPath(test::TmpDir(), name);
}
std::string PerThreadDBPath(Env* env, std::string name) {
return PerThreadDBPath(test::TmpDir(env), name);
}
int RandomSeed() {
const char* env = getenv("TEST_RANDOM_SEED");
int result = (env != nullptr ? atoi(env) : 301);

@ -24,6 +24,11 @@ namespace test {
// Return the directory to use for temporary storage.
std::string TmpDir(Env* env = Env::Default());
// A path unique within the thread
std::string PerThreadDBPath(std::string name);
std::string PerThreadDBPath(Env* env, std::string name);
std::string PerThreadDBPath(std::string dir, std::string name);
// Return a randomization seed for this run. Typically returns the
// same number on repeated invocations of this binary, but automated
// runs may be able to vary the seed.

@ -477,8 +477,8 @@ class BackupableDBTest : public testing::Test {
public:
BackupableDBTest() {
// set up files
std::string db_chroot = test::TmpDir() + "/backupable_db";
std::string backup_chroot = test::TmpDir() + "/backupable_db_backup";
std::string db_chroot = test::PerThreadDBPath("backupable_db");
std::string backup_chroot = test::PerThreadDBPath("backupable_db_backup");
Env::Default()->CreateDir(db_chroot);
Env::Default()->CreateDir(backup_chroot);
dbname_ = "/tempdb";

@ -38,7 +38,7 @@ class BlobDBTest : public testing::Test {
};
BlobDBTest()
: dbname_(test::TmpDir() + "/blob_db_test"),
: dbname_(test::PerThreadDBPath("blob_db_test")),
mock_env_(new MockTimeEnv(Env::Default())),
blob_db_(nullptr) {
Status s = DestroyBlobDB(dbname_, Options(), BlobDBOptions());

@ -21,7 +21,7 @@ namespace rocksdb {
namespace cassandra {
// Path to the database on file system
const std::string kDbName = test::TmpDir() + "/cassandra_functional_test";
const std::string kDbName = test::PerThreadDBPath("cassandra_functional_test");
class CassandraStore {
public:

@ -47,7 +47,7 @@ class CheckpointTest : public testing::Test {
CheckpointTest() : env_(Env::Default()) {
env_->SetBackgroundThreads(1, Env::LOW);
env_->SetBackgroundThreads(1, Env::HIGH);
dbname_ = test::TmpDir(env_) + "/checkpoint_test";
dbname_ = test::PerThreadDBPath(env_, "checkpoint_test");
alternative_wal_dir_ = dbname_ + "/wal";
auto options = CurrentOptions();
auto delete_options = options;
@ -56,7 +56,7 @@ class CheckpointTest : public testing::Test {
// Destroy it for not alternative WAL dir is used.
EXPECT_OK(DestroyDB(dbname_, options));
db_ = nullptr;
snapshot_name_ = test::TmpDir(env_) + "/snapshot";
snapshot_name_ = test::PerThreadDBPath(env_, "snapshot");
std::string snapshot_tmp_name = snapshot_name_ + ".tmp";
EXPECT_OK(DestroyDB(snapshot_name_, options));
env_->DeleteDir(snapshot_name_);
@ -274,7 +274,7 @@ TEST_F(CheckpointTest, GetSnapshotLink) {
delete checkpoint;
// Restore DB name
dbname_ = test::TmpDir(env_) + "/db_test";
dbname_ = test::PerThreadDBPath(env_, "db_test");
}
}
@ -450,7 +450,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing) {
TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing2PC) {
Close();
const std::string dbname = test::TmpDir() + "/transaction_testdb";
const std::string dbname = test::PerThreadDBPath("transaction_testdb");
ASSERT_OK(DestroyDB(dbname, CurrentOptions()));
env_->DeleteDir(dbname);

@ -44,7 +44,7 @@ class DateTieredTest : public testing::Test {
public:
DateTieredTest() {
env_.reset(new SpecialTimeEnv(Env::Default()));
dbname_ = test::TmpDir() + "/date_tiered";
dbname_ = test::PerThreadDBPath("date_tiered");
options_.create_if_missing = true;
options_.env = env_.get();
date_tiered_db_.reset(nullptr);

@ -18,7 +18,7 @@ namespace rocksdb {
class DocumentDBTest : public testing::Test {
public:
DocumentDBTest() {
dbname_ = test::TmpDir() + "/document_db_test";
dbname_ = test::PerThreadDBPath("document_db_test");
DestroyDB(dbname_, Options());
}
~DocumentDBTest() {

@ -35,7 +35,8 @@ class GeoDBTest : public testing::Test {
}
};
const std::string GeoDBTest::kDefaultDbName = test::TmpDir() + "/geodb_test";
const std::string GeoDBTest::kDefaultDbName =
test::PerThreadDBPath("geodb_test");
Options GeoDBTest::options = Options();
// Insert, Get and Remove

@ -101,7 +101,7 @@ TEST_F(RocksLuaTest, Default) {
// If nothing is set in the LuaCompactionFilterOptions, then
// RocksDB will keep all the key / value pairs, but it will also
// print our error log indicating failure.
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
@ -116,7 +116,7 @@ TEST_F(RocksLuaTest, Default) {
}
TEST_F(RocksLuaTest, KeepsAll) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -145,7 +145,7 @@ TEST_F(RocksLuaTest, KeepsAll) {
}
TEST_F(RocksLuaTest, GetName) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -171,7 +171,7 @@ TEST_F(RocksLuaTest, GetName) {
}
TEST_F(RocksLuaTest, RemovesAll) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -202,7 +202,7 @@ TEST_F(RocksLuaTest, RemovesAll) {
}
TEST_F(RocksLuaTest, FilterByKey) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -240,7 +240,7 @@ TEST_F(RocksLuaTest, FilterByKey) {
}
TEST_F(RocksLuaTest, FilterByValue) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -279,7 +279,7 @@ TEST_F(RocksLuaTest, FilterByValue) {
}
TEST_F(RocksLuaTest, ChangeValue) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -312,7 +312,7 @@ TEST_F(RocksLuaTest, ChangeValue) {
}
TEST_F(RocksLuaTest, ConditionallyChangeAndFilterValue) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -357,7 +357,7 @@ TEST_F(RocksLuaTest, ConditionallyChangeAndFilterValue) {
}
TEST_F(RocksLuaTest, DynamicChangeScript) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
lua_opt.error_log = std::make_shared<StopOnErrorLogger>();
@ -433,7 +433,7 @@ TEST_F(RocksLuaTest, DynamicChangeScript) {
}
TEST_F(RocksLuaTest, LuaConditionalTypeError) {
std::string db_path = temp_dir_ + "/rocks_lua_test";
std::string db_path = test::PerThreadDBPath(temp_dir_, "rocks_lua_test");
lua::RocksLuaCompactionFilterOptions lua_opt;
// Filter() error when input key's initial >= 'r'

@ -19,7 +19,7 @@ namespace rocksdb {
class MemoryTest : public testing::Test {
public:
MemoryTest() : kDbDir(test::TmpDir() + "/memory_test"), rnd_(301) {
MemoryTest() : kDbDir(test::PerThreadDBPath("memory_test")), rnd_(301) {
assert(Env::Default()->CreateDirIfMissing(kDbDir).ok());
}

@ -23,7 +23,7 @@ using namespace rocksdb;
namespace rocksdb {
// Path to the database on file system
const std::string kDbName = test::TmpDir() + "/stringappend_test";
const std::string kDbName = test::PerThreadDBPath("stringappend_test");
namespace {
// OpenDb opens a (possibly new) rocksdb database with a StringAppendOperator

@ -34,7 +34,7 @@ class OptionsUtilTest : public testing::Test {
public:
OptionsUtilTest() : rnd_(0xFB) {
env_.reset(new test::StringEnv(Env::Default()));
dbname_ = test::TmpDir() + "/options_util_test";
dbname_ = test::PerThreadDBPath("options_util_test");
}
protected:

@ -132,7 +132,7 @@ std::unique_ptr<PersistentTieredCache> NewTieredCache(
}
PersistentCacheTierTest::PersistentCacheTierTest()
: path_(test::TmpDir(Env::Default()) + "/cache_test") {
: path_(test::PerThreadDBPath("cache_test")) {
#ifdef OS_LINUX
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT",

@ -39,7 +39,7 @@ class RedisListsTest : public testing::Test {
};
const std::string RedisListsTest::kDefaultDbName =
test::TmpDir() + "/redis_lists_test";
test::PerThreadDBPath("redis_lists_test");
Options RedisListsTest::options = Options();
// operator== and operator<< are defined below for vectors (lists)

@ -154,7 +154,7 @@ TEST_F(SimCacheTest, SimCacheLogging) {
Flush();
}
std::string log_file = test::TmpDir(env_) + "/cache_log.txt";
std::string log_file = test::PerThreadDBPath(env_, "cache_log.txt");
ASSERT_OK(sim_cache->StartActivityLogging(log_file, env_));
for (int i = 0; i < num_block_entries; i++) {
ASSERT_EQ(Get(Key(i)), "val");

@ -21,7 +21,7 @@ namespace spatial {
class SpatialDBTest : public testing::Test {
public:
SpatialDBTest() {
dbname_ = test::TmpDir() + "/spatial_db_test";
dbname_ = test::PerThreadDBPath("spatial_db_test");
DestroyDB(dbname_, Options());
}

@ -32,7 +32,7 @@ class OptimisticTransactionTest : public testing::Test {
OptimisticTransactionTest() {
options.create_if_missing = true;
options.max_write_buffer_number = 2;
dbname = test::TmpDir() + "/optimistic_transaction_testdb";
dbname = test::PerThreadDBPath("optimistic_transaction_testdb");
DestroyDB(dbname, options);
Open();

@ -60,7 +60,7 @@ class TransactionTestBase : public ::testing::Test {
env = new FaultInjectionTestEnv(Env::Default());
options.env = env;
options.two_write_queues = two_write_queue;
dbname = test::TmpDir() + "/transaction_testdb";
dbname = test::PerThreadDBPath("transaction_testdb");
DestroyDB(dbname, options);
txn_db_options.transaction_lock_timeout = 0;

@ -186,7 +186,7 @@ TEST(WriteBatchWithIndex, SubBatchCnt) {
DB* db;
Options options;
options.create_if_missing = true;
const std::string dbname = test::TmpDir() + "/transaction_testdb";
const std::string dbname = test::PerThreadDBPath("transaction_testdb");
DestroyDB(dbname, options);
ASSERT_OK(DB::Open(options, dbname, &db));
ColumnFamilyHandle* cf_handle = nullptr;

@ -43,7 +43,7 @@ class TtlTest : public testing::Test {
public:
TtlTest() {
env_.reset(new SpecialTimeEnv(Env::Default()));
dbname_ = test::TmpDir() + "/db_ttl";
dbname_ = test::PerThreadDBPath("db_ttl");
options_.create_if_missing = true;
options_.env = env_.get();
// ensure that compaction is kicked in to always strip timestamp from kvs

@ -972,7 +972,7 @@ TEST_F(WriteBatchWithIndexTest, TestGetFromBatchMerge) {
options.merge_operator = MergeOperators::CreateFromStringId("stringappend");
options.create_if_missing = true;
std::string dbname = test::TmpDir() + "/write_batch_with_index_test";
std::string dbname = test::PerThreadDBPath("write_batch_with_index_test");
DestroyDB(dbname, options);
Status s = DB::Open(options, dbname, &db);
@ -1020,7 +1020,7 @@ TEST_F(WriteBatchWithIndexTest, TestGetFromBatchMerge2) {
options.merge_operator = MergeOperators::CreateFromStringId("stringappend");
options.create_if_missing = true;
std::string dbname = test::TmpDir() + "/write_batch_with_index_test";
std::string dbname = test::PerThreadDBPath("write_batch_with_index_test");
DestroyDB(dbname, options);
Status s = DB::Open(options, dbname, &db);
@ -1078,7 +1078,7 @@ TEST_F(WriteBatchWithIndexTest, TestGetFromBatchAndDB) {
DB* db;
Options options;
options.create_if_missing = true;
std::string dbname = test::TmpDir() + "/write_batch_with_index_test";
std::string dbname = test::PerThreadDBPath("write_batch_with_index_test");
DestroyDB(dbname, options);
Status s = DB::Open(options, dbname, &db);
@ -1129,7 +1129,7 @@ TEST_F(WriteBatchWithIndexTest, TestGetFromBatchAndDBMerge) {
Options options;
options.create_if_missing = true;
std::string dbname = test::TmpDir() + "/write_batch_with_index_test";
std::string dbname = test::PerThreadDBPath("write_batch_with_index_test");
options.merge_operator = MergeOperators::CreateFromStringId("stringappend");
@ -1255,7 +1255,7 @@ TEST_F(WriteBatchWithIndexTest, TestGetFromBatchAndDBMerge2) {
Options options;
options.create_if_missing = true;
std::string dbname = test::TmpDir() + "/write_batch_with_index_test";
std::string dbname = test::PerThreadDBPath("write_batch_with_index_test");
options.merge_operator = MergeOperators::CreateFromStringId("stringappend");

Loading…
Cancel
Save