rocksdb/db_stress_tool
Yanqin Jin 3122cb4358 Revise APIs related to user-defined timestamp (#8946)
Summary:
ajkr reminded me that we have a rule of not including per-kv related data in `WriteOptions`.
Namely, `WriteOptions` should not include information about "what-to-write", but should just
include information about "how-to-write".

According to this rule, `WriteOptions::timestamp` (experimental) is clearly a violation. Therefore,
this PR removes `WriteOptions::timestamp` for compliance.
After the removal, we need to pass timestamp info via another set of APIs. This PR proposes a set
of overloaded functions `Put(write_opts, key, value, ts)`, `Delete(write_opts, key, ts)`, and
`SingleDelete(write_opts, key, ts)`. Planned to add `Write(write_opts, batch, ts)`, but its complexity
made me reconsider doing it in another PR (maybe).

For better checking and returning error early, we also add a new set of APIs to `WriteBatch` that take
extra `timestamp` information when writing to `WriteBatch`es.
These set of APIs in `WriteBatchWithIndex` are currently not supported, and are on our TODO list.

Removed `WriteBatch::AssignTimestamps()` and renamed `WriteBatch::AssignTimestamp()` to
`WriteBatch::UpdateTimestamps()` since this method require that all keys have space for timestamps
allocated already and multiple timestamps can be updated.

The constructor of `WriteBatch` now takes a fourth argument `default_cf_ts_sz` which is the timestamp
size of the default column family. This will be used to allocate space when calling APIs that do not
specify a column family handle.

Also, updated `DB::Get()`, `DB::MultiGet()`, `DB::NewIterator()`, `DB::NewIterators()` methods, replacing
some assertions about timestamp to returning Status code.

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

Test Plan:
make check
./db_bench -benchmarks=fillseq,fillrandom,readrandom,readseq,deleterandom -user_timestamp_size=8
./db_stress --user_timestamp_size=8 -nooverwritepercent=0 -test_secondary=0 -secondary_catch_up_one_in=0 -continuous_verification_interval=0

Make sure there is no perf regression by running the following
```
./db_bench_opt -db=/dev/shm/rocksdb -use_existing_db=0 -level0_stop_writes_trigger=256 -level0_slowdown_writes_trigger=256 -level0_file_num_compaction_trigger=256 -disable_wal=1 -duration=10 -benchmarks=fillrandom
```

Before this PR
```
DB path: [/dev/shm/rocksdb]
fillrandom   :       1.831 micros/op 546235 ops/sec;   60.4 MB/s
```
After this PR
```
DB path: [/dev/shm/rocksdb]
fillrandom   :       1.820 micros/op 549404 ops/sec;   60.8 MB/s
```

Reviewed By: ltamasi

Differential Revision: D33721359

Pulled By: riversand963

fbshipit-source-id: c131561534272c120ffb80711d42748d21badf09
2022-02-01 22:19:01 -08:00
..
batched_ops_stress.cc Revise APIs related to user-defined timestamp (#8946) 2022-02-01 22:19:01 -08:00
cf_consistency_stress.cc db_stress support tracking historical values (#8960) 2021-12-07 13:41:48 -08:00
CMakeLists.txt Stress test for RocksDB transactions (#8936) 2021-12-14 13:34:43 -08:00
db_stress_common.cc db_stress: db_stress fails on custom filesystems. (#9352) 2022-01-25 16:22:58 -08:00
db_stress_common.h Detect (new) Bloom/Ribbon Filter construction corruption (#9342) 2022-02-01 17:42:35 -08:00
db_stress_compaction_filter.h Prevent deadlock in db_stress with DbStressCompactionFilter (#8956) 2021-09-24 16:54:02 -07:00
db_stress_driver.cc Fix a copy-paste bug related to background threads in db_stress (#9485) 2022-02-01 15:56:17 -08:00
db_stress_driver.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
db_stress_env_wrapper.h Make the Env class Customizable (#9293) 2022-01-04 16:45:49 -08:00
db_stress_gflags.cc Detect (new) Bloom/Ribbon Filter construction corruption (#9342) 2022-02-01 17:42:35 -08:00
db_stress_listener.cc db_stress: db_stress fails on custom filesystems. (#9352) 2022-01-25 16:22:58 -08:00
db_stress_listener.h db_stress: db_stress fails on custom filesystems. (#9352) 2022-01-25 16:22:58 -08:00
db_stress_shared_state.cc Silence false alarms in db_stress fault injection (#6741) 2020-04-24 13:06:12 -07:00
db_stress_shared_state.h Optimize db_stress setup phase (#9475) 2022-02-01 11:47:28 -08:00
db_stress_stat.cc Fix Statistics in db_stress (#9260) 2021-12-07 16:24:22 -08:00
db_stress_stat.h Fix Statistics in db_stress (#9260) 2021-12-07 16:24:22 -08:00
db_stress_table_properties_collector.h Fix and detect headers with missing dependencies (#8893) 2021-09-10 10:00:26 -07:00
db_stress_test_base.cc Revise APIs related to user-defined timestamp (#8946) 2022-02-01 22:19:01 -08:00
db_stress_test_base.h db_stress begin tracking expected state after verification (#9470) 2022-01-31 13:35:32 -08:00
db_stress_tool.cc db_stress: db_stress fails on custom filesystems. (#9352) 2022-01-25 16:22:58 -08:00
db_stress.cc Add (& fix) some simple source code checks (#8821) 2021-09-07 21:19:27 -07:00
expected_state.cc Optimize db_stress setup phase (#9475) 2022-02-01 11:47:28 -08:00
expected_state.h db_stress verify with lost unsynced operations (#8966) 2021-12-15 12:54:44 -08:00
multi_ops_txns_stress.cc Make the Env class Customizable (#9293) 2022-01-04 16:45:49 -08:00
multi_ops_txns_stress.h Stress test for RocksDB transactions (#8936) 2021-12-14 13:34:43 -08:00
no_batched_ops_stress.cc Revise APIs related to user-defined timestamp (#8946) 2022-02-01 22:19:01 -08:00