Skip to content

Commit

Permalink
Deflake DBTest2.PartitionedIndexUserToInternalKey on ppc64le (faceboo…
Browse files Browse the repository at this point in the history
…k#8044)

Summary:
For some reason I still cannot figure out, the manual flush in this test
was sometimes producing a third tiny file. I saw it a bunch of times on
ppc64le, but even running a qemu system with that architecture (and
playing with various other options) could not repro. However we did get
an instrumented Travis run to confirm the problem is indeed a third tiny
file - https://travis-ci.org/github/facebook/rocksdb/jobs/761986592. We
can avoid it by filling memtables less full and using manual flush.

Pull Request resolved: facebook#8044

Reviewed By: akankshamahajan15

Differential Revision: D26892635

Pulled By: ajkr

fbshipit-source-id: 775c04176931cf01d07cc78fb82cfe3a11beebcf
  • Loading branch information
ajkr authored and facebook-github-bot committed Mar 8, 2021
1 parent ce391ff commit 0ff0b62
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions db/db_test2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,14 @@ class PartitionedIndexTestListener : public EventListener {
};

TEST_F(DBTest2, PartitionedIndexUserToInternalKey) {
const int kValueSize = 10500;
const int kNumEntriesPerFile = 1000;
const int kNumFiles = 3;
const int kNumDistinctKeys = 30;

BlockBasedTableOptions table_options;
Options options = CurrentOptions();
options.disable_auto_compactions = true;
table_options.index_type = BlockBasedTableOptions::kTwoLevelIndexSearch;
PartitionedIndexTestListener* listener = new PartitionedIndexTestListener();
options.table_factory.reset(NewBlockBasedTableFactory(table_options));
Expand All @@ -164,14 +170,15 @@ TEST_F(DBTest2, PartitionedIndexUserToInternalKey) {
Reopen(options);
Random rnd(301);

for (int i = 0; i < 3000; i++) {
int j = i % 30;
std::string value = rnd.RandomString(10500);
ASSERT_OK(Put("keykey_" + std::to_string(j), value));
snapshots.push_back(db_->GetSnapshot());
for (int i = 0; i < kNumFiles; i++) {
for (int j = 0; j < kNumEntriesPerFile; j++) {
int key_id = (i * kNumEntriesPerFile + j) % kNumDistinctKeys;
std::string value = rnd.RandomString(kValueSize);
ASSERT_OK(Put("keykey_" + std::to_string(key_id), value));
snapshots.push_back(db_->GetSnapshot());
}
ASSERT_OK(Flush());
}
ASSERT_OK(Flush());
dbfull()->TEST_WaitForFlushMemTable();

for (auto s : snapshots) {
db_->ReleaseSnapshot(s);
Expand Down

0 comments on commit 0ff0b62

Please sign in to comment.