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
This commit is contained in:
Peter Dillinger 2020-07-01 13:50:06 -07:00 committed by Facebook GitHub Bot
parent 8e6ff044e1
commit e2fd501d44
1 changed files with 3 additions and 1 deletions

View File

@ -1421,7 +1421,9 @@ TEST_F(DBTest, ApproximateSizesMemTable) {
keys[i * 3 + 1] = i * 5 + 1; keys[i * 3 + 1] = i * 5 + 1;
keys[i * 3 + 2] = i * 5 + 2; 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++) { for (int i = 0; i < N * 3; i++) {
ASSERT_OK(Put(Key(keys[i] + 1000), RandomString(&rnd, 1024))); ASSERT_OK(Put(Key(keys[i] + 1000), RandomString(&rnd, 1024)));