ae152ee666
Summary:
In previous https://github.com/facebook/rocksdb/issues/5079, we added user-specified timestamp to `DB::Get()` and `DB::Put()`. Limitation is that these two functions may cause extra memory allocation and key copy. The reason is that `WriteBatch` does not allocate extra memory for timestamps because it is not aware of timestamp size, and we did not provide an API to assign/update timestamp of each key within a `WriteBatch`.
We address these issues in this PR by doing the following.
1. Add a `timestamp_size_` to `WriteBatch` so that `WriteBatch` can take timestamps into account when calling `WriteBatch::Put`, `WriteBatch::Delete`, etc.
2. Add APIs `WriteBatch::AssignTimestamp` and `WriteBatch::AssignTimestamps` so that application can assign/update timestamps for each key in a `WriteBatch`.
3. Avoid key copy in `GetImpl` by adding new constructor to `LookupKey`.
Test plan (on devserver):
```
$make clean && COMPILE_WITH_ASAN=1 make -j32 all
$./db_basic_test --gtest_filter=Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/*
$make check
```
If the API extension looks good, I will add more unit tests.
Some simple benchmark using db_bench.
```
$rm -rf /dev/shm/dbbench/* && TEST_TMPDIR=/dev/shm ./db_bench -benchmarks=fillseq,readrandom -num=1000000
$rm -rf /dev/shm/dbbench/* && TEST_TMPDIR=/dev/shm ./db_bench -benchmarks=fillrandom -num=1000000 -disable_wal=true
```
Master is at a78503bd6c
.
```
| | readrandom | fillrandom |
| master | 15.53 MB/s | 25.97 MB/s |
| PR5502 | 16.70 MB/s | 25.80 MB/s |
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5502
Differential Revision: D16340894
Pulled By: riversand963
fbshipit-source-id: 51132cf792be07d1efc3ac33f5768c4ee2608bb8
81 lines
820 B
Plaintext
81 lines
820 B
Plaintext
make_config.mk
|
|
|
|
*.a
|
|
*.arc
|
|
*.d
|
|
*.dylib*
|
|
*.gcda
|
|
*.gcno
|
|
*.o
|
|
*.so
|
|
*.so.*
|
|
*_test
|
|
*_bench
|
|
*_stress
|
|
*.out
|
|
*.class
|
|
*.jar
|
|
*.*jnilib*
|
|
*.d-e
|
|
*.o-*
|
|
*.swp
|
|
*~
|
|
*.vcxproj
|
|
*.vcxproj.filters
|
|
*.sln
|
|
*.cmake
|
|
.watchmanconfig
|
|
CMakeCache.txt
|
|
CMakeFiles/
|
|
build/
|
|
|
|
ldb
|
|
manifest_dump
|
|
sst_dump
|
|
blob_dump
|
|
block_cache_trace_analyzer
|
|
column_aware_encoding_exp
|
|
util/build_version.cc
|
|
build_tools/VALGRIND_LOGS/
|
|
coverage/COVERAGE_REPORT
|
|
.gdbhistory
|
|
.gdb_history
|
|
package/
|
|
unity.a
|
|
tags
|
|
etags
|
|
rocksdb_dump
|
|
rocksdb_undump
|
|
db_test2
|
|
trace_analyzer
|
|
trace_analyzer_test
|
|
block_cache_trace_analyzer
|
|
.DS_Store
|
|
|
|
java/out
|
|
java/target
|
|
java/test-libs
|
|
java/*.log
|
|
java/include/org_rocksdb_*.h
|
|
|
|
.idea/
|
|
*.iml
|
|
|
|
rocksdb.cc
|
|
rocksdb.h
|
|
unity.cc
|
|
java/crossbuild/.vagrant
|
|
.vagrant/
|
|
java/**/*.asc
|
|
java/javadoc
|
|
|
|
scan_build_report/
|
|
t
|
|
LOG
|
|
|
|
db_logs/
|
|
tp2/
|
|
fbcode/
|
|
fbcode
|
|
buckifier/*.pyc
|