rocksdb/table
Yu Zhang 32dd657bad Add some per key optimization for UDT in memtable only feature (#13031)
Summary:
This PR added some optimizations for the per key handling for SST file for the user-defined timestamps in Memtable only feature. CPU profiling shows this part is a big culprit for regression. This optimization saves some string construction/destruction/appending/copying. vector operations like reserve/emplace_back.

When iterating keys in a block, we need to copy some shared bytes from previous key, put it together with the non shared bytes and find a right location to pad the min timestamp. Previously, we create a tmp local string buffer to first construct the key from its pieces, and then copying this local string's content into `IterKey`'s buffer. To avoid having this local string and to avoid this extra copy. Instead of piecing together the key in a local string first, we just track all the pieces that make this key in a reused Slice array. And then copy the pieces in order into `IterKey`'s buffer. Since the previous key should be kept intact while we are copying some shared bytes from it,  we added a secondary buffer in `IterKey` and alternate between primary buffer and secondary buffer.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13031

Test Plan: Existing tests.

Reviewed By: ltamasi

Differential Revision: D63416531

Pulled By: jowlyzhang

fbshipit-source-id: 9819b0e02301a2dbc90621b2fe4f651bc912113c
2024-10-03 17:57:50 -07:00
..
adaptive Remove unnecessary, confusing 'extern' (#12300) 2024-01-29 10:38:08 -08:00
block_based Add some per key optimization for UDT in memtable only feature (#13031) 2024-10-03 17:57:50 -07:00
cuckoo Fix kBlockCacheTier read when merge-chain base value is in a blob file (#12462) 2024-03-21 12:38:53 -07:00
plain Steps toward deprecating implicit prefix seek, related fixes (#13026) 2024-09-20 15:54:19 -07:00
block_fetcher.cc Add ticker stats for read corruption retries (#12923) 2024-08-12 15:32:07 -07:00
block_fetcher.h Fix stale memory access with FSBuffer and tiered sec cache (#12712) 2024-05-30 12:33:58 -07:00
block_fetcher_test.cc Use format_version=6 by default (#12352) 2024-02-15 11:23:48 -08:00
cleanable_test.cc
compaction_merging_iterator.cc Fix possible double-free on TruncatedRangeDelIterator (#12805) 2024-06-24 11:51:16 -07:00
compaction_merging_iterator.h Fix possible double-free on TruncatedRangeDelIterator (#12805) 2024-06-24 11:51:16 -07:00
format.cc Fix a couple of missing cases of retry on corruption (#13007) 2024-09-13 13:56:49 -07:00
format.h Fix a couple of missing cases of retry on corruption (#13007) 2024-09-13 13:56:49 -07:00
get_context.cc Fix kBlockCacheTier read when merge-chain base value is in a blob file (#12462) 2024-03-21 12:38:53 -07:00
get_context.h Fix kBlockCacheTier read when merge-chain base value is in a blob file (#12462) 2024-03-21 12:38:53 -07:00
internal_iterator.h Support returning write unix time in iterator property (#12428) 2024-03-15 15:37:37 -07:00
iter_heap.h
iterator.cc Add `Iterator` property "rocksdb.iterator.is-value-pinned" (#12659) 2024-05-15 19:11:52 -07:00
iterator_wrapper.h Support returning write unix time in iterator property (#12428) 2024-03-15 15:37:37 -07:00
merger_test.cc internal_repo_rocksdb (435146444452818992) (#12115) 2023-12-01 11:15:17 -08:00
merging_iterator.cc Fix possible double-free on TruncatedRangeDelIterator (#12805) 2024-06-24 11:51:16 -07:00
merging_iterator.h Fix possible double-free on TruncatedRangeDelIterator (#12805) 2024-06-24 11:51:16 -07:00
meta_blocks.cc Fix a couple of missing cases of retry on corruption (#13007) 2024-09-13 13:56:49 -07:00
meta_blocks.h Add some checks at property block creation side (#12898) 2024-07-31 13:28:17 -07:00
mock_table.cc Fix kBlockCacheTier read when merge-chain base value is in a blob file (#12462) 2024-03-21 12:38:53 -07:00
mock_table.h Remove 'virtual' when implied by 'override' (#12319) 2024-01-31 13:14:42 -08:00
multiget_context.h
persistent_cache_helper.cc Remove extra semi colon from internal_repo_rocksdb/repo/db/table_cache_sync_and_async.h 2024-03-04 06:34:44 -08:00
persistent_cache_helper.h Change internal headers with duplicate names (#11408) 2023-05-17 11:27:09 -07:00
persistent_cache_options.h Change internal headers with duplicate names (#11408) 2023-05-17 11:27:09 -07:00
sst_file_dumper.cc Support read timestamp in ldb (#12641) 2024-05-13 15:43:12 -07:00
sst_file_dumper.h Augment sst_dump tool to verify num_entries in table property (#12322) 2024-02-01 14:35:03 -08:00
sst_file_reader.cc Remove extra semi colon from internal_repo_rocksdb/repo/table/sst_file_reader.cc 2024-05-22 07:14:52 -07:00
sst_file_reader_test.cc Add support in SstFileReader to get a raw table iterator (#12385) 2024-04-02 21:23:06 -07:00
sst_file_writer.cc Fix/improve temperature handling for file ingestion (#12402) 2024-03-05 16:56:08 -08:00
sst_file_writer_collectors.h Add CompactForTieringCollector to support automatically trigger compaction for tiering use case (#12760) 2024-06-18 10:51:29 -07:00
table_builder.h Add CompactForTieringCollector to support automatically trigger compaction for tiering use case (#12760) 2024-06-18 10:51:29 -07:00
table_factory.cc
table_iterator.h Add support in SstFileReader to get a raw table iterator (#12385) 2024-04-02 21:23:06 -07:00
table_properties.cc Record largest seqno in table properties and verify in file ingestion (#12951) 2024-08-21 16:24:18 -07:00
table_properties_internal.h
table_reader.h Deshim coro in fbcode/internal_repo_rocksdb 2024-09-14 09:48:21 -07:00
table_reader_bench.cc Rename IntTblPropCollector -> InternalTblPropColl (#12320) 2024-02-02 14:14:43 -08:00
table_test.cc Steps toward deprecating implicit prefix seek, related fixes (#13026) 2024-09-20 15:54:19 -07:00
two_level_iterator.cc internal_repo_rocksdb (435146444452818992) (#12115) 2023-12-01 11:15:17 -08:00
two_level_iterator.h Remove unnecessary, confusing 'extern' (#12300) 2024-01-29 10:38:08 -08:00
unique_id.cc internal_repo_rocksdb (435146444452818992) (#12115) 2023-12-01 11:15:17 -08:00
unique_id_impl.h