Andrew Kryczka
dd29ad4223
Separate internal and user key comparators in BlockIter
(#6944)
Summary:
Replace `BlockIter::comparator_` and `IndexBlockIter::user_comparator_wrapper_` with a concrete `UserComparatorWrapper` and `InternalKeyComparator`. The motivation for this change was the inconvenience of not knowing the concrete type of `BlockIter::comparator_`, which prevented calling specialized internal key comparison functions to optimize comparison of keys with global seqno applied.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6944
Test Plan:
benchmark setup -- single file DBs, in-memory, no compression. "normal_db"
created by regular flush; "ingestion_db" created by ingesting a file. Both
DBs have same contents.
```
$ TEST_TMPDIR=/dev/shm/normal_db/ ./db_bench -benchmarks=fillrandom,compact -write_buffer_size=10485760000 -disable_auto_compactions=true -compression_type=none -num=1000000
$ ./ldb write_extern_sst ./tmp.sst --db=/dev/shm/ingestion_db/dbbench/ --compression_type=no --hex --create_if_missing < <(./sst_dump --command=scan --output_hex --file=/dev/shm/normal_db/dbbench/000007.sst | awk 'began {print "0x" substr($1, 2, length($1) - 2), "==>", "0x" $5} ; /^Sst file format: block-based/ {began=1}')
$ ./ldb ingest_extern_sst ./tmp.sst --db=/dev/shm/ingestion_db/dbbench/
```
benchmark run command:
```
$ TEST_TMPDIR=/dev/shm/$DB/ ./db_bench -benchmarks=seekrandom -seek_nexts=$SEEK_NEXT -use_existing_db=true -cache_index_and_filter_blocks=false -num=1000000 -cache_size=0 -threads=1 -reads=200000000 -mmap_read=1 -verify_checksum=false
```
results: perf improved marginally for ingestion_db and did not change significantly for normal_db:
SEEK_NEXT | DB | code | ops/sec | % change
-- | -- | -- | -- | --
0 | normal_db | master | 350880 |
0 | normal_db | PR6944 | 351040 | 0.0
0 | ingestion_db | master | 343255 |
0 | ingestion_db | PR6944 | 349424 | 1.8
10 | normal_db | master | 218711 |
10 | normal_db | PR6944 | 217892 | -0.4
10 | ingestion_db | master | 220334 |
10 | ingestion_db | PR6944 | 226437 | 2.8
Reviewed By: pdillinger
Differential Revision: D21924676
Pulled By: ajkr
fbshipit-source-id: ea4288a2eefa8112eb6c651a671c1de18c12e538
2020-07-07 17:26:16 -07:00
..
2020-03-06 14:05:12 -08:00
2020-02-20 12:09:57 -08:00
2020-05-21 14:48:10 -07:00
2020-02-20 12:09:57 -08:00
2020-06-22 13:32:07 -07:00
2019-04-18 10:55:01 -07:00
2017-07-15 16:11:23 -07:00
2020-07-02 19:25:41 -07:00
2020-02-20 12:09:57 -08:00
2020-06-02 15:05:07 -07:00
2020-02-20 12:09:57 -08:00
2020-05-21 08:12:51 -07:00
2020-02-20 12:09:57 -08:00
2020-03-06 16:24:27 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-05-12 09:27:35 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-05-08 14:14:00 -07:00
2019-09-20 12:04:26 -07:00
2019-05-21 16:22:35 -07:00
2019-05-21 16:22:35 -07:00
2019-06-24 16:12:39 -07:00
2019-05-21 16:22:35 -07:00
2020-02-20 12:09:57 -08:00
2020-04-20 13:24:25 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-04-13 19:13:41 -07:00
2020-05-21 08:12:51 -07:00
2020-06-03 15:55:03 -07:00
2020-06-25 17:25:42 -07:00
2020-06-22 13:32:07 -07:00
2019-10-07 20:10:53 -07:00
2020-03-20 14:59:54 -07:00
2020-02-20 12:09:57 -08:00
2020-04-20 13:24:25 -07:00
2020-02-20 12:09:57 -08:00
2020-06-03 15:55:03 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-04-28 14:49:34 -07:00
2020-04-20 13:24:25 -07:00
2020-02-20 12:09:57 -08:00
2020-04-21 13:16:31 -07:00
2019-05-21 16:22:35 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-04-20 13:24:25 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-05-08 12:40:43 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-05-21 10:58:39 -07:00
2020-05-21 10:58:39 -07:00
2020-02-20 12:09:57 -08:00
2020-06-04 11:44:09 -07:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-02-20 12:09:57 -08:00
2020-06-13 13:25:20 -07:00
2020-06-13 13:25:20 -07:00
2017-07-15 16:11:23 -07:00
2020-02-20 12:09:57 -08:00
2020-05-11 13:30:00 -07:00
2020-04-07 11:55:27 -07:00
2020-07-07 17:26:16 -07:00
2020-02-20 12:09:57 -08:00
2020-04-01 16:40:18 -07:00
2020-04-03 10:26:49 -07:00
2020-03-16 17:02:00 -07:00
2020-04-20 13:24:25 -07:00
2019-10-24 17:16:46 -07:00