rocksdb/db_stress_tool
Aravind Ramesh 9c932816cf db_stress: db_stress segmentation fault (#9219)
Summary:
db_stress asserts/seg-faults with below command (on debug and release builds)

```
"rm -rf /tmp/rocksdbtest*; db_stress --ops_per_thread=1000 --reopen=5"
=======================================
Error opening unique id file for append: IO error: No such file or directory:
While open a file for appending: /tmp/rocksdbtest-0/dbstress/.unique_ids:
No such file or directory
Choosing random keys with no overwrite
Creating 2621440 locks
Starting continuous_verification_thread
2021/11/15-08:46:49  Initializing worker threads
2021/11/15-08:46:49  Starting database operations
2021/11/15-08:46:49  Reopening database for the 1th time
WARNING: prefix_size is non-zero but memtablerep != prefix_hash
DB path: [/tmp/rocksdbtest-0/dbstress]
Segmentation fault
=======================================

```
StressTest() constructor deletes the directory "dbstress" because
the option --destroy_db_initially is true by default in db_stress.

This Seg fault happens on a new database, UniqueIdVerifier's constructor
tries to read the ".unique_ids" file, if the file is not present,
ReopenWritableFile() tries to create .unique_ids file, but fails
as the directory db_stress is not available. The data_file_writer_
is set as an invalid(null) pointer and in subsequent calls (~UniqueIdVerifier()
and UniqueIdVerifier::Verify()) it accesses this null pointer and crashes.

This patch creates db_stress directory if it is missing, so the .unique_ids file
is created.

Signed-off-by: Aravind Ramesh <aravind.ramesh@wdc.com>

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

Reviewed By: ajkr

Differential Revision: D32730151

Pulled By: pdillinger

fbshipit-source-id: f47baba56b380d93c3ba5608904756e86bbf14f5
2021-11-30 14:56:13 -08:00
..
CMakeLists.txt Experimental support for SST unique IDs (#8990) 2021-10-18 23:32:01 -07:00
batched_ops_stress.cc Allow WriteBatch to have keys with different timestamp sizes (#8725) 2021-09-12 15:34:26 -07:00
cf_consistency_stress.cc Fix cf_consistency_stress for backup/restore, harmonize (#7373) 2020-09-10 22:55:06 -07:00
db_stress.cc Add (& fix) some simple source code checks (#8821) 2021-09-07 21:19:27 -07:00
db_stress_common.cc Add user-defined timestamps to db_stress (#8061) 2021-03-23 05:13:30 -07:00
db_stress_common.h Support readahead during compaction for blob files (#9187) 2021-11-19 17:53:47 -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 Use SystemClock* instead of std::shared_ptr<SystemClock> in lower level routines (#8033) 2021-03-15 04:34:11 -07: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 Support readahead during compaction for blob files (#9187) 2021-11-19 17:53:47 -08:00
db_stress_listener.cc db_stress: db_stress segmentation fault (#9219) 2021-11-30 14:56:13 -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 Refactor expected state in stress/crash test (#8913) 2021-09-28 14:13:33 -07:00
db_stress_stat.h Use SystemClock* instead of std::shared_ptr<SystemClock> in lower level routines (#8033) 2021-03-15 04:34:11 -07: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 Fix build for msvc (#9230) 2021-11-29 14:27:48 -08:00
db_stress_test_base.h Inject fatal write failures to db_stress when DB is running (#8479) 2021-07-01 14:16:47 -07:00
db_stress_tool.cc Stress test to inject read failures in DB reopen (#8476) 2021-07-06 11:05:27 -07:00
expected_state.cc Refactor expected state in stress/crash test (#8913) 2021-09-28 14:13:33 -07:00
expected_state.h Refactor expected state in stress/crash test (#8913) 2021-09-28 14:13:33 -07:00
no_batched_ops_stress.cc Improve fault injection to MultiRead (#8937) 2021-09-21 14:48:15 -07:00