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

Ignore kBottommostFiles compaction logic when allow_ingest_behind #10767

Closed
wants to merge 3 commits into from

Conversation

cbi42
Copy link
Member

@cbi42 cbi42 commented Oct 3, 2022

Summary: fix for #10752 where RocksDB could be in an infinite compaction loop (with compaction reason kBottommostFiles) if allow_ingest_behind is enabled and the bottommost level is unfilled.

Test plan: Added a unit test to reproduce the compaction loop.

@cbi42 cbi42 force-pushed the udt-bottommost-compaction branch from 639383a to 2048697 Compare October 3, 2022 18:05
@cbi42 cbi42 requested a review from ajkr October 3, 2022 18:48
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 marked this pull request as draft October 3, 2022 21:53
@cbi42 cbi42 force-pushed the udt-bottommost-compaction branch from 2048697 to 3955fc2 Compare October 3, 2022 23:27
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 marked this pull request as ready for review October 3, 2022 23:27
@facebook-github-bot
Copy link
Contributor

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

Comment on lines +7979 to +8217
auto snapshot = db_->GetSnapshot();
// Bump up oldest_snapshot_seqnum_ in VersionStorageInfo.
db_->ReleaseSnapshot(snapshot);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does ComputeBottommostFilesMarkedForCompaction() pick the L1 file even without snapshot?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so. The criteria in ComputeBottommostFilesMarkedForCompaction is satisfied. The sequence number in the L1 file is not zeroed out due to allow_ingest_behind.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you mean not taking snapshot in this test, then no. Since oldest_snapshot_seqnum_ would be 0 and only files with 0 < largest_seqno < oldest_snapshot_seqnum_ is compacted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe oldest_snapshot_seqnum_ isn't set properly when there's no snapshots. Anyways it's not very important.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Comment on lines +7979 to +8217
auto snapshot = db_->GetSnapshot();
// Bump up oldest_snapshot_seqnum_ in VersionStorageInfo.
db_->ReleaseSnapshot(snapshot);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe oldest_snapshot_seqnum_ isn't set properly when there's no snapshots. Anyways it's not very important.

@cbi42 cbi42 force-pushed the udt-bottommost-compaction branch from 3955fc2 to 673e61e Compare October 4, 2022 20:46
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 force-pushed the udt-bottommost-compaction branch from 673e61e to 7555812 Compare October 5, 2022 05:37
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 mentioned this pull request Oct 5, 2022
riversand963 pushed a commit to riversand963/rocksdb that referenced this pull request Oct 5, 2022
…cebook#10767)

Summary:
fix for facebook#10752 where RocksDB could be in an infinite compaction loop (with compaction reason kBottommostFiles)  if allow_ingest_behind is enabled and the bottommost level is unfilled.

Pull Request resolved: facebook#10767

Test Plan: Added a unit test to reproduce the compaction loop.

Reviewed By: ajkr

Differential Revision: D40031861

Pulled By: ajkr

fbshipit-source-id: 71c4b02931fbe507a847632905404c9b8fa8c96b
riversand963 pushed a commit that referenced this pull request Oct 5, 2022
…0767)

Summary:
fix for #10752 where RocksDB could be in an infinite compaction loop (with compaction reason kBottommostFiles)  if allow_ingest_behind is enabled and the bottommost level is unfilled.

Pull Request resolved: #10767

Test Plan: Added a unit test to reproduce the compaction loop.

Reviewed By: ajkr

Differential Revision: D40031861

Pulled By: ajkr

fbshipit-source-id: 71c4b02931fbe507a847632905404c9b8fa8c96b
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