Skip to content

Deflake tests of compaction based on compensated file size#8036

Closed
ajkr wants to merge 4 commits into
facebook:masterfrom
ajkr:deflake-compensated-file-size-tests
Closed

Deflake tests of compaction based on compensated file size#8036
ajkr wants to merge 4 commits into
facebook:masterfrom
ajkr:deflake-compensated-file-size-tests

Conversation

@ajkr

@ajkr ajkr commented Mar 5, 2021

Copy link
Copy Markdown
Contributor

CompactionDeletionTriggerReopen was observed to be flaky recently:
https://app.circleci.com/pipelines/github/facebook/rocksdb/6030/workflows/787af4f3-b9f7-4645-8e8d-1fb0ebf05539/jobs/101451.

I went through it and the related tests and arrived at different
conclusions on what constraints we can expect on DB size. Some
constraints got looser and some got tighter. The particular constraint
that flaked got a lot looser so at least the flake linked above would have been prevented.

Comment thread db/db_compaction_test.cc Outdated
Comment thread db/db_compaction_test.cc Outdated
Comment thread db/db_compaction_test.cc Outdated

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@ajkr has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@riversand963 riversand963 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @ajkr for investigating the flaky test!

Comment thread db/db_compaction_test.cc Outdated
Comment thread db/db_compaction_test.cc Outdated
Comment on lines 368 to 388

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test itself is testing something not obvious, and as this PR shows, can become flaky when (not necessarily other) developers make changes elsewhere in the codebase. I would argue that a unit test should be accurate and strict: it either succeeds if no invariant changes, or breaks immediately otherwise. Trying to assert on something which may or may not break if some change happens sounds scary to me.
Nevertheless, kudos to these analysis.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, these are not great tests. I'll probably land this since having documented/flaky limits is at least better than having undocumented/flaky limits. Hopefully we still later think of a simpler way to test whether compaction picking takes into account tombstones.

Comment thread db/db_compaction_test.cc Outdated
Comment thread db/db_compaction_test.cc Outdated
ajkr added 4 commits March 14, 2021 19:13
CompactionDeletionTriggerReopen was observed to be flaky recently:
https://app.circleci.com/pipelines/github/facebook/rocksdb/6030/workflows/787af4f3-b9f7-4645-8e8d-1fb0ebf05539/jobs/101451.

I went through it and the related tests and arrived at different
conclusions on what constraints we can expect on DB size. Some
constraints got looser and some got tighter. The particular constraint
that flaked got a lot looser so at least it would have been prevented.

@ajkr ajkr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review!

Comment thread db/db_compaction_test.cc Outdated
Comment thread db/db_compaction_test.cc Outdated
Comment on lines 368 to 388

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, these are not great tests. I'll probably land this since having documented/flaky limits is at least better than having undocumented/flaky limits. Hopefully we still later think of a simpler way to test whether compaction picking takes into account tombstones.

Comment thread db/db_compaction_test.cc Outdated
Comment thread db/db_compaction_test.cc Outdated
@ajkr ajkr force-pushed the deflake-compensated-file-size-tests branch from 018eb88 to 2d15f7a Compare March 15, 2021 02:26
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@ajkr has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@ajkr merged this pull request in b8f40f7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants