Filter `Get()`s from `db_stress` traces (#9315)

Summary:
`db_stress` traces are used for tracking unsynced changes. For that purpose, we
only need to track writes and not reads. Currently `TraceOptions` only
supports excluding `Get()`s from the trace, so this PR only excludes
`Get()`s. In the future it would be good to exclude `MultiGet()`s and
iterator operations too.

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

Test Plan:
- trace-heavy `db_stress` command elapsed time reduced 37%

Benchmark:
```
TEST_TMPDIR=/dev/shm /usr/bin/time ./db_stress -ops_per_thread=100000 -sync_fault_injection=1 -expected_values_dir=/dev/shm/dbstress_expected --clear_column_family_one_in=0
```

- replay-heavy `db_stress` command elapsed time reduced 38%

Setup:
```
TEST_TMPDIR=/dev/shm /usr/bin/time ./db_stress -ops_per_thread=100000000 -sync_fault_injection=1 -expected_values_dir=/dev/shm/dbstress_expected --clear_column_family_one_in=0 & sleep 120; pkill -9 db_stress
```
Benchmark:
```
TEST_TMPDIR=/dev/shm /usr/bin/time ./db_stress -ops_per_thread=1 -reopen=0 -expected_values_dir=/dev/shm/dbstress_expected --clear_column_family_one_in=0 --destroy_db_initially=0
```

Reviewed By: zhichao-cao

Differential Revision: D33229900

Pulled By: ajkr

fbshipit-source-id: 0e4251c674d236ddbc4548e9bbfdd608bf3cdc93
This commit is contained in:
Andrew Kryczka 2021-12-22 14:16:19 -08:00 committed by Facebook GitHub Bot
parent 65996dd757
commit dfff1cecff
1 changed files with 3 additions and 1 deletions

View File

@ -296,7 +296,9 @@ Status FileExpectedStateManager::SaveAtAndAfter(DB* db) {
&trace_writer); &trace_writer);
} }
if (s.ok()) { if (s.ok()) {
s = db->StartTrace(TraceOptions(), std::move(trace_writer)); TraceOptions trace_opts;
trace_opts.filter |= kTraceFilterGet;
s = db->StartTrace(trace_opts, std::move(trace_writer));
} }
// Delete old state/trace files. Deletion order does not matter since we only // Delete old state/trace files. Deletion order does not matter since we only