rocksdb/db_stress_tool
Andrew Kryczka 84228e21e8 Fix shutdown in db_stress with -test_batches_snapshots=1 (#9313)
Summary:
The `SharedState` constructor had an early return in case of
`-test_batches_snapshots=1`. This early return caused `num_bg_threads_`
to never be incremented. Consequently, the driver thread could cleanup
objects like the `SharedState` while BG threads were still running and
accessing it, leading to crash.

The fix is to move the logic for counting threads (both FG and BG) to
the place they are launched. That way we can be sure the counts are
consistent, at least for now.

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

Test Plan:
below command used to fail, now it passes.

```
$ ./db_stress --db=./test-db/ --expected_values_dir=./test-db-expected/ --max_key=100000 --ops_per_thread=1000 --sync_fault_injection=1 --clear_column_family_one_in=0 --destroy_db_initially=0 -reopen=0 -test_batches_snapshots=1
```

Reviewed By: jay-zhuang

Differential Revision: D33198670

Pulled By: ajkr

fbshipit-source-id: 126592dc1eb31998bc8f82ffbf5a0d4eb8dec317
2021-12-17 17:31:40 -08:00
..
batched_ops_stress.cc db_stress support tracking historical values (#8960) 2021-12-07 13:41:48 -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 verify with lost unsynced operations (#8966) 2021-12-15 12:54:44 -08:00
db_stress_common.h db_stress verify with lost unsynced operations (#8966) 2021-12-15 12:54:44 -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 shutdown in db_stress with -test_batches_snapshots=1 (#9313) 2021-12-17 17:31:40 -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 db_stress to add --open_metadata_write_fault_one_in (#8235) 2021-04-28 10:58:05 -07:00
db_stress_gflags.cc db_stress verify with lost unsynced operations (#8966) 2021-12-15 12:54:44 -08:00
db_stress_listener.cc Make MemoryAllocator into a Customizable class (#8980) 2021-12-17 04:20:47 -08:00
db_stress_listener.h Fix stress/crash test handling of SST unique IDs (#9054) 2021-10-19 11:52:07 -07: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 Fix shutdown in db_stress with -test_batches_snapshots=1 (#9313) 2021-12-17 17:31:40 -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 db_stress verify with lost unsynced operations (#8966) 2021-12-15 12:54:44 -08:00
db_stress_test_base.h Stress test for RocksDB transactions (#8936) 2021-12-14 13:34:43 -08:00
db_stress_tool.cc Stress test for RocksDB transactions (#8936) 2021-12-14 13:34:43 -08:00
db_stress.cc Add (& fix) some simple source code checks (#8821) 2021-09-07 21:19:27 -07:00
expected_state.cc db_stress verify with lost unsynced operations (#8966) 2021-12-15 12:54:44 -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 Stress test for RocksDB transactions (#8936) 2021-12-14 13:34:43 -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 db_stress support tracking historical values (#8960) 2021-12-07 13:41:48 -08:00