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

User-defined timestamp support for DeleteRange() #10661

Closed
wants to merge 15 commits into from

Conversation

cbi42
Copy link
Member

@cbi42 cbi42 commented Sep 12, 2022

Summary: Add user-defined timestamp support for range deletion. The new API is DeleteRange(opt, cf, begin_key, end_key, ts). Most of the change is to update the comparator to compare without timestamp. Other than that, major changes are

  • internal range tombstone data structures (FragmentedRangeTombstoneList, RangeTombstone, etc.) to store timestamps.
  • Garbage collection of range tombstones and range tombstone covered keys during compaction.
  • Get()/MultiGet() to return the timestamp of a range tombstone when needed.
  • Get/Iterator with range tombstones bounded by readoptions.timestamp.
  • timestamp crash test now issues DeleteRange by default.

Test plan:

  • Added unit test: make check
  • Stress test: python3 tools/db_crashtest.py --enable_ts whitebox --readpercent=57 --prefixpercent=4 --writepercent=25 -delpercent=5 --iterpercent=5 --delrangepercent=4
  • Ran db_bench to measure regression when timestamp is not enabled. The tests are for write (with some range deletion) and iterate with DB fitting in memory: ./db_bench--benchmarks=fillrandom,seekrandom --writes_per_range_tombstone=200 --max_write_buffer_number=100 --min_write_buffer_number_to_merge=100 --writes=500000 --reads=500000 --seek_nexts=10 --disable_auto_compactions -disable_wal=true --max_num_range_tombstones=1000. Did not see consistent regression in no timestamp case.
micros/op fillrandom seekrandom
main 2.58 10.96
PR 10661 2.68 10.63

@cbi42 cbi42 changed the title Timestamp support for DeleteRange() User-defined timestamp support for DeleteRange() Sep 12, 2022
@cbi42 cbi42 force-pushed the timestamp-range-del branch 2 times, most recently from e57026d to 22b3167 Compare September 12, 2022 18:29
@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 ready for review September 12, 2022 19:31
@cbi42 cbi42 requested review from ajkr and riversand963 September 12, 2022 19:32
@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Thanks @cbi42 for the contribution!
A few initial questions/comments. More will follow

db/range_tombstone_fragmenter.h Outdated Show resolved Hide resolved
db/range_tombstone_fragmenter.h Show resolved Hide resolved
db/dbformat.h Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

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

1 similar comment
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 force-pushed the timestamp-range-del branch from 658e98b to d6fc542 Compare September 16, 2022 04:58
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 force-pushed the timestamp-range-del branch from d6fc542 to b9ab5bb Compare September 16, 2022 05:09
@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.

@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.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Thanks @cbi42 for the great work! Left a few comments after another pass.

db/dbformat.cc Outdated Show resolved Hide resolved
db/db_impl/db_impl_write.cc Show resolved Hide resolved
include/rocksdb/write_batch.h Show resolved Hide resolved
table/sst_file_writer.cc Outdated Show resolved Hide resolved
db/external_sst_file_ingestion_job.cc Show resolved Hide resolved
db/range_tombstone_fragmenter.h Outdated Show resolved Hide resolved
include/rocksdb/sst_file_reader.h Show resolved Hide resolved
include/rocksdb/sst_file_writer.h Outdated Show resolved Hide resolved
db/dbformat.h Outdated Show resolved Hide resolved
db/dbformat.h Outdated Show resolved Hide resolved
@riversand963 riversand963 self-requested a review September 21, 2022 23:13
@cbi42 cbi42 force-pushed the timestamp-range-del branch from e151c3a to a9fc476 Compare September 22, 2022 04:01
@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.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the contribution @cbi42 !
LGTM. It would be great to make sure no measurable perf regression for use cases that disable timestamp.

db/dbformat.h Show resolved Hide resolved
db/dbformat.h Show resolved Hide resolved
table/get_context.cc Outdated Show resolved Hide resolved
db/memtable.cc Outdated Show resolved Hide resolved
@riversand963
Copy link
Contributor

Oh, see that you have updated the PR description. Well done!

@cbi42 cbi42 force-pushed the timestamp-range-del branch from a9fc476 to 7d4415c Compare September 30, 2022 02:28
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 force-pushed the timestamp-range-del branch from 7d4415c to 93a61e7 Compare September 30, 2022 02:40
@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 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.

@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.

@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 force-pushed the timestamp-range-del branch from c9fffc8 to 17cef9c Compare September 30, 2022 17:51
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 force-pushed the timestamp-range-del branch from 17cef9c to f40f50b Compare September 30, 2022 17:54
@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 timestamp-range-del branch from f40f50b to c3ed1d9 Compare September 30, 2022 18:56
@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.

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