Fix stress test failure for async_io (#10660)

Summary:
Sanitize initial_auto_readahead_size if its greater than max_auto_readahead_size in case of async_io

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

Test Plan: Ran db_stress with intitial_auto_readahead_size  greater than max_auto_readahead_size.

Reviewed By: anand1976

Differential Revision: D39408095

Pulled By: akankshamahajan15

fbshipit-source-id: 07f933242f636cfbc7ccf042e0c8b959a8ec5f3a
main
Akanksha Mahajan 2 years ago committed by Facebook GitHub Bot
parent f79b3d19a7
commit bd2ad2f9a0
  1. 8
      table/block_based/block_prefetcher.cc

@ -45,6 +45,10 @@ void BlockPrefetcher::PrefetchIfNeeded(
return; return;
} }
if (initial_auto_readahead_size_ > max_auto_readahead_size) {
initial_auto_readahead_size_ = max_auto_readahead_size;
}
// In case of no_sequential_checking, it will skip the num_file_reads_ and // In case of no_sequential_checking, it will skip the num_file_reads_ and
// will always creates the FilePrefetchBuffer. // will always creates the FilePrefetchBuffer.
if (no_sequential_checking) { if (no_sequential_checking) {
@ -81,10 +85,6 @@ void BlockPrefetcher::PrefetchIfNeeded(
return; return;
} }
if (initial_auto_readahead_size_ > max_auto_readahead_size) {
initial_auto_readahead_size_ = max_auto_readahead_size;
}
if (rep->file->use_direct_io()) { if (rep->file->use_direct_io()) {
rep->CreateFilePrefetchBufferIfNotExists( rep->CreateFilePrefetchBufferIfNotExists(
initial_auto_readahead_size_, max_auto_readahead_size, initial_auto_readahead_size_, max_auto_readahead_size,

Loading…
Cancel
Save