-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crash_test to do some verification for prefix extractor and iterator bounds. #5846
Conversation
Summary: For now, crash_test is not able to report any failure for the logic related to iterator upper, lower bounds or iterators, or reseek. These are features prone to errors. Improve db_stress in several ways: (1) For each iterator run, reseek up to 3 times. (2) For every iterator, create control iterator with upper or lower bound, with total order seek. Compare the results with the iterator. (3) Make simple crash test to avoid prefix size to have more coverage. Test Plan: Manually hack the code to create wrong results and see they are caught by the tool.
I don't know it's a good thing or bad thing but, after running crash test for several hours with the PR, the assertion failed. |
I relaxed the verification condition in the prefix case. I'm rerunning the test and see whether it still fails. |
FLAGS_ops_per_thread - i - 1)); | ||
rand_keys = GenerateNKeys(thread, num_seeks, i); | ||
TestMultiGet(thread, read_opts, rand_column_families, rand_keys); | ||
i += num_seeks - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add inline comments of why we are doing reseek (via MultiGet I guess?) before iterate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. It looks like a bug that I copied TestMultiGet() by mistake... Let me fix it.
iter->key().ToString(true).c_str(), | ||
seek_key.ToString(true).c_str()); | ||
|
||
*diverged = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set diverged to true but we do not set any error here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is set in line 2616.
tools/db_stress.cc
Outdated
for (uint64_t i = 0; i < FLAGS_num_iterations && iter->Valid(); i++) { | ||
if (thread->rand.OneIn(2)) { | ||
iter->Next(); | ||
if (cmp_iter->Valid()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if statement could be removed if add diverged to the for loop condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what's the point of complicating the code further more while the performance here is not critical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that simpler. But this is not a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant "diverged to the for loop condition." not to the "if condition". But it does not matter much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still valuable to do Next(), Prev() after diverged to make sure it doesn't crash, not?
tools/db_stress.cc
Outdated
@@ -3814,8 +3954,8 @@ class BatchedOpsStressTest : public StressTest { | |||
fprintf(stderr, "error : inconsistent values for key %s: %s, %s\n", | |||
key.ToString(true).c_str(), StringToHex(values[0]).c_str(), | |||
StringToHex(values[i]).c_str()); | |||
// we continue after error rather than exiting so that we can | |||
// find more errors if any | |||
// we continue after error rather than OAexiting so that we can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any comment on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I overlooked it. Will fix.
@@ -124,8 +124,9 @@ def is_direct_io_supported(dbname): | |||
"max_background_compactions": 1, | |||
"max_bytes_for_level_base": 67108864, | |||
"memtablerep": "skip_list", | |||
"prefixpercent": 25, | |||
"readpercent": 25, | |||
"prefixpercent": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why prefix is disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to have some test to cover non-prefix case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused. So the tests that covered prefix cases are gone now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in simple_default_params structure. So the change disable prefix test in simple crash test. We run simple, normal and atomic flush crash test, so prefix tests are still there in 2/3 of the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update this sentence in the PR description? "Make simple crash test to avoid prefix size to have more coverage." If i understood it right, you meant to say: "Limit prefix tests to only normal and atomic flush crash test, to let simple crash tests have higher coverage on non-prefix workloads."
"readpercent": 25, | ||
"prefixpercent": 0, | ||
"readpercent": 50, | ||
"prefix_size" : -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need two parameters to enable/disable prefix tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefixpercent is to determine whether to run the queries about prefix scan, and "prefix_size" is to determine prefix_extractor to use. Unless we disable prefix extractor, other tests will still go through it.
@maysamyabandeh do you think all comments are properly addressed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siying is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request has been merged in 679a45d. |
…bounds. (facebook#5846) Summary: For now, crash_test is not able to report any failure for the logic related to iterator upper, lower bounds or iterators, or reseek. These are features prone to errors. Improve db_stress in several ways: (1) For each iterator run, reseek up to 3 times. (2) For every iterator, create control iterator with upper or lower bound, with total order seek. Compare the results with the iterator. (3) Make simple crash test to avoid prefix size to have more coverage. (4) make prefix_size = 0 a valid size and -1 to indicate disabling prefix extractor. Pull Request resolved: facebook#5846 Test Plan: Manually hack the code to create wrong results and see they are caught by the tool. Differential Revision: D17631760 fbshipit-source-id: acd460a177bd2124a5ffd7fff490702dba63030b
Summary:
For now, crash_test is not able to report any failure for the logic related to iterator upper, lower bounds or iterators, or reseek. These are features prone to errors. Improve db_stress in several ways:
(1) For each iterator run, reseek up to 3 times.
(2) For every iterator, create control iterator with upper or lower bound, with total order seek. Compare the results with the iterator.
(3) Make simple crash test to avoid prefix size to have more coverage.
(4) make prefix_size = 0 a valid size and -1 to indicate disabling prefix extractor.
Test Plan: Manually hack the code to create wrong results and see they are caught by the tool.