From 1052ea236fa07360f1af4fcd29363b51a5a4b03e Mon Sep 17 00:00:00 2001 From: amayank Date: Wed, 20 Feb 2013 17:37:13 -0800 Subject: [PATCH] Exploring the rocksdb stress test Summary: Fixed a bug in the stress-test where the correct size was not being passed to GenerateValue. This bug was there since the beginning but assertions were switched on in our code-base only recently. Added comments on the top detailing how the stress test works and how to quicken/slow it down after investigation. Test Plan: make all check. ./db_stress Reviewers: dhruba, asad Reviewed By: dhruba CC: vamsi, sheki, heyongqiang, zshao Differential Revision: https://reviews.facebook.net/D8727 --- tools/db_stress.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 0eb1e541e..ed68626a0 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -2,6 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. +//The test uses an array to compare against values written to the database. +//Keys written to the array are in 1:1 correspondence to the actual values in +//the database according to the formula in the functino GenerateValue + +//Space is reserved in the array from 0 to FLAGS_max_key and values are randomly +//written/deleted/read from those positions. During verification we compare all +//the positions in the array. Therefore to shorten/elongate the amount of time +//that this test runs for, you should change the settings: +//FLAGS_max_key, FLAGS_ops_per_thread, (sometimes also FLAGS_threads) + #include #include #include @@ -622,7 +632,6 @@ class StressTest { std::string *value_from_db, bool strict=false) const { Slice k((char*)&key, sizeof(key)); char value[100]; - size_t value_sz = 0; uint32_t value_base = shared.Get(key); if (value_base == SharedState::SENTINEL && !strict) { return; @@ -632,7 +641,7 @@ class StressTest { if (value_base == SharedState::SENTINEL) { VerificationAbort("Unexpected value found", key); } - size_t sz = GenerateValue(value_base, value, value_sz); + size_t sz = GenerateValue(value_base, value, sizeof(value)); if (value_from_db->length() != sz) { VerificationAbort("Length of value read is not equal", key); }