Break down PinnedDataIteratorRandomized

Summary:
Its timing out under tsan.
Closes https://github.com/facebook/rocksdb/pull/2928

Differential Revision: D5911766

Pulled By: maysamyabandeh

fbshipit-source-id: 2faacc07752ac8713a3a2abb5a4c4b7ae3bdf208
main
Maysam Yabandeh 7 years ago committed by Facebook Github Bot
parent 4748911357
commit aa67bae6cf
  1. 46
      db/db_iterator_test.cc

@ -1081,7 +1081,8 @@ TEST_F(DBIteratorTest, PrevAfterAndNextAfterMerge) {
ASSERT_EQ("2", it->key().ToString()); ASSERT_EQ("2", it->key().ToString());
} }
TEST_F(DBIteratorTest, PinnedDataIteratorRandomized) { class DBIteratorTestForPinnedData : public DBIteratorTest {
public:
enum TestConfig { enum TestConfig {
NORMAL, NORMAL,
CLOSE_AND_OPEN, CLOSE_AND_OPEN,
@ -1089,19 +1090,19 @@ TEST_F(DBIteratorTest, PinnedDataIteratorRandomized) {
FLUSH_EVERY_1000, FLUSH_EVERY_1000,
MAX MAX
}; };
DBIteratorTestForPinnedData() : DBIteratorTest() {}
void PinnedDataIteratorRandomized(TestConfig run_config) {
// Generate Random data
Random rnd(301);
int puts = 100000;
int key_pool = static_cast<int>(puts * 0.7);
int key_size = 100;
int val_size = 1000;
int seeks_percentage = 20; // 20% of keys will be used to test seek()
int delete_percentage = 20; // 20% of keys will be deleted
int merge_percentage = 20; // 20% of keys will be added using Merge()
// Generate Random data
Random rnd(301);
int puts = 100000;
int key_pool = static_cast<int>(puts * 0.7);
int key_size = 100;
int val_size = 1000;
int seeks_percentage = 20; // 20% of keys will be used to test seek()
int delete_percentage = 20; // 20% of keys will be deleted
int merge_percentage = 20; // 20% of keys will be added using Merge()
for (int run_config = 0; run_config < TestConfig::MAX; run_config++) {
Options options = CurrentOptions(); Options options = CurrentOptions();
BlockBasedTableOptions table_options; BlockBasedTableOptions table_options;
table_options.use_delta_encoding = false; table_options.use_delta_encoding = false;
@ -1246,7 +1247,24 @@ TEST_F(DBIteratorTest, PinnedDataIteratorRandomized) {
} }
delete iter; delete iter;
} }
};
TEST_F(DBIteratorTestForPinnedData, PinnedDataIteratorRandomizedNormal) {
PinnedDataIteratorRandomized(TestConfig::NORMAL);
}
TEST_F(DBIteratorTestForPinnedData, PinnedDataIteratorRandomizedCLoseAndOpen) {
PinnedDataIteratorRandomized(TestConfig::CLOSE_AND_OPEN);
}
TEST_F(DBIteratorTestForPinnedData,
PinnedDataIteratorRandomizedCompactBeforeRead) {
PinnedDataIteratorRandomized(TestConfig::COMPACT_BEFORE_READ);
}
TEST_F(DBIteratorTestForPinnedData, PinnedDataIteratorRandomizedFlush) {
PinnedDataIteratorRandomized(TestConfig::FLUSH_EVERY_1000);
} }
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE

Loading…
Cancel
Save