Stabilize DBTest.ApproximateSizesMemTable (#7064)

Summary:
Random memtable layouts could cause random failure,
reproducible with command below running for a while. Test now using
deterministic behavior.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/7064

Test Plan: while ./db_test --gtest_filter=*SizesMemTable*; do true; done

Reviewed By: siying

Differential Revision: D22339442

Pulled By: pdillinger

fbshipit-source-id: 8e74e5a9b5e88f7030854045a22c12cf561d5de6
main
Peter Dillinger 4 years ago committed by Facebook GitHub Bot
parent 8e6ff044e1
commit e2fd501d44
  1. 4
      db/db_test.cc

@ -1421,7 +1421,9 @@ TEST_F(DBTest, ApproximateSizesMemTable) {
keys[i * 3 + 1] = i * 5 + 1;
keys[i * 3 + 2] = i * 5 + 2;
}
RandomShuffle(std::begin(keys), std::end(keys));
// MemTable entry counting is estimated and can vary greatly depending on
// layout. Thus, using deterministic seed for test stability.
RandomShuffle(std::begin(keys), std::end(keys), rnd.Next());
for (int i = 0; i < N * 3; i++) {
ASSERT_OK(Put(Key(keys[i] + 1000), RandomString(&rnd, 1024)));

Loading…
Cancel
Save