Fix out-of-bounds access in MultiDBParallelOpenTest (#9046)

Summary:
`dbs` should not be cleared, as it is reused later when reopening the DBs, so we have an out-of-bounds access with `dbnames[dbnum]`. The values left in the vector don't need to be reset, as the db pointer is an out parameter for `DB::Open`.

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

Reviewed By: pdillinger

Differential Revision: D31738263

Pulled By: ot

fbshipit-source-id: c619e947b8d3dbc3d896f29971f093d3e3c794d3
This commit is contained in:
Giuseppe Ottaviano 2021-10-18 21:23:28 -07:00 committed by Facebook GitHub Bot
parent 314de7e7de
commit f0841d4faf

View File

@ -5537,8 +5537,6 @@ TEST_F(DBTest2, TestCompactFiles) {
}
#endif // ROCKSDB_LITE
// TODO: figure out why this test fails in appveyor
#ifndef OS_WIN
TEST_F(DBTest2, MultiDBParallelOpenTest) {
const int kNumDbs = 2;
Options options = CurrentOptions();
@ -5569,7 +5567,6 @@ TEST_F(DBTest2, MultiDBParallelOpenTest) {
}
// Verify non-empty DBs can be recovered in parallel
dbs.clear();
open_threads.clear();
for (int i = 0; i < kNumDbs; ++i) {
open_threads.emplace_back(
@ -5586,7 +5583,6 @@ TEST_F(DBTest2, MultiDBParallelOpenTest) {
ASSERT_OK(DestroyDB(dbnames[i], options));
}
}
#endif // OS_WIN
namespace {
class DummyOldStats : public Statistics {