Fix invalid reference in MultiGet due to vector resizing (#10702)

Summary:
Fix invalid reference in MultiGet due to resizing of the ```batches``` autovector.

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

Test Plan: Run asan crash test

Reviewed By: riversand963

Differential Revision: D39608753

Pulled By: anand1976

fbshipit-source-id: 7a9e7fc6f436f08eb22003d0e6b0e1e4dcdc1a2a
main
anand76 2 years ago committed by Facebook GitHub Bot
parent 2cc5b39560
commit 01ebe8a5f7
  1. 5
      db/version_set.cc

@ -2776,6 +2776,11 @@ Status Version::MultiGetAsync(
to_process.emplace_back(0);
while (!to_process.empty()) {
// As we process a batch, it may get split into two. So reserve space for
// an additional batch in the autovector in order to prevent later moves
// of elements in ProcessBatch().
batches.reserve(batches.size() + 1);
size_t idx = to_process.front();
FilePickerMultiGet* batch = &batches.at(idx);
unsigned int num_tasks_queued = 0;

Loading…
Cancel
Save