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
This commit is contained in:
parent
7aa31ba4a9
commit
9c932816cf
@ -31,6 +31,13 @@ UniqueIdVerifier::UniqueIdVerifier(const std::string& db_name)
|
|||||||
FileSystem& fs = *FileSystem::Default();
|
FileSystem& fs = *FileSystem::Default();
|
||||||
IOOptions opts;
|
IOOptions opts;
|
||||||
|
|
||||||
|
Status st = fs.CreateDirIfMissing(db_name, opts, nullptr);
|
||||||
|
if (!st.ok()) {
|
||||||
|
fprintf(stderr, "Failed to create directory %s: %s\n",
|
||||||
|
db_name.c_str(), st.ToString().c_str());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<FSSequentialFile> reader;
|
std::unique_ptr<FSSequentialFile> reader;
|
||||||
Status s =
|
Status s =
|
||||||
|
Loading…
Reference in New Issue
Block a user