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

Deflake DeleteSchedulerTest.StartBGEmptyTrashMultipleTimes #9706

Closed
wants to merge 3 commits into from

Conversation

jay-zhuang
Copy link
Contributor

The designed sync point may not be hit if trash file is generated faster
than deleting. Then the file will be deleted directly instead of waiting
for background trash empty thread to do it.
Increase SstFileManager Trash/DB ratio to avoid that.

Test Plan: gtest-parallel ./delete_scheduler_test --gtest_filter=DeleteSchedulerTest.StartBGEmptyTrashMultipleTimes -r 10000 -w 100
It was likely to happen on one of the host.

The designed sync point may not be hit if trash file is generated faster
than deleting. Then the file will be deleted directly instead of waiting
for background trash empty thread to do it.
Increase SstFileManager Trash/DB ratio to avoid that.

Test Plan: `gtest-parallel ./delete_scheduler_test
--gtest_filter=DeleteSchedulerTest.StartBGEmptyTrashMultipleTimes -r
10000 -w 100`
It was likely to happen on one of the host.
@facebook-github-bot
Copy link
Contributor

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

// If trash file is generated faster than deleting, delete_scheduler will
// delete it directly instead of waiting for background trash empty thread to
// clean it. Set the ratio higher to avoid that.
sst_file_mgr_->SetMaxTrashDBRatio(10);
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like the chosen ratio 10 depends on the number of iterations 5? If there are more iterations, we will be generating more trash. Suppose trash empty thread lags behind, then it will lag behind even more with more iterations. Therefore, we need to increase the trash/db ratio even more?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, we should use a const variable for that.
It should only depend on the dummy files number inside of each run, which is 10:

// Generate 10 dummy files and move them to trash
for (int i = 0; i < 10; i++) {

Each run should be indecent, because it delete_scheduler_->WaitForEmptyTrash(); (and the test assumes all deleted file should go to trash).

@facebook-github-bot
Copy link
Contributor

@jay-zhuang has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

// Move files to trash, wait for empty trash, start again
for (int run = 1; run <= 5; run++) {
// Generate 10 dummy files and move them to trash
for (int i = 0; i < 10; i++) {
for (int i = 0; i < kTestFileNum; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor: maybe the comment in line 456 should also be updated to

// Generate kTestFileNum dummy files

@facebook-github-bot
Copy link
Contributor

@jay-zhuang has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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.

3 participants