Skip to content
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

Closed
wants to merge 6 commits into from

Conversation

siying
Copy link
Contributor

@siying siying commented Sep 23, 2019

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.

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.
@siying
Copy link
Contributor Author

siying commented Sep 24, 2019

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.

@siying
Copy link
Contributor Author

siying commented Sep 24, 2019

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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!

Copy link
Contributor Author

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.

for (uint64_t i = 0; i < FLAGS_num_iterations && iter->Valid(); i++) {
if (thread->rand.OneIn(2)) {
iter->Next();
if (cmp_iter->Valid()) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OA?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any comment on this?

Copy link
Contributor Author

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why prefix is disabled?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@siying
Copy link
Contributor Author

siying commented Sep 26, 2019

@maysamyabandeh do you think all comments are properly addressed?

@siying siying changed the title crash_test to do some verify for prefix extractor and iterator bounds. crash_test to do some verification for prefix extractor and iterator bounds. Sep 27, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 679a45d.

merryChris pushed a commit to merryChris/rocksdb that referenced this pull request Nov 18, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants